This commit is contained in:
wangzhijiang
2022-07-18 16:45:04 +08:00
parent 08280ea196
commit e94a7e01e3
3 changed files with 10 additions and 24 deletions
@@ -9,10 +9,7 @@ import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import net.sf.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -29,8 +26,8 @@ public class LawsComplianceBoardController {
@AutoLog(value = "项目库-法规符合性看板列表分页查询")
@ApiOperation(value="项目库-法规符合性看板列表分页查询", notes="项目库-法规符合性看板列表分页查询")
@GetMapping(value = "/page")
public JSONObject queryPageList(@RequestParam Map<String,Object> params){
@PostMapping(value = "/page")
public JSONObject queryPageList(@RequestBody Map<String,Object> params){
IPage infoPage = this.lawsComplianceBoardService.queryPageList(params);
Result<IPage> ok = Result.OK(infoPage);
JSONObject jsonResult = JSONObject.fromObject(ok);
@@ -70,6 +70,7 @@
#{item}
</foreach>
</if>
order by pli.create_time desc
</select>
<select id="queryList" resultType="hashMap">
@@ -98,16 +99,4 @@
GROUP BY bdl.id
order by bdl.create_time desc
</select>
<sql id="Base_Where_Clause">
where 1=1
<trim suffixOverrides="," >
<if test="id != null" >
and id ${idOperator} #{id}
</if>
<if test="type != null" >
and type ${typeOperator} #{type}
</if>
</trim>
</sql>
</mapper>
@@ -431,7 +431,7 @@ public class LawsComplianceBoardServiceImpl implements ILawsComplianceBoardServi
if (value.contains("%")) {
value = value.replace("%", "/%");
}
conditionSb.append(" and " + key + " like concat(concat('%','" + value + "'),'%') ESCAPE '/'");
conditionSb.append(" and bdl." + key + " like concat(concat('%','" + value + "'),'%') ESCAPE '/'");
} else if (FieldTypeEnum.PULL_SINGLE.getValue().equals(fieldType)
|| FieldTypeEnum.PULL_MORE.getValue().equals(fieldType)
|| FieldTypeEnum.TREE.getValue().equals(fieldType)) {
@@ -439,27 +439,27 @@ public class LawsComplianceBoardServiceImpl implements ILawsComplianceBoardServi
StringBuilder condition = new StringBuilder();
for (String valueTemp : value.split(",")) {
valueSb.append("'" + valueTemp + "',");
condition.append(" or " + key + " like concat(concat('%','" + valueTemp + "'),'%')");
condition.append(" or bdl." + key + " like concat(concat('%','" + valueTemp + "'),'%')");
}
condition.append(")");
String substring = valueSb.substring(0, valueSb.length() - 1);
//下拉单选或下拉多选
conditionSb.append(" and (" + key + " in(" + substring + ")" + condition.toString());
conditionSb.append(" and (bdl." + key + " in(" + substring + ")" + condition.toString());
} else if (FieldTypeEnum.DATE_SINGLE.getValue().equals(fieldType)) {
//日期(区分单日期还时间范围)
if (value.contains(",")) {
conditionSb.append(" and " + "date_format(" + key + ",'%Y-%m-%d') >= '" + value.split(",")[0] + "'"
conditionSb.append(" and " + "date_format(bdl." + key + ",'%Y-%m-%d') >= '" + value.split(",")[0] + "'"
+ " and " + "date_format(" + key + ",'%Y-%m-%d') <= '" + value.split(",")[1] + "'");
} else {
conditionSb.append(" and " + "date_format(" + key + ",'%Y-%m-%d') = '" + value + "'");
conditionSb.append(" and " + "date_format(bdl." + key + ",'%Y-%m-%d') = '" + value + "'");
}
} else if (FieldTypeEnum.PERSON.getValue().equals(fieldType)) {
//输入框 LIKE CONCAT("%", '/%', "%") ESCAPE '/'
if (value.contains("%")) {
value = value.replace("%", "/%");
}
conditionSb.append(" and " + key + " like concat(concat('%','" + value + "'),'%') ESCAPE '/'");
conditionSb.append(" and bdl." + key + " like concat(concat('%','" + value + "'),'%') ESCAPE '/'");
}
}
}