|
@@ -1,49 +1,100 @@
|
|
|
package com.ruoyi.zzb.zdcx.service;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.ruoyi.common.annotation.DataSource;
|
|
|
import com.ruoyi.common.enums.DataSourceType;
|
|
|
-import com.ruoyi.common.utils.StringUtils;
|
|
|
+import com.ruoyi.zzb.study.domain.BasePersonInfo;
|
|
|
+import com.ruoyi.zzb.study.mapper.BasePersonInfoMapper;
|
|
|
import com.ruoyi.zzb.zdcx.domain.Zdcx;
|
|
|
import com.ruoyi.zzb.zdcx.mapper.ZdcxMapper;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.boot.autoconfigure.web.format.DateTimeFormatters;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
-import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
+import java.util.*;
|
|
|
|
|
|
+@Slf4j
|
|
|
@Service
|
|
|
@DataSource(value = DataSourceType.SLAVE)
|
|
|
public class ZdcxService {
|
|
|
|
|
|
@Autowired
|
|
|
private ZdcxMapper zdcxMapper;
|
|
|
+ @Autowired
|
|
|
+ private BasePersonInfoMapper basePersonInfoMapper;
|
|
|
|
|
|
- public List<Zdcx> getByParams(Zdcx zdcx){
|
|
|
- String docId = zdcx.getDocId();
|
|
|
- String title = zdcx.getTitle();
|
|
|
- String zhidingDept = zdcx.getZhidingDept();
|
|
|
- Date createTime = zdcx.getCreateTime();
|
|
|
- String content = zdcx.getContent();
|
|
|
+ public Map<String, Object> getDataByPage(Zdcx zdcx){
|
|
|
+ Map<String, Object> rspMap = new HashMap<>();
|
|
|
+ /*String docId = reqBody.getString("docId");
|
|
|
+ String title = reqBody.getString("title");
|
|
|
+ String zhidingDept = reqBody.getString("zhidingDept");
|
|
|
+ String createTime = reqBody.getString("createTime");
|
|
|
+ String content = reqBody.getString("content");
|
|
|
+ Integer queryFlag = reqBody.getInteger("queryFlag");
|
|
|
+ Integer pageNo = reqBody.getInteger("pageNo");
|
|
|
+ Integer pageSize = reqBody.getInteger("pageSize");
|
|
|
|
|
|
QueryWrapper<Zdcx> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.eq("FLAG", 1);
|
|
|
if(StringUtils.isNotBlank(docId)){
|
|
|
+ if (queryFlag != 0){ // or
|
|
|
+ queryWrapper.or();
|
|
|
+ }
|
|
|
queryWrapper.eq("DOC_ID", docId);
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(title)){
|
|
|
+ if (queryFlag != 0){ // or
|
|
|
+ queryWrapper.or();
|
|
|
+ }
|
|
|
queryWrapper.eq("TITLE", title);
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(zhidingDept)){
|
|
|
+ if (queryFlag != 0){ // or
|
|
|
+ queryWrapper.or();
|
|
|
+ }
|
|
|
queryWrapper.eq("ZHIDINGDEPT", zhidingDept);
|
|
|
}
|
|
|
-// if(null != createTime){
|
|
|
-// queryWrapper.eq("CREATETIME", createTime);
|
|
|
-// }
|
|
|
if(StringUtils.isNotBlank(content)){
|
|
|
+ if (queryFlag != 0){ // or
|
|
|
+ queryWrapper.or();
|
|
|
+ }
|
|
|
queryWrapper.like("CONTENT", content);
|
|
|
}
|
|
|
- List<Zdcx> dataList = zdcxMapper.selectList(queryWrapper);
|
|
|
- return dataList;
|
|
|
+ Page<Zdcx> page = new Page<>(pageNo, pageSize);
|
|
|
+ IPage<Zdcx> zdcxPage = zdcxMapper.selectPage(page, queryWrapper);
|
|
|
+ rspMap.put("list", zdcxPage.getRecords());
|
|
|
+ rspMap.put("count", zdcxPage.getTotal());*/
|
|
|
+
|
|
|
+ List<Zdcx> dataList = zdcxMapper.getDataByPage(zdcx);
|
|
|
+ Long count = zdcxMapper.getDataCount(zdcx);
|
|
|
+ rspMap.put("list", dataList);
|
|
|
+ rspMap.put("count", count);
|
|
|
+ return rspMap;
|
|
|
+ }
|
|
|
+
|
|
|
+ public BasePersonInfo getDataByParams(String policeNo){
|
|
|
+ QueryWrapper<BasePersonInfo> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.eq("POLICE_NO", policeNo);
|
|
|
+ return basePersonInfoMapper.selectOne(queryWrapper);
|
|
|
+ }
|
|
|
+
|
|
|
+ public boolean insert(JSONObject reqBody, BasePersonInfo basePersonInfo){
|
|
|
+ Zdcx zdcx = new Zdcx();
|
|
|
+ zdcx.setId(UUID.randomUUID().toString().replace("-", ""));
|
|
|
+ zdcx.setIsDelete(0);
|
|
|
+ zdcx.setFlag(1);
|
|
|
+ // ......
|
|
|
+ try {
|
|
|
+ int rows = zdcxMapper.insert(zdcx);
|
|
|
+ if (rows > 0) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }catch (Exception e){
|
|
|
+ log.error("制度规范信息保存时发生异常", e);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
}
|
|
|
+
|
|
|
}
|