Commit adc9d3f4 authored by hanfeng's avatar hanfeng

Merge branch 'dev-hf' into base-modify

parents deb643f4 e81206b3
......@@ -8,10 +8,13 @@ import com.xxfc.platform.uccn.entity.SEO;
import com.xxfc.platform.uccn.mapper.SEOMapper;
import com.xxfc.platform.uccn.vo.SEOQuery;
import com.xxfc.platform.uccn.vo.SEOVo;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.beanutils.BeanUtilsBean;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import tk.mybatis.mapper.entity.Example;
import java.util.Date;
import java.util.List;
......@@ -20,7 +23,9 @@ import java.util.List;
* @author Administrator
*/
@Service
@Slf4j
public class SEOBiz extends BaseBiz<SEOMapper, SEO> {
public PageInfo<SeoDTO> getList(SEOQuery query) {
PageHelper.startPage(query.getPage(),query.getLimit());
List<SeoDTO> seodtoList = mapper.getSEODTOList();
......@@ -33,18 +38,24 @@ public class SEOBiz extends BaseBiz<SEOMapper, SEO> {
try {
if (seoVo==null) {
return false;
}
SEO seo = new SEO();
BeanUtilsBean.getInstance().copyProperties(seo,seoVo);
if (seo.getId()==null) {
Example example = new Example(SEO.class);
example.createCriteria().andEqualTo("modelId", seo.getModelId());
List<SEO> list = mapper.selectByExample(example);
if (CollectionUtils.isEmpty(list)) {
seo.setCreTime(new Date());
mapper.insertSelective(seo);
}else {
}else if (list.size()==1){
seo.setUpdTime(new Date());
mapper.updateByPrimaryKeySelective(seo);
}else {
log.error("错误!该模块保存有多个seo");
return false;
}
return true;
} catch (Exception e) {
e.printStackTrace();
......
......@@ -7,6 +7,7 @@
select
m.name as modelName ,
m.id as model_id,
s.id,
s.title as title,
s.keywords as keywords,
s.description as description,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment