src/main/java/com/zy/crm/manager/controller/PriOnline2Controller.java
@@ -57,6 +57,9 @@ @Autowired private UserService userService; @Autowired private PriOnline2FollService priOnline2FollService; String PZH = " ———————————————————————————————————————————————————————————————————————————————— "; @RequestMapping(value = "/priOnline2/{id}/auth") @@ -86,12 +89,22 @@ @RequestParam(defaultValue = "10") Integer limit, @RequestParam(required = false) String orderByField, @RequestParam(required = false) String orderByType, @RequestParam(required = false) String allSwitch, @RequestParam(required = false) String condition, @RequestParam Map<String, Object> param) { @RequestParam Map<String, Object> paramSou) { EntityWrapper<PriOnline2> wrapper = new EntityWrapper<>(); wrapper.setSqlSelect("id,title,create_time as createTime,assistant_plan_id as assistantPlanId,host_plan_id as hostPlanId,assistant_host_sign as assistantHostSign,filepath,settle,settle_size as settleSize,item_id as itemId,order_num as orderNum,template_name as templateName,user_id as userId,dept_id as deptId,status,update_time as updateTime,check_data as checkData,update_user_id as updateUserId,member_id as memberId"); // wrapper.in("member_id", getUserRoleBelongsToUserId("allopen")); excludeTrash(param); excludeTrash(paramSou); Map<String, Object> param = convertallSwitch(paramSou); if (!Cools.isEmpty(allSwitch)){ List<PriOnline2> priOnline2List = priOnline2Service.listByAll(getUserId()); Page<PriOnline2> page1 = new Page<PriOnline2>(curr, limit).setRecords(priOnline2List); page1.setTotal(priOnline2Service.listByAllTotal(getUserId())); return R.ok(page1); } convert(param, wrapper); allLike(PriOnline2.class, param.keySet(), wrapper, condition); wrapper.or().eq("member_id", getUserId()); @@ -101,6 +114,14 @@ return R.ok(priOnline2Service.selectPage(new Page<>(curr, limit), wrapper)); } private Map<String, Object> convertallSwitch(Map<String, Object> map) { for (Map.Entry<String, Object> entry : map.entrySet()) { if (entry.getKey().equals("allSwitch")) { map.remove("allSwitch"); } } return map; } private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper) { boolean signUserId = false; boolean signDeptId = false; @@ -284,6 +305,19 @@ priOnline2Service.insert(priOnline2); // 自动添加跟进人 for (User user:users){ List<PriOnline2Foll> priOnline2Folls = priOnline2FollService.selectList(new EntityWrapper<PriOnline2Foll>().eq("pri_online2_id", plan.getId()).eq("user_id", user.getId())); if (Cools.isEmpty(priOnline2Folls) || priOnline2Folls.size()==0){ PriOnline2Foll priOnline2Foll = new PriOnline2Foll(); priOnline2Foll.setPriOnline2Id(plan.getId()); priOnline2Foll.setUserId(user.getId()); if (!priOnline2FollService.insert(priOnline2Foll)) { throw new CoolException("保存失败,请重试"); } } } if (plan.getAssistantHostSign()==1){ Plan plan1 = planService.selectById(plan.getHostPlanId()); src/main/java/com/zy/crm/manager/entity/PriOnline2Foll.java
New file @@ -0,0 +1,75 @@ package com.zy.crm.manager.entity; import com.baomidou.mybatisplus.annotations.TableField; import com.baomidou.mybatisplus.annotations.TableId; import com.baomidou.mybatisplus.annotations.TableName; import com.baomidou.mybatisplus.enums.IdType; import com.core.common.Cools; import com.core.common.SpringUtils; import com.zy.crm.manager.service.PriOnline2Service; import com.zy.crm.system.entity.User; import com.zy.crm.system.service.UserService; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.io.Serializable; @Data @TableName("man_pri_online2_foll") public class PriOnline2Foll implements Serializable { private static final long serialVersionUID = 1L; /** * ID */ @ApiModelProperty(value= "ID") @TableId(value = "id", type = IdType.AUTO) private Long id; /** * 规划单 */ @ApiModelProperty(value= "规划单") @TableField("pri_online2_id") private Long priOnline2Id; /** * 跟进人 */ @ApiModelProperty(value= "跟进人") @TableField("user_id") private Long userId; public PriOnline2Foll() {} public PriOnline2Foll(Long priOnline2Id, Long userId) { this.priOnline2Id = priOnline2Id; this.userId = userId; } // PlanFoll planFoll = new PlanFoll( // null, // 规划单 // null // 跟进人[非空] // ); public String getPriOnline2Id$(){ PriOnline2Service service = SpringUtils.getBean(PriOnline2Service.class); PriOnline2 priOnline2 = service.selectById(this.priOnline2Id); if (!Cools.isEmpty(priOnline2)){ return String.valueOf(priOnline2.getTemplateName()); } return null; } public String getUserId$(){ UserService service = SpringUtils.getBean(UserService.class); User user = service.selectById(this.userId); if (!Cools.isEmpty(user)){ return String.valueOf(user.getNickname()); } return null; } } src/main/java/com/zy/crm/manager/mapper/PriOnline2FollMapper.java
New file @@ -0,0 +1,12 @@ package com.zy.crm.manager.mapper; import com.baomidou.mybatisplus.mapper.BaseMapper; import com.zy.crm.manager.entity.PriOnline2Foll; import org.apache.ibatis.annotations.Mapper; import org.springframework.stereotype.Repository; @Mapper @Repository public interface PriOnline2FollMapper extends BaseMapper<PriOnline2Foll> { } src/main/java/com/zy/crm/manager/mapper/PriOnline2Mapper.java
@@ -15,5 +15,7 @@ public interface PriOnline2Mapper extends BaseMapper<PriOnline2> { List<PriOnline2> listByPage(Page<PriOnline2> page, @Param("userIds") ArrayList<Long> userIds , @Param("condition") String condition); List<PriOnline2> listByAll( @Param("userId") Long userId ); Integer listByAllTotal( @Param("userId") Long userId ); } src/main/java/com/zy/crm/manager/service/PriOnline2FollService.java
New file @@ -0,0 +1,8 @@ package com.zy.crm.manager.service; import com.baomidou.mybatisplus.service.IService; import com.zy.crm.manager.entity.PriOnline2Foll; public interface PriOnline2FollService extends IService<PriOnline2Foll> { } src/main/java/com/zy/crm/manager/service/PriOnline2Service.java
@@ -5,9 +5,12 @@ import com.zy.crm.manager.entity.PriOnline2; import java.util.ArrayList; import java.util.List; public interface PriOnline2Service extends IService<PriOnline2> { Page<PriOnline2> listByPage(Page<PriOnline2> page, ArrayList<Long> userIds , String condition); List<PriOnline2> listByAll(Long userId); Integer listByAllTotal(Long userId); } src/main/java/com/zy/crm/manager/service/impl/PriOnline2FollServiceImpl.java
New file @@ -0,0 +1,12 @@ package com.zy.crm.manager.service.impl; import com.baomidou.mybatisplus.service.impl.ServiceImpl; import com.zy.crm.manager.entity.PriOnline2Foll; import com.zy.crm.manager.mapper.PriOnline2FollMapper; import com.zy.crm.manager.service.PriOnline2FollService; import org.springframework.stereotype.Service; @Service("priOnline2FollService") public class PriOnline2FollServiceImpl extends ServiceImpl<PriOnline2FollMapper, PriOnline2Foll> implements PriOnline2FollService { } src/main/java/com/zy/crm/manager/service/impl/PriOnline2ServiceImpl.java
@@ -8,6 +8,7 @@ import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.List; @Service("priOnline2Service") public class PriOnline2ServiceImpl extends ServiceImpl<PriOnline2Mapper, PriOnline2> implements PriOnline2Service { @@ -16,4 +17,14 @@ public Page<PriOnline2> listByPage(Page<PriOnline2> page, ArrayList<Long> userIds, String condition) { return page.setRecords(this.baseMapper.listByPage(page, userIds, condition)); } @Override public List<PriOnline2> listByAll(Long userId) { return this.baseMapper.listByAll(userId); } @Override public Integer listByAllTotal(Long userId) { return this.baseMapper.listByAllTotal(userId); } } src/main/resources/mapper/PriOnline2FollMapper.xml
New file @@ -0,0 +1,13 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.zy.crm.manager.mapper.PriOnline2FollMapper"> <!-- 通用查询映射结果 --> <resultMap id="BaseResultMap" type="com.zy.crm.manager.entity.PriOnline2Foll"> <id column="id" property="id" /> <result column="pri_online2_id" property="priOnline2Id" /> <result column="user_id" property="userId" /> </resultMap> </mapper> src/main/resources/mapper/PriOnline2Mapper.xml
@@ -75,4 +75,36 @@ ORDER BY id DESC </select> <select id="listByAll" resultMap="NoDataResultMap"> SELECT * FROM man_pri_online2 mp WHERE 1=1 and mp.id in ( select pri_online2_id from man_pri_online2_foll where 1=1 and user_id = #{userId} ) ORDER BY id DESC </select> <select id="listByAllTotal" resultType="java.lang.Integer"> SELECT count (1) FROM man_pri_online2 mp WHERE 1=1 and mp.id in ( select pri_online2_id from man_pri_online2_foll where 1=1 and user_id = #{userId} ) </select> </mapper> src/main/webapp/static/js/priOnline2/priOnline.js
@@ -29,13 +29,14 @@ // 树形图 var organizationTree; window.loadTree = function (condition) { window.loadTree = function (condition,allSwitch) { var loadIndex = layer.load(2); $.ajax({ url: baseUrl + "/dept/user/tree/auth", headers: {'token': localStorage.getItem('token')}, data: { 'condition': condition 'condition': condition, 'allSwitch': allSwitch }, method: 'POST', success: function (res) { src/main/webapp/views/priOnline2/priOnline.html
@@ -45,11 +45,16 @@ </div> </div> <div class="layui-form-item"> <div class="layui-inline"> <div class="layui-input-inline"> <input class="layui-input" type="text" name="condition" placeholder="请输入" autocomplete="off" style="border-color: #e1e1e1"> </div> <label class="layui-form-label">ALL:</label> <div class="layui-input-inline" style="text-align: left"> <input id="allSwitch" name="allSwitch" class="layui-input" type="checkBox" lay-skin="primary" lay-filter='detailCheckbox'> </div> </div> <div class="layui-inline">  <button class="layui-btn icon-btn layui-btn-sm" lay-filter="search" lay-submit>