中扬CRM客户关系管理系统
#
luxiaotao1123
2022-09-16 3be9948bd0756e545d27f3b69456f1840fd9febb
#
7个文件已修改
70 ■■■■ 已修改文件
src/main/java/com/zy/crm/system/controller/UserController.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/crm/system/mapper/UserMapper.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/crm/system/service/UserService.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/crm/system/service/impl/UserServiceImpl.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/UserMapper.xml 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/static/js/user/user.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/views/user/user.html 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/crm/system/controller/UserController.java
@@ -69,6 +69,25 @@
        return R.ok(userService.selectPage(new Page<>(curr, limit), wrapper));
    }
    @RequestMapping(value = "/mat/page/auth")
    @ManagerAuth
    public R page(@RequestParam(defaultValue = "1")Integer curr,
                  @RequestParam(defaultValue = "10")Integer limit,
                  @RequestParam(required = false)String orderByField,
                  @RequestParam(required = false)String orderByType,
                  @RequestParam Map<String, Object> param){
        Object deptId = param.get("dept_id");
        if (Cools.isEmpty(deptId)) {
            deptId = getOriginDept().getId();
        }
        return R.ok(userService.getPage(new Page<>(curr, limit)
                , getHostId()
                , String.valueOf(deptId)
                , param.get("username")
                , param.get("mobile"))
        );
    }
    private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){
        for (Map.Entry<String, Object> entry : map.entrySet()){
            String val = String.valueOf(entry.getValue());
src/main/java/com/zy/crm/system/mapper/UserMapper.java
@@ -1,7 +1,9 @@
package com.zy.crm.system.mapper;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.baomidou.mybatisplus.plugins.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import com.zy.crm.system.entity.User;
@@ -12,6 +14,8 @@
@Repository
public interface UserMapper extends BaseMapper<User> {
    List<User> listByPage(Page page, @Param("hostId")Long hostId, @Param("deptId") String deptId, @Param("username") Object username, @Param("mobile") Object mobile);
    @Select("select sys_user.* from sys_user left join sys_dept on sys_user.dept_id = sys_dept.id where sys_dept.parent_id = 1")
    List<User> getUserByDept(Long deptId);
src/main/java/com/zy/crm/system/service/UserService.java
@@ -1,5 +1,6 @@
package com.zy.crm.system.service;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.IService;
import com.zy.crm.system.entity.User;
@@ -7,6 +8,8 @@
public interface UserService extends IService<User> {
    Page<User> getPage(Page page, Long hostId, String deptId, Object username, Object mobile);
    List<User> getUserByDept(Long deptParentId);
}
src/main/java/com/zy/crm/system/service/impl/UserServiceImpl.java
@@ -1,5 +1,6 @@
package com.zy.crm.system.service.impl;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import com.zy.crm.system.entity.User;
@@ -12,6 +13,11 @@
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {
    @Override
    public Page<User> getPage(Page page, Long hostId, String deptId, Object username, Object mobile) {
        return page.setRecords(baseMapper.listByPage(page, hostId, deptId, username, mobile));
    }
    @Override
    public List<User> getUserByDept(Long dept) {
        return this.baseMapper.getUserByDept(dept);
    }
src/main/resources/mapper/UserMapper.xml
@@ -19,4 +19,23 @@
    </resultMap>
    <select id="listByPage" resultMap="BaseResultMap">
        SELECT
        su.*
        FROM sys_user su
        LEFT JOIN sys_dept sd ON su.dept_id = sd.id
        WHERE 1=1
        AND (CHARINDEX(','+#{deptId}+',', ','+sd.path+',') > 0 OR sd.id = #{deptId})
        <if test="hostId != null and hostId != ''">
            and su.host_id = #{hostId}
        </if>
        <if test="username != null and username != ''">
            and su.username like concat('%',#{username},'%')
        </if>
        <if test="mobile != null and mobile != ''">
            and su.mobile like concat('%',#{mobile},'%')
        </if>
        ORDER BY su.create_time DESC
    </select>
</mapper>
src/main/webapp/static/js/user/user.js
@@ -15,7 +15,7 @@
    insTb2 = table.render({
        elem: '#userTable',
        headers: {token: localStorage.getItem('token')},
        url: baseUrl+'/user/list/auth',
        url: baseUrl+'/user/page/auth',
        page: true,
        limit: 15,
        limits: [15, 30, 50, 100, 200, 500],
src/main/webapp/views/user/user.html
@@ -199,23 +199,6 @@
<script type="text/javascript" src="../../static/js/user/user.js" charset="utf-8"></script>
<script type="text/javascript" src="../../static/js/deptTree.js" charset="utf-8"></script>
<!-- 项目编辑窗口 -->
<script type="text/html" id="hostEditDialog">
    <form id="hostEditForm" lay-filter="hostEditForm" class="layui-form model-form">
        <input name="id" type="hidden"/>
        <div class="layui-form-item">
            <label class="layui-form-label layui-form-required">项目名称:</label>
            <div class="layui-input-block">
                <input name="name" placeholder="请输入类型名称" class="layui-input"
                       lay-verType="tips" lay-verify="required" required/>
            </div>
        </div>
        <div class="layui-form-item text-right">
            <button class="layui-btn" lay-filter="hostEditSubmit" lay-submit>保存</button>
            <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">取消</button>
        </div>
    </form>
</script>
</body>
</html>