|
|
@@ -14,6 +14,8 @@ import com.uas.sso.support.Page;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.domain.Sort;
|
|
|
import org.springframework.data.jpa.domain.Specification;
|
|
|
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
|
+import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.ui.ModelMap;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
@@ -23,9 +25,7 @@ import javax.persistence.criteria.CriteriaBuilder;
|
|
|
import javax.persistence.criteria.CriteriaQuery;
|
|
|
import javax.persistence.criteria.Predicate;
|
|
|
import javax.persistence.criteria.Root;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
|
* 类目接口实现
|
|
|
@@ -42,6 +42,9 @@ public class KindConcernServiceImpl implements KindConcernService {
|
|
|
@Autowired
|
|
|
private KindDao kindDao;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private NamedParameterJdbcTemplate jdbcTemplate;
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 添加关注
|
|
|
@@ -288,4 +291,22 @@ public class KindConcernServiceImpl implements KindConcernService {
|
|
|
return map;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Page<KindConcern> getKindByPage(PageParams pageParams, String keyword, Long enUU) {
|
|
|
+ Map<String, Object> params = new HashMap<>();
|
|
|
+ String sql = "select ki_name as nameCn, kc_id as id, kc_date as date,kc_enuu as enUU, kc_name_en as nameEn, kc_status as status " +
|
|
|
+ "from (select ki_name from product$kind) a left join (select * from product$kind_concern where kc_enuu = :enUU) b on a.ki_name = b.kc_name ";
|
|
|
+ params.put("enUU", enUU);
|
|
|
+ if (!StringUtils.isEmpty(keyword)) {
|
|
|
+ sql += " where ki_name LIKE '%' :keyword '%' ";
|
|
|
+ params.put("keyword", keyword);
|
|
|
+ }
|
|
|
+ sql += " order by status desc limit :start,:pageSize;";
|
|
|
+ PageInfo pageInfo = new PageInfo(pageParams);
|
|
|
+ params.put("start", pageInfo.getOffset());
|
|
|
+ params.put("pageSize", pageInfo.getPageSize());
|
|
|
+ List<KindConcern> kindConcerns = jdbcTemplate.query(sql, params, new BeanPropertyRowMapper<>(KindConcern.class));
|
|
|
+ return new Page<KindConcern>(pageInfo.getPageNumber(), pageInfo.getPageSize(), kindConcerns, 0);
|
|
|
+ }
|
|
|
}
|