瀏覽代碼

线索更改

Guo1B0 1 年之前
父節點
當前提交
0ced52c88d
共有 14 個文件被更改,包括 217 次插入155 次删除
  1. 11 11
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/BusinessOpportunityController.java
  2. 10 4
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/ClueController.java
  3. 3 1
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/CustomController.java
  4. 4 2
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/entity/ActionLog.java
  5. 3 3
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/entity/Clue.java
  6. 4 1
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/entity/UploadFile.java
  7. 6 0
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/mapper/ActionLogMapper.java
  8. 0 2
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/mapper/ClueMapper.java
  9. 6 0
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/mapper/UploadFileMapper.java
  10. 3 2
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/ClueService.java
  11. 90 27
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/ClueServiceImpl.java
  12. 34 5
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/CustomServiceImpl.java
  13. 1 0
      fhKeeper/formulahousekeeper/management-crm/src/main/resources/application.yml
  14. 42 97
      fhKeeper/formulahousekeeper/management-crm/src/main/resources/mapper/ClueMapper.xml

+ 11 - 11
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/BusinessOpportunityController.java

@@ -51,21 +51,21 @@ public class BusinessOpportunityController {
         User user = userMapper.selectById(request.getHeader("Token"));
         HttpRespMsg msg = new HttpRespMsg();
         if (bo.getId() == null){
-            if(bOMapper.selectCount(new QueryWrapper<BusinessOpportunity>().eq("name",bo.getName())) > 0){
-                msg.setError("商机名称重复");
-                return msg;
-            }
+//            if(bOMapper.selectCount(new QueryWrapper<BusinessOpportunity>().eq("name",bo.getName())) > 0){
+//                msg.setError("商机名称重复");
+//                return msg;
+//            }
             //新增
             bo.setCompanyId(user.getCompanyId());
             bo.setCreatorId(user.getId());
             bo.setCreateTime(new Date());
             bOservice.insert(bo);
         }else {
-            String name = bOMapper.selectById(bo).getName();
-            if(bOMapper.selectCount(new QueryWrapper<BusinessOpportunity>().eq("name",bo.getName()).ne("name",name)) > 0){
-                msg.setError("商机名称已存在");
-                return msg;
-            }
+//            String name = bOMapper.selectById(bo).getName();
+//            if(bOMapper.selectCount(new QueryWrapper<BusinessOpportunity>().eq("name",bo.getName()).ne("name",name)) > 0){
+//                msg.setError("商机名称已存在");
+//                return msg;
+//            }
             //修改
             bOservice.update(bo,user.getId());
         }
@@ -118,10 +118,10 @@ public class BusinessOpportunityController {
         boolean isAll = sysFunctionService.hasPriviledge(user.getRoleId(), "查看全部商机");
         boolean isNotAll = sysFunctionService.hasPriviledge(user.getRoleId(), "查看负责部门商机");
         int i = 0;
-        if (!isAll) {
+        if (isAll) {
             list = bOservice.getAll(bo);
             i = bOservice.getTotal(bo);
-        } else if (!isNotAll) {
+        } else if (isNotAll) {
             list = bOservice.getAll1(bo, user);
             i = bOservice.getTotal1(bo, user);
         } else {

+ 10 - 4
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/ClueController.java

@@ -17,6 +17,7 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 
 import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServlet;
@@ -59,6 +60,11 @@ public class ClueController {
     public Object exportData(Clue clue, HttpServletRequest request) throws Exception {
         return clueService.exportData(clue,request);
     }
+    @RequestMapping("uploadFile")
+    public Object uploadFile(Clue clue, HttpServletRequest request, MultipartFile file) throws Exception {
+        return clueService.uploadFile(clue,request,file);
+    }
+
 
     @RequestMapping("listClue")
     public Object list(Clue clue, HttpServletRequest request) {
@@ -71,11 +77,11 @@ public class ClueController {
         boolean isNotAll = sysFunctionService.hasPriviledge(user.getRoleId(), "查看负责部门线索");
         List<Clue> list = new ArrayList<>();
         int i = 0;
-        if (!isAll) {
+        if (isAll) {
             //查看全部线索
             list = clueService.getList(clue);
             i = clueService.getTotal(clue);
-        } else if (!isNotAll) {
+        } else if (isNotAll) {
             //查看负责部门线索 找出所处部门下所有的负责人
             list = clueService.getList1(clue, user);
             i = clueService.getTotal1(clue,user);
@@ -101,11 +107,11 @@ public class ClueController {
         List<Clue> list = new ArrayList<>();
         clue.setIsDelete(1);
         int i = 0;
-        if (!isAll) {
+        if (isAll) {
             //查看全部线索
             list = clueService.getList(clue);
             i = clueService.getTotal(clue);
-        } else if (!isNotAll) {
+        } else if (isNotAll) {
             //查看负责部门线索 找出所处部门下所有的负责人
             list = clueService.getList1(clue, user);
             i = clueService.getTotal1(clue,user);

+ 3 - 1
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/CustomController.java

@@ -8,6 +8,7 @@ import com.management.platform.mapper.UserMapper;
 import com.management.platform.service.CustomService;
 import com.management.platform.util.HttpRespMsg;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.web.bind.annotation.RequestMapping;
 
 import org.springframework.web.bind.annotation.RestController;
@@ -27,7 +28,8 @@ import java.util.List;
 @RestController
 @RequestMapping("/custom")
 public class CustomController {
-
+    @Value(value = "${upload.file}")
+    private String file;
     @Autowired
     private CustomService customService;
     @Autowired

+ 4 - 2
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/entity/ActionLog.java

@@ -1,5 +1,6 @@
 package com.management.platform.entity;
 
+import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
 import com.baomidou.mybatisplus.annotation.TableId;
 import java.time.LocalDateTime;
@@ -26,8 +27,8 @@ public class ActionLog extends Model<ActionLog> {
 
     private static final long serialVersionUID=1L;
 
-    @TableId("id")
-    private Long id;
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
 
     /**
      * 模块id
@@ -46,6 +47,7 @@ public class ActionLog extends Model<ActionLog> {
      */
     @TableField("name")
     private String name;
+    private String userName;
 
     /**
      * 创建人id

+ 3 - 3
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/entity/Clue.java

@@ -56,7 +56,7 @@ public class Clue extends Model<Clue> {
     @TableField("clue_source_id")
     private Integer clueSourceId;
     @TableField(exist = false)
-    private Integer clueSourceValue;
+    private String clueSourceValue;
 
     /**
      * 电话
@@ -75,7 +75,7 @@ public class Clue extends Model<Clue> {
     @TableField("customer_industry_id")
     private Integer customerIndustryId;
     @TableField(exist = false)
-    private Integer customerIndustryValue;
+    private String customerIndustryValue;
 
     /**
      * 客户级别
@@ -83,7 +83,7 @@ public class Clue extends Model<Clue> {
     @TableField("customer_level_id")
     private Integer customerLevelId;
     @TableField(exist = false)
-    private Integer customerLevelValue;
+    private String customerLevelValue;
 
     /**
      * 地址

+ 4 - 1
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/entity/UploadFile.java

@@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.annotation.TableId;
 import java.time.LocalDateTime;
 import com.baomidou.mybatisplus.annotation.TableField;
 import java.io.Serializable;
+import java.util.Date;
+
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
@@ -33,6 +35,7 @@ public class UploadFile extends Model<UploadFile> {
      */
     @TableField("name")
     private String name;
+    private String userName;
 
     /**
      * 文件地址
@@ -50,7 +53,7 @@ public class UploadFile extends Model<UploadFile> {
      * 创建时间
      */
     @TableField("create_time")
-    private LocalDateTime createTime;
+    private Date createTime;
 
     /**
      * 创建人id

+ 6 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/mapper/ActionLogMapper.java

@@ -2,6 +2,10 @@ package com.management.platform.mapper;
 
 import com.management.platform.entity.ActionLog;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.management.platform.entity.Clue;
+import org.apache.ibatis.annotations.Select;
+
+import java.util.List;
 
 /**
  * <p>
@@ -13,4 +17,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface ActionLogMapper extends BaseMapper<ActionLog> {
 
+    @Select("select a.*,u.`name` userName from action_log a left join `user` u on a.user_id = u.id where code = 'clue' and item_id = #{id}")
+    List<ActionLog> selectByInfoList(Clue clue1);
 }

+ 0 - 2
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/mapper/ClueMapper.java

@@ -18,10 +18,8 @@ public interface ClueMapper extends BaseMapper<Clue> {
 
     List<Clue> list(Clue clue);
     List<Clue> list1(@Param("clue") Clue clue ,@Param("userId") String userId);
-    List<Clue> Deleterlist(Clue clue);
 
     Integer getTotal(Clue clue);
-    Integer getDeleterTotal(Clue clue);
 
     List<Clue> list2(@Param("clue") Clue clue ,@Param("userId") String userId);
 

+ 6 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/mapper/UploadFileMapper.java

@@ -1,7 +1,11 @@
 package com.management.platform.mapper;
 
+import com.management.platform.entity.Clue;
 import com.management.platform.entity.UploadFile;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Select;
+
+import java.util.List;
 
 /**
  * <p>
@@ -13,4 +17,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface UploadFileMapper extends BaseMapper<UploadFile> {
 
+    @Select("select a.*,u.`name` userName from upload_file a left join `user` u on a.create_id = u.id where code = 'clue' and item_id = #{id}")
+    List<UploadFile> selectByInfoList(Clue clue1);
 }

+ 3 - 2
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/ClueService.java

@@ -4,6 +4,7 @@ import com.management.platform.entity.Clue;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.management.platform.entity.User;
 import com.management.platform.util.HttpRespMsg;
+import org.springframework.web.multipart.MultipartFile;
 
 import javax.servlet.http.HttpServletRequest;
 import java.util.List;
@@ -26,10 +27,8 @@ public interface ClueService extends IService<Clue> {
     List<Clue> getList(Clue clue);
     List<Clue> getList1(Clue clue, User user);
     List<Clue> getList2(Clue clue, User user);
-    List<Clue> getDeleterList(Clue clue);
 
     Integer getTotal(Clue clue);
-    Integer getDeleterTotal(Clue clue);
 
     Clue getInfo(Clue clue);
 
@@ -43,4 +42,6 @@ public interface ClueService extends IService<Clue> {
     int getTotal2(Clue clue, User user);
 
     HttpRespMsg exportData(Clue clue, HttpServletRequest request) throws Exception;
+
+    Object uploadFile(Clue clue, HttpServletRequest request, MultipartFile file);
 }

+ 90 - 27
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/ClueServiceImpl.java

@@ -19,10 +19,13 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.multipart.MultipartFile;
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import java.beans.Transient;
+import java.io.File;
+import java.io.IOException;
 import java.time.LocalDate;
 import java.time.format.DateTimeFormatter;
 import java.util.ArrayList;
@@ -130,6 +133,9 @@ public class ClueServiceImpl extends ServiceImpl<ClueMapper, Clue> implements Cl
         clueMapper.update(clue, updateWrapper);
     }
 
+    @Value(value = "${upload.file}")
+    private String path;
+
     @Override
     public List<Clue> getList(Clue clue) {
         return clueMapper.list(clue);
@@ -145,29 +151,20 @@ public class ClueServiceImpl extends ServiceImpl<ClueMapper, Clue> implements Cl
         return clueMapper.list2(clue, user.getId());
     }
 
-    @Override
-    public List<Clue> getDeleterList(Clue clue) {
-        return clueMapper.Deleterlist(clue);
-    }
+
 
     @Override
     public Integer getTotal(Clue clue) {
         return clueMapper.getTotal(clue);
     }
 
-    @Override
-    public Integer getDeleterTotal(Clue clue) {
-        return clueMapper.getDeleterTotal(clue);
-    }
+
 
     @Override
     public Clue getInfo(Clue clue) {
         Clue clue1 = clueMapper.selectById(clue.getId());
-        clue1.setClueLogList(actionLogMapper.selectList(
-                new QueryWrapper<ActionLog>().eq("item_id", clue.getId()).eq("code","clue")
-        ));
-        clue1.setFiles(uploadFileMapper.selectList(
-                    new QueryWrapper<UploadFile>().eq("code","clue").eq("item_id", clue.getId())));
+        clue1.setClueLogList(actionLogMapper.selectByInfoList(clue1));
+        clue1.setFiles(uploadFileMapper.selectByInfoList(clue1));
         return clue1;
     }
 
@@ -190,25 +187,39 @@ public class ClueServiceImpl extends ServiceImpl<ClueMapper, Clue> implements Cl
     @Override
     public void getAndTransfer(Clue clue, User user) {
         UpdateWrapper<Clue> updateWrapper = new UpdateWrapper<>();
-        updateWrapper.eq("id", clue.getId());
+        String ids1 = clue.getIds();
+        List<Integer> ids = new ArrayList<>();
+        if (!ids1.isEmpty()) {
+            for (String id : ids1.split(",")) {
+                ids.add(Integer.parseInt(id));
+            }
+        }
+        updateWrapper.in("id", ids);
         String inchargerId = clue.getInchargerId();
         ActionLog clueLog = new ActionLog();
         clueLog.setUserId(user.getId());
         clueLog.setItemId(clue.getId());
         clueLog.setCreatTime(new Date());
         clueLog.setCode("clue");
-        if (inchargerId == null) {
-            //认领
-            clueLog.setName("认领了线索");
-            clue.setInchargerId(user.getId());
-            actionLogMapper.insert(clueLog);
-        } else {
-            //转移
-            clueLog.setName("转移了线索");
-            clue.setInchargerId(clue.getInchargerId());
-            actionLogMapper.insert(clueLog);
+
+        List<Clue> clues = clueMapper.selectList(new QueryWrapper<Clue>().in("id", ids));
+        for (Clue clue1 : clues) {
+            if (clue1.getInchargerId() == null) {
+                //认领
+                clueLog.setName("认领了线索");
+                clueLog.setUserId(user.getId());
+                clue.setInchargerId(user.getId());
+                actionLogMapper.insert(clueLog);
+            } else {
+                //转移
+                clueLog.setName("转移了线索");
+                clue.setInchargerId(clue.getInchargerId());
+                actionLogMapper.insert(clueLog);
+            }
         }
-        clueMapper.update(clue, updateWrapper);
+
+        updateWrapper.set("incharger_id",inchargerId);
+        clueMapper.update(null, updateWrapper);
 
     }
 
@@ -223,8 +234,6 @@ public class ClueServiceImpl extends ServiceImpl<ClueMapper, Clue> implements Cl
 
     }
 
-    @Value(value = "${upload.path}")
-    private String path;
 
     @Override
     public HttpRespMsg exportData(Clue clue, HttpServletRequest request) throws Exception {
@@ -249,5 +258,59 @@ public class ClueServiceImpl extends ServiceImpl<ClueMapper, Clue> implements Cl
         return excelExportService.exportGeneralExcelByTitleAndList(wxCorpInfo, fileName, dataList, path);
     }
 
+    @Value(value = "${upload.file}")
+    private String filePath;
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public Object uploadFile(Clue clue, HttpServletRequest request, MultipartFile file) {
+        User user = userMapper.selectById(request.getHeader("token"));
+        if (!file.isEmpty()) { // 检查上传的文件是否为空
+            try {
+                // 获取上传文件的原始文件名
+                String originalFilename = file.getOriginalFilename();
+
+                // 创建文件存储目录
+                File uploadDir = new File(filePath);
+                if (!uploadDir.exists()) {
+                    uploadDir.mkdirs();
+
+                }
+                UploadFile uf = new UploadFile();
+                uf.setName(originalFilename);
+                uf.setPath(filePath + originalFilename);
+                uf.setCode("clue");
+                uf.setItemId(clue.getId());
+                uf.setCreateTime(new Date());
+                uf.setCreateId(user.getId());
+                uploadFileMapper.insert(uf);
+                // 构建上传文件的目标路径
+                String filePath1 = filePath + originalFilename;
+
+                // 在服务器上创建文件
+                File dest = new File(filePath1);
+
+                // 将上传的文件保存到目标路径
+                file.transferTo(dest);
+
+                // 文件上传成功的响应消息
+                HttpRespMsg msg = new HttpRespMsg();
+                msg.setMsg("上传成功");
+                return msg;
+            } catch (IOException e) {
+                e.printStackTrace();
+                // 文件上传失败的响应消息
+                HttpRespMsg msg = new HttpRespMsg();
+                msg.setError("上传成功失败");
+                return msg;
+            }
+        } else {
+            // 文件为空的响应消息
+            HttpRespMsg msg = new HttpRespMsg();
+            msg.setError("请选择上传文件");
+            return msg;
+        }
+    }
+
 
 }

+ 34 - 5
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/CustomServiceImpl.java

@@ -3,10 +3,7 @@ package com.management.platform.service.impl;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.management.platform.entity.*;
-import com.management.platform.mapper.BusinessOpportunityMapper;
-import com.management.platform.mapper.CustomMapper;
-import com.management.platform.mapper.UploadFileMapper;
-import com.management.platform.mapper.UserMapper;
+import com.management.platform.mapper.*;
 import com.management.platform.service.CustomService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.management.platform.service.SysFunctionService;
@@ -36,6 +33,9 @@ public class CustomServiceImpl extends ServiceImpl<CustomMapper, Custom> impleme
     @Autowired
     private CustomMapper customMapper;
 
+    @Autowired
+    private ActionLogMapper actionLogMapper;
+
     @Autowired
     private UploadFileMapper uploadFileMapper;
 
@@ -69,6 +69,13 @@ public class CustomServiceImpl extends ServiceImpl<CustomMapper, Custom> impleme
                 msg.setError("电话号码重复了");
                 return msg;
             }
+            ActionLog actionLog = new ActionLog();
+            actionLog.setCode("custom");
+            actionLog.setCreatTime(new Date());
+            actionLog.setName("创建了客户");
+            actionLog.setItemId(custom.getId());
+            actionLog.setUserId(user.getId());
+            actionLogMapper.insert(actionLog);
             customMapper.updateById(custom);
         } else {
             if (customMapper.selectCount(new QueryWrapper<Custom>().eq("custom_name", custom.getCustomName())) > 0) {
@@ -81,6 +88,13 @@ public class CustomServiceImpl extends ServiceImpl<CustomMapper, Custom> impleme
             }
             custom.setCreateTime(new Date());
             custom.setCreatorId(user.getId());
+            ActionLog actionLog = new ActionLog();
+            actionLog.setCode("custom");
+            actionLog.setCreatTime(new Date());
+            actionLog.setName("编辑了客户");
+            actionLog.setUserId(user.getId());
+            actionLog.setItemId(custom.getId());
+            actionLogMapper.insert(actionLog);
             customMapper.insert(custom);
         }
         msg.setMsg("操作成功");
@@ -118,11 +132,26 @@ public class CustomServiceImpl extends ServiceImpl<CustomMapper, Custom> impleme
     public void getAndTransfer(Custom custom, User user) {
         UpdateWrapper<Custom> updateWrapper = new UpdateWrapper<>();
         updateWrapper.eq("id", custom.getId());
-        String inchargerId = custom.getInchargerId();
+        Custom custom1 = customMapper.selectById(custom.getId());
+        String inchargerId = custom1.getInchargerId();
         if (inchargerId == null) {
             //认领
+            ActionLog actionLog = new ActionLog();
+            actionLog.setCode("custom");
+            actionLog.setCreatTime(new Date());
+            actionLog.setName("认领了客户");
+            actionLog.setUserId(user.getId());
+            actionLog.setItemId(custom.getId());
+            actionLogMapper.insert(actionLog);
         } else {
             //转移
+            ActionLog actionLog = new ActionLog();
+            actionLog.setCode("custom");
+            actionLog.setCreatTime(new Date());
+            actionLog.setName("转移了客户");
+            actionLog.setUserId(user.getId());
+            actionLog.setItemId(custom.getId());
+            actionLogMapper.insert(actionLog);
         }
         customMapper.update(custom, updateWrapper);
     }

+ 1 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/resources/application.yml

@@ -100,6 +100,7 @@ mybatis:
 #####配置图片上传路径####
 upload:
   path: C:/upload/
+  file: C:/file/
 picrecongnize:
   browser: C:/picrecongnize/browser/
   develop: C:/picrecongnize/develop/

+ 42 - 97
fhKeeper/formulahousekeeper/management-crm/src/main/resources/mapper/ClueMapper.xml

@@ -66,16 +66,16 @@
         and  c.create_time BETWEEN  #{startTime} and #{endTime}
         </if>
         <if test="clueName != null and clueName != '' ">
-        and  c.clue_name =  #{clueName}
+        and  c.clue_name LIKE CONCAT('%', #{clueName}, '%')
         </if>
         <if test="phone != null and phone != '' ">
-            and  c.phone =  #{phone}
+            and  c.phone LIKE CONCAT('%', #{phone}, '%')
         </if>
         <if test="customerLevelId != null and customerLevelId != '' ">
             and  c.customer_level_id =  #{customerLevelId}
         </if>
         <if test="email != null and email != '' ">
-            and  c.email =  #{email}
+            and  c.email LIKE CONCAT('%', #{email}, '%')
         </if>
         <if test="clueSourceId != null">
         and  c.clue_source_id =  #{clueSourceId}
@@ -83,6 +83,7 @@
         <if test="customerIndustryId != null">
         and  c.customer_industry_id =  #{customerIndustryId}
         </if>
+        ORDER BY c.id DESC
         limit #{pageIndex},#{pageFrom}
     </select>
     <select id="list1" resultType="com.management.platform.entity.Clue">
@@ -114,33 +115,34 @@
         from clue c
         where
         c.company_id = #{clue.companyId} and is_delete = #{clue.isDelete}
-        and c.incharger_id in
+        and (c.incharger_id in
         (SELECT id from `user` WHERE department_id = (SELECT department_id from `user` WHERe id = #{userId}))
-        or c.incharger_id is null
+        or c.incharger_id is null)
         <if test="clue.inchargerId != null and clue.inchargerId != ''  ">
-          and  c.incharger_id =#{inchargerId}
+          and  c.incharger_id =#{clue.inchargerId}
         </if>
         <if test="clue.startTime != null and clue.endTime != null ">
             and  c.create_time BETWEEN  #{clue.startTime} and #{clue.endTime}
         </if>
         <if test="clue.clueName != null and clue.clueName != '' ">
-            and  c.clue_name =  #{clue.clueName}
+            and  c.clue_name LIKE CONCAT('%', #{clue.clueName}, '%')
         </if>
         <if test="clue.clueSourceId != null">
             and  c.clue_source_id =  #{clue.clueSourceId}
         </if>
         <if test="clue.phone != null and clue.phone != '' ">
-            and  c.phone =  #{clue.phone}
+            and  c.phone LIKE CONCAT('%', #{clue.phone}, '%')
         </if>
         <if test="clue.customerLevelId != null and clue.customerLevelId != '' ">
             and  c.customer_level_id =  #{clue.customerLevelId}
         </if>
-        <if test="email != null and email != '' ">
-            and  c.email =  #{clue.email}
+        <if test="clue.email != null and clue.email != '' ">
+            and  c.email LIKE CONCAT('%', #{clue.email}, '%')
         </if>
         <if test="clue.customerIndustryId != null">
             and  c.customer_industry_id =  #{clue.customerIndustryId}
         </if>
+        ORDER BY c.id DESC
         limit #{clue.pageIndex},#{clue.pageFrom}
     </select>
     <select id="list2" resultType="com.management.platform.entity.Clue">
@@ -172,7 +174,7 @@
         from clue c
         where
         c.company_id = #{clue.companyId} and is_delete = #{clue.isDelete}
-        and c.incharger_id = #{userId} or c.incharger_id is null
+        and (c.incharger_id = #{userId} or c.incharger_id is null)
         <if test="clue.inchargerId != null and clue.inchargerId != ''  ">
           and c.incharger_id =#{clue.inchargerId}
         </if>
@@ -180,16 +182,16 @@
             and  c.create_time BETWEEN  #{clue.startTime} and #{clue.endTime}
         </if>
         <if test="clue.clueName != null and clue.clueName != '' ">
-            and  c.clue_name =  #{clue.clueName}
+            and  c.clue_name  LIKE CONCAT('%', #{clue.clueName}, '%')
         </if>
         <if test="clue.phone != null and clue.phone != '' ">
-            and  c.phone =  #{clue.phone}
+            and  c.phone LIKE CONCAT('%', #{clue.phone}, '%')
         </if>
         <if test="clue.customerLevelId != null and clue.customerLevelId != '' ">
             and  c.customer_level_id =  #{clue.customerLevelId}
         </if>
         <if test="clue.email != null and clue.email != '' ">
-            and  c.email =  #{clue.email}
+            and  c.email LIKE CONCAT('%', #{clue.email}, '%')
         </if>
         <if test="clue.clueSourceId != null">
             and  c.clue_source_id =  #{clue.clueSourceId}
@@ -197,105 +199,48 @@
         <if test="clue.customerIndustryId != null">
             and  c.customer_industry_id =  #{clue.customerIndustryId}
         </if>
+        ORDER BY c.id DESC
         limit #{clue.pageIndex},#{clue.pageFrom}
     </select>
-    <select id="Deleterlist" resultType="com.management.platform.entity.Clue">
-        select c.id,
-               c.company_id,
-               (select company_name from company where company_id = c.id) companyName,
-               c.clue_name,
-               c.clue_source_id,
-               c.phone,
-               c.email,
-               c.customer_industry_id,
-               c.customer_level_id,
-               c.address,
-               c.incharger_id,
-               c.remark,
-               c.is_delete,
-               c.plate1,
-               c.plate2,
-               c.plate3,
-               c.plate4,
-               c.plate5,
-               c.create_time,
-               c.create_id,
-        (select name from `user` where id = c.incharger_id) inchargerName,
-        (select name from `user` where id = c.create_id) createName,
-        (select name from sys_dict where c.clue_source_id = id and code = 'ClueSources') clueSourceValue,
-        (select name from sys_dict where c.customer_industry_id = id and code = 'CustomIndustry') customerIndustryValue,
-        (select name from sys_dict where c.customer_level_id = id and code = 'CustomLevel') customerLevelValue
-        from clue c
-        where
-            c.company_id = #{companyId} and is_delete = 1
-        <if test="startTime != null and endTime != null ">
-        and  c.create_time BETWEEN  #{startTime} and #{endTime}
-        </if>
-        <if test="clueName != null and clueName != '' ">
-        and  c.clue_name =  #{clueName}
-        </if>
-        <if test="inchargerId != null and inchargerId != ''  ">
-           and c.incharger_id =#{inchargerId}
-        </if>
-        <if test="clueSourceId != null">
-        and  c.clue_source_id =  #{clueSourceId}
-        </if>
-        <if test="customerIndustryId != null">
-        and  c.customer_industry_id =  #{customerIndustryId}
-        </if>
-        limit #{pageIndex},#{pageFrom}
-    </select>
     <select id="getTotal" resultType="java.lang.Integer">
         select count(*)
         from clue c
         where
-        c.company_id = #{companyId} and is_delete = #{isDelete}
-        <if test="clue.startTime != null and clue.endTime != null ">
-            and  c.create_time BETWEEN  #{startTime} and #{endTime}
-        </if>
-        <if test="clue.inchargerId != null and clue.inchargerId != ''  ">
-           and c.incharger_id =#{inchargerId}
-        </if>
-        <if test="clue.clueName != null and clue.clueName != '' ">
-            and  c.clue_name =  #{clueName}
-        </if>
-        <if test="clue.clueSourceId != null">
-            and  c.clue_source_id =  #{clue.clueSourceId}
-        </if>
-        <if test="clue.customerIndustryId != null">
-            and  c.customer_industry_id =  #{clue.customerIndustryId}
-        </if>
-    </select>
-    <select id="getDeleterTotal" resultType="java.lang.Integer">
-        select count(*)
-        from clue c
-        where
-        c.company_id = #{companyId} and is_delete = 1
+        company_id = #{companyId} and is_delete = #{isDelete}
         <if test="inchargerId != null and inchargerId != ''  ">
-          and  c.incharger_id =#{inchargerId}
+            and incharger_id = #{inchargerId}
         </if>
         <if test="startTime != null and endTime != null ">
-            and  c.create_time BETWEEN  #{startTime} and #{endTime}
+            and  create_time BETWEEN  #{startTime} and #{endTime}
         </if>
         <if test="clueName != null and clueName != '' ">
-            and  c.clue_name =  #{clueName}
+            and  clue_name  LIKE CONCAT('%', #{clueName}, '%')
+        </if>
+        <if test="phone != null and phone != '' ">
+            and phone LIKE CONCAT('%', #{phone}, '%')
+        </if>
+        <if test="email != null and email != '' ">
+            and  email LIKE CONCAT('%', #{email}, '%')
+        </if>
+        <if test="customerLevelId != null and customerLevelId != '' ">
+            and  customer_level_id =  #{customerLevelId}
         </if>
         <if test="clueSourceId != null">
-            and  c.clue_source_id =  #{clueSourceId}
+            and  clue_source_id =  #{clueSourceId}
         </if>
         <if test="customerIndustryId != null">
-            and  c.customer_industry_id =  #{customerIndustryId}
+            and customer_industry_id =  #{customerIndustryId}
         </if>
     </select>
     <select id="getTotal1" resultType="java.lang.Integer">
-        select c.id,
-        COUNT(c.company_id)
+        select
+        COUNT(c.id)
         from clue c
         where
         c.company_id = #{clue.companyId} and is_delete = #{clue.isDelete}
         and c.incharger_id in
         (SELECT id from `user` WHERE department_id = (SELECT department_id from `user` WHERe id = #{userId}))
-        or c.incharger_id is null
+        and c.incharger_id is null
         <if test="clue.inchargerId != null and clue.inchargerId != ''  ">
            and c.incharger_id =#{clue.inchargerId}
         </if>
@@ -303,16 +248,13 @@
             and  c.create_time BETWEEN  #{clue.startTime} and #{clue.endTime}
         </if>
         <if test="clue.clueName != null and clue.clueName != '' ">
-            and  c.clue_name =  #{clue.clueName}
+            and  c.clue_name LIKE CONCAT('%', #{clue.clueName}, '%')
         </if>
         <if test="clue.phone != null and clue.phone != '' ">
-            and  c.phone =  #{clue.phone}
-        </if>
-        <if test="clue.customerLevelId != null and clue.customerLevelId != '' ">
-            and  c.customer_level_id =  #{clue.customerLevelId}
+            and  c.phone LIKE CONCAT('%', #{clue.phone}, '%')
         </if>
         <if test="clue.email != null and clue.email != '' ">
-            and  c.email =  #{clue.email}
+            and  c.email LIKE CONCAT('%', #{clue.email}, '%')
         </if>
         <if test="clue.clueSourceId != null">
             and  c.clue_source_id =  #{clue.clueSourceId}
@@ -320,6 +262,9 @@
         <if test="clue.customerIndustryId != null">
             and  c.customer_industry_id =  #{clue.customerIndustryId}
         </if>
+        <if test="clue.customerLevelId != null">
+            and  c.customerLevelId =  #{clue.customerLevelId}
+        </if>
     </select>
     <select id="getTotal2" resultType="java.lang.Integer">
         select
@@ -330,7 +275,7 @@
         <if test="clue.inchargerId != null and clue.inchargerId != ''  ">
           and  c.incharger_id =#{clue.inchargerId}
         </if>
-        and c.incharger_id = #{userId} or c.incharger_id is null
+        and c.incharger_id = #{userId} and c.incharger_id is null
         <if test="clue.startTime != null and clue.endTime != null ">
             and c.create_time BETWEEN #{clue.startTime} and #{clue.endTime}
         </if>