| | |
| | | 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()); |
| | |
| | | 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; |
| | |
| | | @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); |
| | | |
| | |
| | | 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; |
| | | |
| | |
| | | |
| | | public interface UserService extends IService<User> { |
| | | |
| | | Page<User> getPage(Page page, Long hostId, String deptId, Object username, Object mobile); |
| | | |
| | | List<User> getUserByDept(Long deptParentId); |
| | | |
| | | } |
| | |
| | | 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; |
| | |
| | | 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); |
| | | } |
| | |
| | | |
| | | </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> |
| | |
| | | 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], |
| | |
| | | <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> |
| | | |