Commit d0655776c6f6d5076a195d0f3d3dd348f42b2b81
1 parent
8a979b0f6a
Exists in
master
添加角色部分信息
Showing 12 changed files with 270 additions and 98 deletions
- center.manager/src/main/java/com/lyms/cm/controller/sys/SysUsersController.java
- center.manager/src/main/java/com/lyms/cm/enums/RoleType.java
- center.manager/src/main/java/com/lyms/cm/service/sys/ISysRolesService.java
- center.manager/src/main/java/com/lyms/cm/service/sys/ISysUsersService.java
- center.manager/src/main/java/com/lyms/cm/service/sys/SysRolesService.java
- center.manager/src/main/java/com/lyms/cm/service/sys/SysUsersService.java
- center.manager/src/main/java/com/lyms/cm/service/sys/impl/SysRolesServiceImpl.java
- center.manager/src/main/java/com/lyms/cm/service/sys/impl/SysUsersServiceImpl.java
- center.manager/src/main/resources/xml/app-shiro.xml
- center.manager/src/main/webapp/WEB-INF/views/user/user_edit.html
- center.manager/src/main/webapp/WEB-INF/views/user/user_list.html
- center.manager/src/test/java/center/manager/test/user/UserTest.java
center.manager/src/main/java/com/lyms/cm/controller/sys/SysUsersController.java
View file @
d065577
| 1 | 1 | package com.lyms.cm.controller.sys; |
| 2 | 2 | |
| 3 | +import java.util.Map; | |
| 4 | + | |
| 3 | 5 | import org.springframework.beans.factory.annotation.Autowired; |
| 4 | 6 | import org.springframework.stereotype.Controller; |
| 7 | +import org.springframework.ui.Model; | |
| 8 | +import org.springframework.web.bind.annotation.PathVariable; | |
| 5 | 9 | import org.springframework.web.bind.annotation.RequestMapping; |
| 6 | 10 | import org.springframework.web.bind.annotation.RequestMethod; |
| 11 | +import org.springframework.web.bind.annotation.ResponseBody; | |
| 7 | 12 | |
| 13 | +import com.baomidou.mybatisplus.plugins.Page; | |
| 8 | 14 | import com.lyms.cm.entity.sys.SysUsers; |
| 9 | -import com.lyms.cm.service.sys.ISysUsersService; | |
| 15 | +import com.lyms.cm.service.sys.SysUsersService; | |
| 16 | +import com.lyms.constants.OperationName; | |
| 17 | +import com.lyms.web.bean.AjaxResult; | |
| 10 | 18 | import com.lyms.web.controller.BaseController; |
| 11 | 19 | |
| 12 | 20 | /** |
| ... | ... | @@ -22,7 +30,7 @@ |
| 22 | 30 | public class SysUsersController extends BaseController { |
| 23 | 31 | |
| 24 | 32 | @Autowired |
| 25 | - private ISysUsersService userService; | |
| 33 | + private SysUsersService userService; | |
| 26 | 34 | |
| 27 | 35 | /** |
| 28 | 36 | * 创建用户 |
| ... | ... | @@ -36,6 +44,54 @@ |
| 36 | 44 | public String create(SysUsers user) { |
| 37 | 45 | boolean tag = userService.addUser(user); |
| 38 | 46 | return null; |
| 47 | + } | |
| 48 | + | |
| 49 | + /** | |
| 50 | + * 跳转到用户列表页面 | |
| 51 | + * | |
| 52 | + * @return | |
| 53 | + */ | |
| 54 | + @RequestMapping(value = "/toList", method = { RequestMethod.GET }) | |
| 55 | + public String toList() { | |
| 56 | + return "/user/user_list"; | |
| 57 | + } | |
| 58 | + | |
| 59 | + /** | |
| 60 | + * 用户列表 | |
| 61 | + * | |
| 62 | + * @param page | |
| 63 | + * @param model | |
| 64 | + * @return | |
| 65 | + */ | |
| 66 | + @RequestMapping(value = "/list", method = { RequestMethod.POST, RequestMethod.GET }) | |
| 67 | + @ResponseBody | |
| 68 | + public Map<String, Object> list(Model model) { | |
| 69 | + Page<SysUsers> page = getPage(); | |
| 70 | + page = userService.getUserByPage(page); | |
| 71 | + return toGridData(page); | |
| 72 | + } | |
| 73 | + | |
| 74 | + /** | |
| 75 | + * 跳转到编辑页面 | |
| 76 | + * | |
| 77 | + * @return | |
| 78 | + */ | |
| 79 | + @RequestMapping(value = { "/{id}/toEdit" }, method = RequestMethod.GET) | |
| 80 | + public String toEdit(@PathVariable String id, Model model) { | |
| 81 | + SysUsers user = userService.getUserById(id); | |
| 82 | + model.addAttribute("user", user); | |
| 83 | + return "/user/user_edit"; | |
| 84 | + } | |
| 85 | + | |
| 86 | + /** | |
| 87 | + * 修改信息 | |
| 88 | + */ | |
| 89 | + @RequestMapping(value = "/edit", method = { RequestMethod.POST }) | |
| 90 | + @ResponseBody | |
| 91 | + public AjaxResult update(SysUsers user, AjaxResult ajaxResult) { | |
| 92 | + boolean tag = userService.updateUser(user); | |
| 93 | + return handleAjaxResult(ajaxResult, tag, OperationName.UPDATE); | |
| 94 | + | |
| 39 | 95 | } |
| 40 | 96 | |
| 41 | 97 | } |
center.manager/src/main/java/com/lyms/cm/enums/RoleType.java
View file @
d065577
| 1 | +package com.lyms.cm.enums; | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * 角色类型 | |
| 5 | + * | |
| 6 | + * @author maliang | |
| 7 | + * | |
| 8 | + */ | |
| 9 | +public enum RoleType { | |
| 10 | + | |
| 11 | + SYSTEM(0), USER(1); | |
| 12 | + | |
| 13 | + private int code; | |
| 14 | + | |
| 15 | + private RoleType(int code) { | |
| 16 | + this.code = code; | |
| 17 | + } | |
| 18 | + | |
| 19 | + public int getCode() { | |
| 20 | + return code; | |
| 21 | + } | |
| 22 | +} |
center.manager/src/main/java/com/lyms/cm/service/sys/ISysRolesService.java
View file @
d065577
| 1 | -package com.lyms.cm.service.sys; | |
| 2 | - | |
| 3 | -import com.lyms.cm.entity.sys.SysRoles; | |
| 4 | -import com.lyms.web.service.BaseService; | |
| 5 | - | |
| 6 | -/** | |
| 7 | - * <p> | |
| 8 | - * 服务类 | |
| 9 | - * </p> | |
| 10 | - * | |
| 11 | - * @author maliang | |
| 12 | - * @since 2017-03-02 | |
| 13 | - */ | |
| 14 | -public interface ISysRolesService extends BaseService<SysRoles> { | |
| 15 | - | |
| 16 | -} |
center.manager/src/main/java/com/lyms/cm/service/sys/ISysUsersService.java
View file @
d065577
| 1 | -package com.lyms.cm.service.sys; | |
| 2 | - | |
| 3 | -import com.lyms.cm.entity.sys.SysUsers; | |
| 4 | -import com.lyms.exception.SystemException; | |
| 5 | -import com.lyms.web.service.BaseService; | |
| 6 | - | |
| 7 | -/** | |
| 8 | - * <p> | |
| 9 | - * 用户服务类 | |
| 10 | - * </p> | |
| 11 | - * | |
| 12 | - * @author maliang | |
| 13 | - * @since 2017-03-02 | |
| 14 | - */ | |
| 15 | -public interface ISysUsersService extends BaseService<SysUsers> { | |
| 16 | - | |
| 17 | - /** | |
| 18 | - * 添加用户 | |
| 19 | - * | |
| 20 | - * @param user | |
| 21 | - * @return | |
| 22 | - * @author maliang | |
| 23 | - */ | |
| 24 | - public boolean addUser(SysUsers user) throws SystemException; | |
| 25 | - | |
| 26 | - /** | |
| 27 | - * 修改用户信息 | |
| 28 | - * | |
| 29 | - * @param user | |
| 30 | - * @return | |
| 31 | - * @author maliang | |
| 32 | - */ | |
| 33 | - public boolean updateUser(SysUsers user) throws SystemException; | |
| 34 | - | |
| 35 | - /** | |
| 36 | - * 根据ID获取用户信息 | |
| 37 | - * | |
| 38 | - * @param userId | |
| 39 | - * @return | |
| 40 | - * @author maliang | |
| 41 | - */ | |
| 42 | - public SysUsers getUserById(String userId) throws SystemException; | |
| 43 | - | |
| 44 | - /** | |
| 45 | - * 启用/停用 | |
| 46 | - * <p> | |
| 47 | - * 根据用户ID操作 | |
| 48 | - * <p> | |
| 49 | - * | |
| 50 | - * @param userId | |
| 51 | - * @return | |
| 52 | - * @author maliang | |
| 53 | - */ | |
| 54 | - public boolean enabled(String userId) throws SystemException; | |
| 55 | - | |
| 56 | -} |
center.manager/src/main/java/com/lyms/cm/service/sys/SysRolesService.java
View file @
d065577
| 1 | +package com.lyms.cm.service.sys; | |
| 2 | + | |
| 3 | +import com.lyms.cm.entity.sys.SysRoles; | |
| 4 | +import com.lyms.exception.SystemException; | |
| 5 | +import com.lyms.web.service.BaseService; | |
| 6 | + | |
| 7 | +/** | |
| 8 | + * <p> | |
| 9 | + * 角色服务类 | |
| 10 | + * </p> | |
| 11 | + * | |
| 12 | + * @author maliang | |
| 13 | + * @since 2017-03-02 | |
| 14 | + */ | |
| 15 | +public interface SysRolesService extends BaseService<SysRoles> { | |
| 16 | + | |
| 17 | + /** | |
| 18 | + * 添加角色信息 | |
| 19 | + * | |
| 20 | + * @param role | |
| 21 | + * @return | |
| 22 | + * @throws SystemException | |
| 23 | + */ | |
| 24 | + public boolean addRole(SysRoles role) throws SystemException; | |
| 25 | + | |
| 26 | + /** | |
| 27 | + * 修改角色信息 | |
| 28 | + * | |
| 29 | + * @param role | |
| 30 | + * @return | |
| 31 | + * @throws SystemException | |
| 32 | + */ | |
| 33 | + public boolean updateRole(SysRoles role) throws SystemException; | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | +} |
center.manager/src/main/java/com/lyms/cm/service/sys/SysUsersService.java
View file @
d065577
| 1 | +package com.lyms.cm.service.sys; | |
| 2 | + | |
| 3 | +import com.baomidou.mybatisplus.plugins.Page; | |
| 4 | +import com.lyms.cm.entity.sys.SysUsers; | |
| 5 | +import com.lyms.exception.SystemException; | |
| 6 | +import com.lyms.web.service.BaseService; | |
| 7 | + | |
| 8 | +/** | |
| 9 | + * <p> | |
| 10 | + * 用户服务类 | |
| 11 | + * </p> | |
| 12 | + * | |
| 13 | + * @author maliang | |
| 14 | + * @since 2017-03-02 | |
| 15 | + */ | |
| 16 | +public interface SysUsersService extends BaseService<SysUsers> { | |
| 17 | + | |
| 18 | + /** | |
| 19 | + * 添加用户 | |
| 20 | + * | |
| 21 | + * @param user | |
| 22 | + * @return | |
| 23 | + * @author maliang | |
| 24 | + */ | |
| 25 | + public boolean addUser(SysUsers user) throws SystemException; | |
| 26 | + | |
| 27 | + /** | |
| 28 | + * 修改用户信息 | |
| 29 | + * | |
| 30 | + * @param user | |
| 31 | + * @return | |
| 32 | + * @author maliang | |
| 33 | + */ | |
| 34 | + public boolean updateUser(SysUsers user) throws SystemException; | |
| 35 | + | |
| 36 | + /** | |
| 37 | + * 根据ID获取用户信息 | |
| 38 | + * | |
| 39 | + * @param userId | |
| 40 | + * @return | |
| 41 | + * @author maliang | |
| 42 | + */ | |
| 43 | + public SysUsers getUserById(String userId) throws SystemException; | |
| 44 | + | |
| 45 | + /** | |
| 46 | + * 分页获取用户数据信息 | |
| 47 | + * <p> | |
| 48 | + * 该方法不携带任何过滤信息 | |
| 49 | + * | |
| 50 | + * @param page | |
| 51 | + * 分页对象 | |
| 52 | + * @return | |
| 53 | + * @throws SystemException | |
| 54 | + */ | |
| 55 | + public Page<SysUsers> getUserByPage(Page<SysUsers> page) throws SystemException; | |
| 56 | + | |
| 57 | + /** | |
| 58 | + * 启用/停用 | |
| 59 | + * <p> | |
| 60 | + * 根据用户ID操作 | |
| 61 | + * <p> | |
| 62 | + * | |
| 63 | + * @param userId | |
| 64 | + * @return | |
| 65 | + * @author maliang | |
| 66 | + */ | |
| 67 | + public boolean enabled(String userId) throws SystemException; | |
| 68 | + | |
| 69 | +} |
center.manager/src/main/java/com/lyms/cm/service/sys/impl/SysRolesServiceImpl.java
View file @
d065577
| ... | ... | @@ -5,7 +5,8 @@ |
| 5 | 5 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| 6 | 6 | import com.lyms.cm.dao.sys.SysRolesMapper; |
| 7 | 7 | import com.lyms.cm.entity.sys.SysRoles; |
| 8 | -import com.lyms.cm.service.sys.ISysRolesService; | |
| 8 | +import com.lyms.cm.service.sys.SysRolesService; | |
| 9 | +import com.lyms.exception.SystemException; | |
| 9 | 10 | |
| 10 | 11 | /** |
| 11 | 12 | * <p> |
| ... | ... | @@ -16,7 +17,17 @@ |
| 16 | 17 | * @since 2017-03-02 |
| 17 | 18 | */ |
| 18 | 19 | @Service |
| 19 | -public class SysRolesServiceImpl extends ServiceImpl<SysRolesMapper, SysRoles> implements ISysRolesService { | |
| 20 | +public class SysRolesServiceImpl extends ServiceImpl<SysRolesMapper, SysRoles> implements SysRolesService { | |
| 21 | + | |
| 22 | + @Override | |
| 23 | + public boolean addRole(SysRoles role) throws SystemException { | |
| 24 | + return false; | |
| 25 | + } | |
| 26 | + | |
| 27 | + @Override | |
| 28 | + public boolean updateRole(SysRoles role) throws SystemException { | |
| 29 | + return false; | |
| 30 | + } | |
| 20 | 31 | |
| 21 | 32 | } |
center.manager/src/main/java/com/lyms/cm/service/sys/impl/SysUsersServiceImpl.java
View file @
d065577
| 1 | 1 | package com.lyms.cm.service.sys.impl; |
| 2 | 2 | |
| 3 | +import java.util.List; | |
| 4 | + | |
| 3 | 5 | import org.apache.commons.lang3.StringUtils; |
| 4 | 6 | import org.springframework.beans.factory.annotation.Autowired; |
| 5 | 7 | import org.springframework.stereotype.Service; |
| 6 | 8 | import org.springframework.transaction.annotation.Transactional; |
| 7 | 9 | |
| 10 | +import com.baomidou.mybatisplus.plugins.Page; | |
| 8 | 11 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| 9 | 12 | import com.lyms.cm.dao.sys.SysUsersMapper; |
| 10 | 13 | import com.lyms.cm.entity.sys.SysUsers; |
| 11 | 14 | import com.lyms.cm.enums.UserStatusEnum; |
| 12 | -import com.lyms.cm.service.sys.ISysUsersService; | |
| 15 | +import com.lyms.cm.service.sys.SysUsersService; | |
| 13 | 16 | import com.lyms.exception.SystemException; |
| 14 | 17 | import com.lyms.util.MD5Utils; |
| 15 | 18 | import com.lyms.util.StrUtils; |
| ... | ... | @@ -23,7 +26,7 @@ |
| 23 | 26 | * @since 2017-03-02 |
| 24 | 27 | */ |
| 25 | 28 | @Service |
| 26 | -public class SysUsersServiceImpl extends ServiceImpl<SysUsersMapper, SysUsers> implements ISysUsersService { | |
| 29 | +public class SysUsersServiceImpl extends ServiceImpl<SysUsersMapper, SysUsers> implements SysUsersService { | |
| 27 | 30 | |
| 28 | 31 | @Autowired |
| 29 | 32 | private SysUsersMapper userMapper; |
| ... | ... | @@ -45,7 +48,9 @@ |
| 45 | 48 | if (empty(user)) |
| 46 | 49 | return; |
| 47 | 50 | String pwd = user.getPwd(); |
| 48 | - pwd = DEFAULT_PWD; | |
| 51 | + if (StringUtils.isBlank(pwd)) { | |
| 52 | + pwd = DEFAULT_PWD; | |
| 53 | + } | |
| 49 | 54 | String encode = MD5Utils.md5(pwd); |
| 50 | 55 | user.setPwd(encode); |
| 51 | 56 | } |
| ... | ... | @@ -69,6 +74,10 @@ |
| 69 | 74 | public boolean updateUser(SysUsers user) throws SystemException { |
| 70 | 75 | if (empty(user)) |
| 71 | 76 | return false; |
| 77 | + | |
| 78 | + // 初始密码 | |
| 79 | + this.initPwd(user); | |
| 80 | + | |
| 72 | 81 | Integer tag = userMapper.updateById(user); |
| 73 | 82 | return tag != null && tag >= 1; |
| 74 | 83 | } |
| ... | ... | @@ -95,6 +104,16 @@ |
| 95 | 104 | user.setEnable(UserStatusEnum.ENABLED.getStatus()); |
| 96 | 105 | } |
| 97 | 106 | return this.updateUser(user); |
| 107 | + } | |
| 108 | + | |
| 109 | + @Override | |
| 110 | + public Page<SysUsers> getUserByPage(Page<SysUsers> page) throws SystemException { | |
| 111 | + | |
| 112 | + if (page == null) | |
| 113 | + return null; | |
| 114 | + List<SysUsers> users = userMapper.selectPage(page, null); | |
| 115 | + page.setRecords(users); | |
| 116 | + return page; | |
| 98 | 117 | } |
| 99 | 118 | |
| 100 | 119 | } |
center.manager/src/main/resources/xml/app-shiro.xml
View file @
d065577
| ... | ... | @@ -31,7 +31,7 @@ |
| 31 | 31 | <bean id="securityManager" class="org.apache.shiro.web.mgt.DefaultWebSecurityManager"> |
| 32 | 32 | <property name="realm" ref="shiroRealm" /> |
| 33 | 33 | <property name="rememberMeManager" ref="rememberMeManager"/> |
| 34 | - </bean> | |
| 34 | + </bean> | |
| 35 | 35 | |
| 36 | 36 | <bean id="forceLogoutFilter" class="com.lyms.web.filter.ForceLogoutFilter"/> |
| 37 | 37 | <bean id="shiroFilter" class="org.apache.shiro.spring.web.ShiroFilterFactoryBean"> |
| 38 | 38 | |
| ... | ... | @@ -45,11 +45,12 @@ |
| 45 | 45 | </property> |
| 46 | 46 | <property name="filterChainDefinitions"> |
| 47 | 47 | <value> |
| 48 | - /login = anon | |
| 48 | + /login = anon | |
| 49 | + /sysUsers/** =anon | |
| 49 | 50 | /logout = logout |
| 50 | 51 | /static/** = anon |
| 51 | 52 | /authenticated = authc |
| 52 | - /** = user,forceLogout | |
| 53 | + /** = user,forceLogout | |
| 53 | 54 | </value> |
| 54 | 55 | </property> |
| 55 | 56 | </bean> |
center.manager/src/main/webapp/WEB-INF/views/user/user_edit.html
View file @
d065577
| ... | ... | @@ -6,13 +6,13 @@ |
| 6 | 6 | <div class="form-group"> |
| 7 | 7 | <label class="col-sm-3 control-label">用户名:</label> |
| 8 | 8 | <div class="col-sm-8"> |
| 9 | - <input type="text" placeholder="用户名" value="$!user.username" aria-required="true" required="true" class="form-control" minlength="2" name="username" id="username"> | |
| 9 | + <input type="text" placeholder="用户名" value="$!user.name" aria-required="true" required="true" class="form-control" minlength="2" name="name" id="name"> | |
| 10 | 10 | </div> |
| 11 | 11 | </div> |
| 12 | 12 | <div class="form-group"> |
| 13 | 13 | <label class="col-sm-3 control-label">密码:</label> |
| 14 | 14 | <div class="col-sm-8"> |
| 15 | - <input type="password" placeholder="密码" aria-required="true" required="true" minlength="3" name="password" class="form-control" id="password"> | |
| 15 | + <input type="password" placeholder="密码" aria-required="true" required="true" minlength="3" name="pwd" class="form-control" id="pwd"> | |
| 16 | 16 | </div> |
| 17 | 17 | </div> |
| 18 | 18 | <div class="hr-line-dashed"></div> |
| 19 | 19 | |
| ... | ... | @@ -31,9 +31,9 @@ |
| 31 | 31 | var data = $('#validForm').serialize(); |
| 32 | 32 | data = data + "&" + $('#roleForm').serialize(); |
| 33 | 33 | if("$!user.id" == ""){ |
| 34 | - ajaxPost(APP.PATH + "/user/create",data); | |
| 34 | + ajaxPost(APP.PATH + "/sysUsers/create",data); | |
| 35 | 35 | }else{ |
| 36 | - ajaxPost(APP.PATH + "/user/update",data); | |
| 36 | + ajaxPost(APP.PATH + "/sysUsers/update",data); | |
| 37 | 37 | } |
| 38 | 38 | parent.reloadGrid('datagrid'); |
| 39 | 39 | } |
center.manager/src/main/webapp/WEB-INF/views/user/user_list.html
View file @
d065577
| ... | ... | @@ -40,7 +40,7 @@ |
| 40 | 40 | function edit(){ |
| 41 | 41 | var id = getSingleSelectedValue("dataTable","id"); |
| 42 | 42 | if(id){ |
| 43 | - popWindow("修改用户", APP.PATH+"/user/" + id + "/toEdit",700,400); | |
| 43 | + popWindow("修改用户", APP.PATH+"/sysUsers/" + id + "/toEdit",700,400); | |
| 44 | 44 | } |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | |
| 48 | 48 | |
| 49 | 49 | |
| ... | ... | @@ -49,23 +49,41 @@ |
| 49 | 49 | } |
| 50 | 50 | ## 参考 base_table_init.js 或者根据empty_bootstrap_table_init.js 来自己创建特殊的table |
| 51 | 51 | ## 注意:自己创建的特殊的table不能extends base_list.html |
| 52 | -var default_dataUrl = APP.PATH + "/user/getUserList"; | |
| 52 | +var default_dataUrl = APP.PATH + "/sysUsers/list"; | |
| 53 | 53 | var default_dataColumns = [{ |
| 54 | 54 | field: 'check_state', |
| 55 | 55 | title: '', |
| 56 | 56 | checkbox: true |
| 57 | 57 | },{ |
| 58 | 58 | field: 'id', |
| 59 | - title: '序号' | |
| 59 | + title: '编号' | |
| 60 | + },{ | |
| 61 | + field: 'type', | |
| 62 | + title: '类型' | |
| 60 | 63 | }, { |
| 61 | - field: 'username', | |
| 62 | - title: '登录名' | |
| 63 | - }, { | |
| 64 | - field: 'password', | |
| 65 | - title: '密码' | |
| 64 | + field: 'account', | |
| 65 | + title: '帐号' | |
| 66 | 66 | },{ |
| 67 | - field: 'roles', | |
| 68 | - title: '角色' | |
| 67 | + field: 'orgId', | |
| 68 | + title: '机构' | |
| 69 | + },{ | |
| 70 | + field: 'deptId', | |
| 71 | + title: '部门' | |
| 72 | + },{ | |
| 73 | + field: 'name', | |
| 74 | + title: '名称' | |
| 75 | + },{ | |
| 76 | + field: 'phone', | |
| 77 | + title: '手机号' | |
| 78 | + },{ | |
| 79 | + field: 'publishId', | |
| 80 | + title: '发布者' | |
| 81 | + },{ | |
| 82 | + field: 'yn', | |
| 83 | + title: '状态' | |
| 84 | + },{ | |
| 85 | + field: 'enable', | |
| 86 | + title: '启/停用' | |
| 69 | 87 | }]; |
| 70 | 88 | </script> |
| 71 | 89 | #end |
center.manager/src/test/java/center/manager/test/user/UserTest.java
View file @
d065577
| ... | ... | @@ -2,18 +2,20 @@ |
| 2 | 2 | |
| 3 | 3 | import java.util.Date; |
| 4 | 4 | |
| 5 | +import org.apache.commons.lang3.builder.ToStringBuilder; | |
| 5 | 6 | import org.junit.Assert; |
| 6 | 7 | import org.junit.Before; |
| 7 | 8 | import org.junit.Test; |
| 8 | 9 | import org.springframework.beans.factory.annotation.Autowired; |
| 9 | 10 | |
| 11 | +import com.baomidou.mybatisplus.plugins.Page; | |
| 10 | 12 | import com.lyms.cm.entity.sys.SysUsers; |
| 11 | -import com.lyms.cm.service.sys.ISysUsersService; | |
| 13 | +import com.lyms.cm.service.sys.SysUsersService; | |
| 12 | 14 | |
| 13 | 15 | public class UserTest extends BaseTest { |
| 14 | 16 | |
| 15 | 17 | @Autowired |
| 16 | - private ISysUsersService userService; | |
| 18 | + private SysUsersService userService; | |
| 17 | 19 | |
| 18 | 20 | SysUsers user = null; |
| 19 | 21 | |
| ... | ... | @@ -46,6 +48,14 @@ |
| 46 | 48 | public void enableUserTest() { |
| 47 | 49 | boolean tag = userService.enabled("6204903E7E1741688350349EF920ED88"); |
| 48 | 50 | System.out.println(tag); |
| 51 | + } | |
| 52 | + | |
| 53 | + @Test | |
| 54 | + public void selectUserByPage() { | |
| 55 | + Page<SysUsers> page = new Page<>(1, 1); | |
| 56 | + Page<SysUsers> result = userService.getUserByPage(page); | |
| 57 | + System.out.println(result.getRecords().size()); | |
| 58 | + System.out.println(ToStringBuilder.reflectionToString(result)); | |
| 49 | 59 | } |
| 50 | 60 | |
| 51 | 61 | } |