| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- package cn.com.lzt.complain.service.impl;
- import cn.com.lzt.common.util.StringUtil;
- import cn.com.lzt.complain.service.ComplainService;
- import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
- import com.baomidou.mybatisplus.core.metadata.IPage;
- import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
- import com.daju.common.util.DataPage;
- import com.daju.mix.dao.entity.TBComplaint;
- import com.daju.mix.dao.mapper.TBComplaintMapper;
- import com.daju.mix.dao.service.impl.BaseServiceImpl;
- import org.apache.commons.lang3.StringUtils;
- import org.jeecgframework.core.util.JeecgDataAutorUtils;
- import org.jeecgframework.core.util.ResourceUtil;
- import org.jeecgframework.web.system.pojo.base.TSUser;
- import org.springframework.stereotype.Service;
- import javax.servlet.http.HttpServletRequest;
- import java.util.Map;
- /**
- * @author :sahib.kio.m
- * @date :Created in 2021/8/13 下午3:48
- */
- @Service
- public class ComplainServiceImpl extends BaseServiceImpl<TBComplaintMapper, TBComplaint> implements ComplainService {
- public DataPage list(Map<String, String> param) {
- DataPage result = new DataPage();
- int page = 1;
- if(param.containsKey("page")){
- page = Integer.valueOf(param.get("page"));
- }
- int rows = 999;
- if(param.containsKey("rows")){
- rows = Integer.valueOf(param.get("rows"));
- }
- TSUser user = ResourceUtil.getSessionUser();
- String userId = user.getId();
- String code = param.get("code");
- String departId = param.get("depart.id");
- String backStatus = param.get("back.status");
- String complainDate = param.get("complaint.date");
- String responsible = param.get("responsible.user.str");
- String leader = param.get("leader.user.str");
- String from = param.get("complaint.from");
- String type = param.get("type");
- String area = param.get("area");
- String status = param.get("status");
- String rate = param.get("rate");
- QueryWrapper<?> queryWrapper = new QueryWrapper<>();
- String selectSql = " SELECT TBC.* " +
- "FROM T_B_COMPLAINT TBC WHERE 1 = 1\n";
- if(!StringUtil.isEmpty(code)){
- selectSql += "and TBC.code like '%" + code + "%' ";
- }
- if(!StringUtil.isEmpty(complainDate)){
- selectSql += "and TBC.complaint_date LIKE '%" + complainDate + "%' ";
- }
- if(!StringUtil.isEmpty(departId)){
- selectSql += "and TBC.depart_id LIKE '%" + departId + "%' ";
- }
- boolean queryUserState = false;
- if(!StringUtil.isEmpty(responsible)){
- queryUserState = true;
- selectSql += "and TBC.responsible_user_id in (select id from t_s_base_user where realname like '%" + responsible + "%')";
- }
- if(!StringUtil.isEmpty(leader)){
- queryUserState = true;
- selectSql += "and TBC.leader_user_id in (select id from t_s_base_user where realname like '%" + leader + "%')";
- }
- if(!StringUtil.isEmpty(backStatus)){
- selectSql += "and TBC.back_status = '" + backStatus + "' ";
- }
- if(!StringUtil.isEmpty(from)){
- selectSql += "and TBC.complaint_from = '" + from + "' ";
- }
- String MENU_DATA_AUTHOR_RULE_SQL = JeecgDataAutorUtils.loadDataSearchConditonSQLString();
- if(StringUtils.isNotEmpty(MENU_DATA_AUTHOR_RULE_SQL)){
- selectSql += MENU_DATA_AUTHOR_RULE_SQL;
- }
- if(!StringUtil.isEmpty(type)){
- selectSql += "and TBC.type = '" + type + "' ";
- }
- if(!StringUtil.isEmpty(area)){
- selectSql += "and TBC.area = '" + area + "' ";
- }
- if(!StringUtil.isEmpty(status)){
- selectSql += "and TBC.status = '" + status + "' ";
- }
- if(!StringUtil.isEmpty(rate)){
- selectSql += "and TBC.rate = '" + rate + "' ";
- }
- if(!queryUserState){
- selectSql += " or TBC.responsible_user_id like '%"+userId+"%' or TBC.leader_user_id like '%"+userId+"%' or TBC.create_by like '%"+userId+"%' ";
- }
- selectSql += "\t order by TBC.complaint_date desc ";
- IPage<Map<String, Object>> mapPage = getBaseMapper().queryMapPageBySql(new Page<>(page, rows), queryWrapper, selectSql);
- result.setList(mapPage.getRecords());
- result.setTotalCount((int) mapPage.getTotal());
- return result;
- }
- }
|