Commit 58bbef08 by zhangkb

指标评分规则添加关键字查询

parent 8a57fe6d
...@@ -87,9 +87,10 @@ public class IndScorecardCtrl { ...@@ -87,9 +87,10 @@ public class IndScorecardCtrl {
@ApiOperation(value = "根据评分卡目录获取评分卡", notes = "根据评分卡目录获取评分卡") @ApiOperation(value = "根据评分卡目录获取评分卡", notes = "根据评分卡目录获取评分卡")
@PostMapping(value = "/getByCatalogId") @PostMapping(value = "/getByCatalogId")
public Map<String,Object> getByCatalogId(@RequestParam Integer catalogId, public Map<String,Object> getByCatalogId(@RequestParam Integer catalogId,
@RequestParam(value = "page", required = false, defaultValue = "1") int page, @RequestParam(required = false) String keyword,
@RequestParam(value = "page", required = false, defaultValue = "0") int page,
@RequestParam(value = "rows", required = false, defaultValue = "10") int rows){ @RequestParam(value = "rows", required = false, defaultValue = "10") int rows){
return indScorecardService.getByCatalogId(catalogId,page,rows); return indScorecardService.getByCatalogId(catalogId,keyword,page,rows);
} }
@ApiOperation(value = "根据id获取评分卡", notes = "根据id获取评分卡") @ApiOperation(value = "根据id获取评分卡", notes = "根据id获取评分卡")
......
...@@ -13,7 +13,7 @@ public interface IndScorecardMapper extends BaseMapper<IndScorecard>{ ...@@ -13,7 +13,7 @@ public interface IndScorecardMapper extends BaseMapper<IndScorecard>{
public void deleteByCatalogIdIn(@Param("catalogIds")List<Integer> catalogIds); public void deleteByCatalogIdIn(@Param("catalogIds")List<Integer> catalogIds);
public List<IndScorecard> findByCatalogId(@Param("catalogId")Integer catalogId, public List<IndScorecard> findByCatalogId(@Param("catalogId")Integer catalogId,
@Param("start") int start,@Param("end") int end); @Param("keyword")String keyword,@Param("start") int start,@Param("end") int end);
public int countByCatalogId(@Param("catalogId")Integer catalogId); public int countByCatalogId(@Param("catalogId")Integer catalogId);
......
...@@ -118,13 +118,16 @@ public class IndScorecardService { ...@@ -118,13 +118,16 @@ public class IndScorecardService {
return scorecards; return scorecards;
} }
public Map<String,Object> getByCatalogId(Integer catalogId,int page,int rows){ public Map<String,Object> getByCatalogId(Integer catalogId,String keyword,int page,int rows){
Map<String,Object> result = new HashMap<>(); Map<String,Object> result = new HashMap<>();
int count = 0; int count = 0;
//计算start //计算start
int start = (page-1)*rows; int start = page*rows;
count = indScorecardMapper.countByCatalogId(catalogId); count = indScorecardMapper.countByCatalogId(catalogId);
List<IndScorecard> datas = indScorecardMapper.findByCatalogId(catalogId,start,rows); if(StringUtils.isNotBlank(keyword)) {
keyword = "%"+keyword+"%";
}
List<IndScorecard> datas = indScorecardMapper.findByCatalogId(catalogId,keyword,start,rows);
// List<IndScorecard> resultDatas = new ArrayList<>(); // List<IndScorecard> resultDatas = new ArrayList<>();
// for(IndScorecard data : datas) { // for(IndScorecard data : datas) {
// IndScorecard data1 = this.changeJson(data); // IndScorecard data1 = this.changeJson(data);
......
...@@ -5,6 +5,9 @@ ...@@ -5,6 +5,9 @@
select * select *
from drive_ind_score_card from drive_ind_score_card
where catalog_id = #{catalogId} where catalog_id = #{catalogId}
<if test="keyword!=null">
and card_name like #{keyword}
</if>
limit #{start},#{end} limit #{start},#{end}
</select> </select>
......
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