Commit 631560aa by zhangkb

单位计分规则,短板规则和短板单元分页加载接口添加关键字查询

parent b3565086
......@@ -81,9 +81,10 @@ public class ObjScoreRuleCtrl {
@ApiOperation(value = "根据单位评分规则目录获取单位评分规则", notes = "根据单位评分规则目录获取单位评分规则")
@PostMapping(value = "/getByCatalogId")
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){
return scoreRuleService.getByCatalogId(catalogId,page,rows);
return scoreRuleService.getByCatalogId(catalogId,keyword,page,rows);
}
@ApiOperation(value = "根据id获取单位评分规则", notes = "根据id获取单位评分规则")
......
......@@ -81,9 +81,10 @@ public class ShortboardRuleCtrl {
@ApiOperation(value = "根据短板筛选规则目录获取短板筛选规则", notes = "根据短板筛选规则目录获取短板筛选规则")
@PostMapping(value = "/getByCatalogId")
public Map<String,Object> getByCatalogId(@RequestParam Integer catalogId,
@RequestParam(required = false) String keyword,
@RequestParam(value = "page", required = false, defaultValue = "1") int page,
@RequestParam(value = "rows", required = false, defaultValue = "10") int rows){
return shortboardRuleService.getByCatalogId(catalogId,page,rows);
return shortboardRuleService.getByCatalogId(catalogId,keyword,page,rows);
}
@ApiOperation(value = "根据id获取短板筛选规则", notes = "根据id获取短板筛选规则")
......
......@@ -85,9 +85,10 @@ public class ShortboardUnitCtrl {
@ApiOperation(value = "根据短板筛选单元目录获取短板筛选单元", notes = "根据短板筛选单元目录获取短板筛选单元")
@PostMapping(value = "/getByCatalogId")
public Map<String,Object> getByCatalogId(@RequestParam Integer catalogId,
@RequestParam(required = false) String keyword,
@RequestParam(value = "page", required = false, defaultValue = "1") int page,
@RequestParam(value = "rows", required = false, defaultValue = "10") int rows){
return shortboardUnitService.getByCatalogId(catalogId,page,rows);
return shortboardUnitService.getByCatalogId(catalogId,keyword,page,rows);
}
@ApiOperation(value = "根据id获取短板筛选单元", notes = "根据id获取短板筛选单元")
......
......@@ -15,7 +15,7 @@ public interface ScoreRuleMapper extends BaseMapper<ScoreRule>{
public void deleteByCatalogIdIn(@Param("ids")List<Integer> ids);
public List<ScoreRule> 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,@Param("keyword")String keyword);
}
......@@ -13,7 +13,7 @@ public interface ShortboardRuleMapper extends BaseMapper<ShortboardRule>{
public void deleteByCatalogIdIn(@Param("ids")List<Integer> ids);
public List<ShortboardRule> 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,@Param("keyword")String keyword);
}
......@@ -13,7 +13,7 @@ public interface ShortboardUnitMapper extends BaseMapper<ShortboardUnit>{
public void deleteByCatalogIdIn(@Param("ids")List<Integer> ids);
public List<ShortboardUnit> 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,@Param("keyword")String keyword);
}
......@@ -70,13 +70,18 @@ public class ScoreRuleService {
return scoreRuleMapper.findByCode(code);
}
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<>();
if(StringUtils.isNotBlank(keyword)) {
keyword = "%"+keyword+"%";
}else {
keyword = null;
}
int count = 0;
//计算start
int start = (page-1)*rows;
count = scoreRuleMapper.countByCatalogId(catalogId);
List<ScoreRule> datas = scoreRuleMapper.findByCatalogId(catalogId, start, rows);
int start = page*rows;
count = scoreRuleMapper.countByCatalogId(catalogId,keyword);
List<ScoreRule> datas = scoreRuleMapper.findByCatalogId(catalogId, keyword, start, rows);
// List<ScoreRule> resultDatas = new ArrayList<>();
// for(ScoreRule data : datas) {
// ScoreRule data1 = this.changeJson(data);
......
......@@ -62,13 +62,18 @@ public class ShortboardRuleService {
}
}
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<>();
if(StringUtils.isNotBlank(keyword)) {
keyword = "%"+keyword+"%";
}else {
keyword = null;
}
int count = 0;
//计算start
int start = (page-1)*rows;
count = shortboardRuleMapper.countByCatalogId(catalogId);
List<ShortboardRule> datas = shortboardRuleMapper.findByCatalogId(catalogId, start, rows);
count = shortboardRuleMapper.countByCatalogId(catalogId, keyword);
List<ShortboardRule> datas = shortboardRuleMapper.findByCatalogId(catalogId, keyword, start, rows);
// List<ShortboardRule> resultDatas = new ArrayList<>();
// for(ShortboardRule data : datas) {
// ShortboardRule data1 = this.changeJson(data);
......
......@@ -53,13 +53,18 @@ public class ShortboardUnitService {
shortboardUnitMapper.deleteByPrimaryKey(id);
}
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<>();
if(StringUtils.isNotBlank(keyword)) {
keyword = "%"+keyword+"%";
}else {
keyword = null;
}
int count = 0;
//计算start
int start = (page-1)*rows;
count = shortboardUnitMapper.countByCatalogId(catalogId);
List<ShortboardUnit> datas = shortboardUnitMapper.findByCatalogId(catalogId, start, rows);
count = shortboardUnitMapper.countByCatalogId(catalogId,keyword);
List<ShortboardUnit> datas = shortboardUnitMapper.findByCatalogId(catalogId, keyword, start, rows);
result.put("count", count);
result.put("data", datas);
return result;
......
......@@ -11,6 +11,9 @@
select *
from obj_score_rule
where catalog_id = #{catalogId}
<if test="keyword!=null">
and rule_name like #{keyword}
</if>
limit #{start},#{end}
</select>
......@@ -18,6 +21,9 @@
select count(1)
from obj_score_rule
where catalog_id = #{catalogId}
<if test="keyword!=null">
and rule_name like #{keyword}
</if>
</select>
<delete id="deleteByCatalogIdIn" parameterType="java.util.List">
......
......@@ -5,6 +5,9 @@
select *
from short_board_rule
where catalog_id = #{catalogId}
<if test="keyword!=null">
and rule_name like #{keyword}
</if>
limit #{start},#{end}
</select>
......@@ -12,6 +15,9 @@
select count(1)
from short_board_rule
where catalog_id = #{catalogId}
<if test="keyword!=null">
and rule_name like #{keyword}
</if>
</select>
<delete id="deleteByCatalogIdIn" parameterType="java.util.List">
......
......@@ -5,6 +5,9 @@
select *
from short_board_unit
where catalog_id = #{catalogId}
<if test="keyword!=null">
and unit_name like #{keyword}
</if>
limit #{start},#{end}
</select>
......@@ -12,6 +15,9 @@
select count(1)
from short_board_unit
where catalog_id = #{catalogId}
<if test="keyword!=null">
and unit_name like #{keyword}
</if>
</select>
<delete id="deleteByCatalogIdIn" parameterType="java.util.List">
......
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