Commit e0ba7aa69895de0acf241490502a9f04f79ecafe
1 parent
aa054ab806
Exists in
master
用户管理
Showing 8 changed files with 349 additions and 232 deletions
- center.manager/src/main/java/com/lyms/cm/controller/sys/SysUsersController.java
- center.manager/src/main/java/com/lyms/cm/entity/sys/SysUsers.java
- center.manager/src/main/java/com/lyms/cm/service/sys/SysUsersService.java
- center.manager/src/main/java/com/lyms/cm/service/sys/impl/SysUsersServiceImpl.java
- center.manager/src/main/webapp/WEB-INF/views/role/role_list.html
- center.manager/src/main/webapp/WEB-INF/views/user/user_edit.html
- center.manager/src/main/webapp/WEB-INF/views/user/user_list.html
- mybatis-plus/src/test/java/com/baomidou/mybatisplus/test/generator/MysqlGenerator.java
center.manager/src/main/java/com/lyms/cm/controller/sys/SysUsersController.java
View file @
e0ba7aa
| ... | ... | @@ -45,8 +45,13 @@ |
| 45 | 45 | @RequestMapping(value = "/create", method = RequestMethod.POST) |
| 46 | 46 | @ResponseBody |
| 47 | 47 | public AjaxResult create(SysUsers user, AjaxResult ajaxResult) { |
| 48 | + if(userService.isExistAccount(user.getAccount())){ | |
| 49 | + ajaxResult.setSuccess(true); | |
| 50 | + ajaxResult.setMessage("新增失败!" + user.getAccount() + " 已经存在,请修改登录账号!"); | |
| 51 | + return ajaxResult; | |
| 52 | + } | |
| 48 | 53 | boolean tag = userService.addUser(user); |
| 49 | - return handleAjaxResult(ajaxResult, tag, OperationName.UPDATE); | |
| 54 | + return handleAjaxResult(ajaxResult, tag, OperationName.CREATE); | |
| 50 | 55 | } |
| 51 | 56 | |
| 52 | 57 | /** |
| ... | ... | @@ -96,6 +101,11 @@ |
| 96 | 101 | @RequestMapping(value = "/update", method = { RequestMethod.POST }) |
| 97 | 102 | @ResponseBody |
| 98 | 103 | public AjaxResult update(SysUsers user, AjaxResult ajaxResult) { |
| 104 | + if(userService.isExistAccount(user.getAccount())){ | |
| 105 | + ajaxResult.setSuccess(true); | |
| 106 | + ajaxResult.setMessage("修改失败! " + user.getAccount()+" 已经存在,请修改登录账号!"); | |
| 107 | + return ajaxResult; | |
| 108 | + } | |
| 99 | 109 | boolean tag = userService.updateUser(user); |
| 100 | 110 | return handleAjaxResult(ajaxResult, tag, OperationName.UPDATE); |
| 101 | 111 |
center.manager/src/main/java/com/lyms/cm/entity/sys/SysUsers.java
View file @
e0ba7aa
| 1 | 1 | package com.lyms.cm.entity.sys; |
| 2 | 2 | |
| 3 | +import com.baomidou.mybatisplus.annotations.TableId; | |
| 4 | +import com.baomidou.mybatisplus.annotations.TableField; | |
| 5 | +import com.baomidou.mybatisplus.annotations.TableName; | |
| 3 | 6 | import java.io.Serializable; |
| 4 | 7 | import java.util.Date; |
| 5 | 8 | |
| 6 | -import com.baomidou.mybatisplus.annotations.TableField; | |
| 7 | -import com.baomidou.mybatisplus.annotations.TableName; | |
| 8 | - | |
| 9 | 9 | /** |
| 10 | 10 | * <p> |
| 11 | 11 | * 用户表 |
| 12 | 12 | * </p> |
| 13 | 13 | * |
| 14 | 14 | * @author fangcheng |
| 15 | - * @since 2017-03-07 | |
| 15 | + * @since 2017-03-08 | |
| 16 | 16 | */ |
| 17 | 17 | @TableName("SYS_USERS") |
| 18 | 18 | public class SysUsers implements Serializable { |
| ... | ... | @@ -22,7 +22,7 @@ |
| 22 | 22 | /** |
| 23 | 23 | * |
| 24 | 24 | */ |
| 25 | - @TableField(value="ID") | |
| 25 | + @TableId(value="ID") | |
| 26 | 26 | private String id; |
| 27 | 27 | /** |
| 28 | 28 | * 0:管理员,1:用户 |
| ... | ... | @@ -30,16 +30,6 @@ |
| 30 | 30 | @TableField(value="TYPE") |
| 31 | 31 | private Integer type; |
| 32 | 32 | /** |
| 33 | - * 机构id | |
| 34 | - */ | |
| 35 | - @TableField(value="ORG_ID") | |
| 36 | - private String orgId; | |
| 37 | - /** | |
| 38 | - * 部门id | |
| 39 | - */ | |
| 40 | - @TableField(value="DEPT_ID") | |
| 41 | - private String deptId; | |
| 42 | - /** | |
| 43 | 33 | * 名称 |
| 44 | 34 | */ |
| 45 | 35 | @TableField(value="NAME") |
| ... | ... | @@ -50,6 +40,16 @@ |
| 50 | 40 | @TableField(value="ACCOUNT") |
| 51 | 41 | private String account; |
| 52 | 42 | /** |
| 43 | + * 机构id | |
| 44 | + */ | |
| 45 | + @TableField(value="ORG_ID") | |
| 46 | + private String orgId; | |
| 47 | + /** | |
| 48 | + * 部门id | |
| 49 | + */ | |
| 50 | + @TableField(value="DEPT_ID") | |
| 51 | + private String deptId; | |
| 52 | + /** | |
| 53 | 53 | * 名字 |
| 54 | 54 | */ |
| 55 | 55 | @TableField(value="PWD") |
| ... | ... | @@ -60,31 +60,6 @@ |
| 60 | 60 | @TableField(value="PHONE") |
| 61 | 61 | private String phone; |
| 62 | 62 | /** |
| 63 | - * 发布者id | |
| 64 | - */ | |
| 65 | - @TableField(value="PUBLISH_ID") | |
| 66 | - private Integer publishId; | |
| 67 | - /** | |
| 68 | - * 1:有效,2:无效 | |
| 69 | - */ | |
| 70 | - @TableField(value="IFDEL") | |
| 71 | - private Integer ifdel; | |
| 72 | - /** | |
| 73 | - * 1:启用,2:停用 | |
| 74 | - */ | |
| 75 | - @TableField(value="ENABLE") | |
| 76 | - private Integer enable; | |
| 77 | - /** | |
| 78 | - * 最后修改时间 | |
| 79 | - */ | |
| 80 | - @TableField(value="MODIFIED") | |
| 81 | - private Date modified; | |
| 82 | - /** | |
| 83 | - * 创建时间 | |
| 84 | - */ | |
| 85 | - @TableField(value="CREATED") | |
| 86 | - private Date created; | |
| 87 | - /** | |
| 88 | 63 | * 备注 |
| 89 | 64 | */ |
| 90 | 65 | @TableField(value="REMARKS") |
| ... | ... | @@ -134,6 +109,36 @@ |
| 134 | 109 | */ |
| 135 | 110 | @TableField(value="GOOD_AT") |
| 136 | 111 | private String goodAt; |
| 112 | + /** | |
| 113 | + * | |
| 114 | + */ | |
| 115 | + @TableField(value="CREATE_ID") | |
| 116 | + private String createId; | |
| 117 | + /** | |
| 118 | + * | |
| 119 | + */ | |
| 120 | + @TableField(value="CREATE_TIME") | |
| 121 | + private Date createTime; | |
| 122 | + /** | |
| 123 | + * | |
| 124 | + */ | |
| 125 | + @TableField(value="MODIFY_ID") | |
| 126 | + private String modifyId; | |
| 127 | + /** | |
| 128 | + * | |
| 129 | + */ | |
| 130 | + @TableField(value="MODIFY_TIME") | |
| 131 | + private Date modifyTime; | |
| 132 | + /** | |
| 133 | + * | |
| 134 | + */ | |
| 135 | + @TableField(value="IFDEL") | |
| 136 | + private Integer ifdel; | |
| 137 | + /** | |
| 138 | + * | |
| 139 | + */ | |
| 140 | + @TableField(value="ENABLE") | |
| 141 | + private Integer enable; | |
| 137 | 142 | |
| 138 | 143 | |
| 139 | 144 | public String getId() { |
| ... | ... | @@ -152,22 +157,6 @@ |
| 152 | 157 | this.type = type; |
| 153 | 158 | } |
| 154 | 159 | |
| 155 | - public String getOrgId() { | |
| 156 | - return orgId; | |
| 157 | - } | |
| 158 | - | |
| 159 | - public void setOrgId(String orgId) { | |
| 160 | - this.orgId = orgId; | |
| 161 | - } | |
| 162 | - | |
| 163 | - public String getDeptId() { | |
| 164 | - return deptId; | |
| 165 | - } | |
| 166 | - | |
| 167 | - public void setDeptId(String deptId) { | |
| 168 | - this.deptId = deptId; | |
| 169 | - } | |
| 170 | - | |
| 171 | 160 | public String getName() { |
| 172 | 161 | return name; |
| 173 | 162 | } |
| ... | ... | @@ -184,6 +173,22 @@ |
| 184 | 173 | this.account = account; |
| 185 | 174 | } |
| 186 | 175 | |
| 176 | + public String getOrgId() { | |
| 177 | + return orgId; | |
| 178 | + } | |
| 179 | + | |
| 180 | + public void setOrgId(String orgId) { | |
| 181 | + this.orgId = orgId; | |
| 182 | + } | |
| 183 | + | |
| 184 | + public String getDeptId() { | |
| 185 | + return deptId; | |
| 186 | + } | |
| 187 | + | |
| 188 | + public void setDeptId(String deptId) { | |
| 189 | + this.deptId = deptId; | |
| 190 | + } | |
| 191 | + | |
| 187 | 192 | public String getPwd() { |
| 188 | 193 | return pwd; |
| 189 | 194 | } |
| ... | ... | @@ -200,46 +205,6 @@ |
| 200 | 205 | this.phone = phone; |
| 201 | 206 | } |
| 202 | 207 | |
| 203 | - public Integer getPublishId() { | |
| 204 | - return publishId; | |
| 205 | - } | |
| 206 | - | |
| 207 | - public void setPublishId(Integer publishId) { | |
| 208 | - this.publishId = publishId; | |
| 209 | - } | |
| 210 | - | |
| 211 | - public Integer getIfdel() { | |
| 212 | - return ifdel; | |
| 213 | - } | |
| 214 | - | |
| 215 | - public void setIfdel(Integer ifdel) { | |
| 216 | - this.ifdel = ifdel; | |
| 217 | - } | |
| 218 | - | |
| 219 | - public Integer getEnable() { | |
| 220 | - return enable; | |
| 221 | - } | |
| 222 | - | |
| 223 | - public void setEnable(Integer enable) { | |
| 224 | - this.enable = enable; | |
| 225 | - } | |
| 226 | - | |
| 227 | - public Date getModified() { | |
| 228 | - return modified; | |
| 229 | - } | |
| 230 | - | |
| 231 | - public void setModified(Date modified) { | |
| 232 | - this.modified = modified; | |
| 233 | - } | |
| 234 | - | |
| 235 | - public Date getCreated() { | |
| 236 | - return created; | |
| 237 | - } | |
| 238 | - | |
| 239 | - public void setCreated(Date created) { | |
| 240 | - this.created = created; | |
| 241 | - } | |
| 242 | - | |
| 243 | 208 | public String getRemarks() { |
| 244 | 209 | return remarks; |
| 245 | 210 | } |
| ... | ... | @@ -318,6 +283,54 @@ |
| 318 | 283 | |
| 319 | 284 | public void setGoodAt(String goodAt) { |
| 320 | 285 | this.goodAt = goodAt; |
| 286 | + } | |
| 287 | + | |
| 288 | + public String getCreateId() { | |
| 289 | + return createId; | |
| 290 | + } | |
| 291 | + | |
| 292 | + public void setCreateId(String createId) { | |
| 293 | + this.createId = createId; | |
| 294 | + } | |
| 295 | + | |
| 296 | + public Date getCreateTime() { | |
| 297 | + return createTime; | |
| 298 | + } | |
| 299 | + | |
| 300 | + public void setCreateTime(Date createTime) { | |
| 301 | + this.createTime = createTime; | |
| 302 | + } | |
| 303 | + | |
| 304 | + public String getModifyId() { | |
| 305 | + return modifyId; | |
| 306 | + } | |
| 307 | + | |
| 308 | + public void setModifyId(String modifyId) { | |
| 309 | + this.modifyId = modifyId; | |
| 310 | + } | |
| 311 | + | |
| 312 | + public Date getModifyTime() { | |
| 313 | + return modifyTime; | |
| 314 | + } | |
| 315 | + | |
| 316 | + public void setModifyTime(Date modifyTime) { | |
| 317 | + this.modifyTime = modifyTime; | |
| 318 | + } | |
| 319 | + | |
| 320 | + public Integer getIfdel() { | |
| 321 | + return ifdel; | |
| 322 | + } | |
| 323 | + | |
| 324 | + public void setIfdel(Integer ifdel) { | |
| 325 | + this.ifdel = ifdel; | |
| 326 | + } | |
| 327 | + | |
| 328 | + public Integer getEnable() { | |
| 329 | + return enable; | |
| 330 | + } | |
| 331 | + | |
| 332 | + public void setEnable(Integer enable) { | |
| 333 | + this.enable = enable; | |
| 321 | 334 | } |
| 322 | 335 | |
| 323 | 336 | } |
center.manager/src/main/java/com/lyms/cm/service/sys/SysUsersService.java
View file @
e0ba7aa
| ... | ... | @@ -70,6 +70,18 @@ |
| 70 | 70 | * <li>@return 大于0修改成功,否则为失败 |
| 71 | 71 | */ |
| 72 | 72 | public Integer deleteLogicById(Serializable id); |
| 73 | + | |
| 74 | + | |
| 75 | + /** | |
| 76 | + * <li>@Description:是否存在登录号 | |
| 77 | + * <li>@param username | |
| 78 | + * <li>@return | |
| 79 | + * <li>创建人:方承 | |
| 80 | + * <li>创建时间:2017年3月8日 | |
| 81 | + * <li>修改人: | |
| 82 | + * <li>修改时间: | |
| 83 | + */ | |
| 84 | + public boolean isExistAccount(String username); | |
| 73 | 85 | |
| 74 | 86 | } |
center.manager/src/main/java/com/lyms/cm/service/sys/impl/SysUsersServiceImpl.java
View file @
e0ba7aa
| ... | ... | @@ -7,6 +7,7 @@ |
| 7 | 7 | import org.springframework.stereotype.Service; |
| 8 | 8 | import org.springframework.transaction.annotation.Transactional; |
| 9 | 9 | |
| 10 | +import com.baomidou.mybatisplus.mapper.EntityWrapper; | |
| 10 | 11 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| 11 | 12 | import com.lyms.cm.dao.sys.SysUsersMapper; |
| 12 | 13 | import com.lyms.cm.entity.sys.SysUsers; |
| 13 | 14 | |
| 14 | 15 | |
| 15 | 16 | |
| 16 | 17 | |
| 17 | 18 | |
| 18 | 19 | |
| 19 | 20 | |
| 20 | 21 | |
| 21 | 22 | |
| 22 | 23 | |
| 23 | 24 | |
| 24 | 25 | |
| 25 | 26 | |
| 26 | 27 | |
| ... | ... | @@ -28,109 +29,131 @@ |
| 28 | 29 | @Service |
| 29 | 30 | public class SysUsersServiceImpl extends ServiceImpl<SysUsersMapper, SysUsers> implements SysUsersService { |
| 30 | 31 | |
| 31 | - @Autowired | |
| 32 | - private SysUsersMapper userMapper; | |
| 32 | + @Autowired | |
| 33 | + private SysUsersMapper userMapper; | |
| 33 | 34 | |
| 34 | - /** | |
| 35 | - * 系统默认密码 | |
| 36 | - */ | |
| 37 | - private static final String DEFAULT_PWD = "123456"; | |
| 35 | + /** | |
| 36 | + * 系统默认密码 | |
| 37 | + */ | |
| 38 | + private static final String DEFAULT_PWD = "123456"; | |
| 38 | 39 | |
| 39 | - // 模块基础操作信息 | |
| 40 | - private boolean empty(SysUsers user) { | |
| 41 | - return user == null; | |
| 42 | - } | |
| 40 | + // 模块基础操作信息 | |
| 41 | + private boolean empty(SysUsers user) { | |
| 42 | + return user == null; | |
| 43 | + } | |
| 43 | 44 | |
| 44 | - /** | |
| 45 | - * 初始密码设置 | |
| 46 | - */ | |
| 47 | - private void initPwd(SysUsers user) { | |
| 48 | - if (empty(user)) | |
| 49 | - return; | |
| 50 | - String pwd = user.getPwd(); | |
| 51 | - if (StringUtils.isBlank(pwd)) { | |
| 52 | - pwd = DEFAULT_PWD; | |
| 53 | - } | |
| 54 | - String encode = MD5Utils.md5(pwd); | |
| 55 | - user.setPwd(encode); | |
| 56 | - } | |
| 45 | + /** | |
| 46 | + * 初始密码设置 | |
| 47 | + */ | |
| 48 | + private void initPwd(SysUsers user) { | |
| 49 | + if (empty(user)) | |
| 50 | + return; | |
| 51 | + String pwd = user.getPwd(); | |
| 52 | + if (StringUtils.isBlank(pwd)) { | |
| 53 | + pwd = DEFAULT_PWD; | |
| 54 | + } | |
| 55 | + String encode = MD5Utils.md5(pwd); | |
| 56 | + user.setPwd(encode); | |
| 57 | + } | |
| 57 | 58 | |
| 58 | - @Override | |
| 59 | - @Transactional | |
| 60 | - public boolean addUser(SysUsers user) throws SystemException { | |
| 61 | - if (empty(user)) | |
| 62 | - return false; | |
| 63 | - // 设置user ID | |
| 64 | - user.setId(StrUtils.uuid()); | |
| 65 | - user.setIfdel(0); | |
| 66 | - // 设置用户密码 | |
| 67 | - this.initPwd(user); | |
| 59 | + @Override | |
| 60 | + @Transactional | |
| 61 | + public boolean addUser(SysUsers user) throws SystemException { | |
| 62 | + if (empty(user)) | |
| 63 | + return false; | |
| 64 | + // 设置user ID | |
| 65 | + user.setId(StrUtils.uuid()); | |
| 66 | + user.setIfdel(0); | |
| 67 | + if (null == user.getType()) {//没有勾选管理,就是用户 | |
| 68 | + user.setType(1); | |
| 69 | + } | |
| 70 | + if (null == user.getEnable()) { | |
| 71 | + user.setEnable(1); | |
| 72 | + } | |
| 73 | + // 设置用户密码 | |
| 74 | + this.initPwd(user); | |
| 68 | 75 | |
| 69 | - Integer tag = userMapper.insert(user); | |
| 70 | - return tag != null && tag >= 1; | |
| 71 | - } | |
| 76 | + Integer tag = userMapper.insert(user); | |
| 77 | + return tag != null && tag >= 1; | |
| 78 | + } | |
| 72 | 79 | |
| 73 | - @Override | |
| 74 | - @Transactional | |
| 75 | - public boolean updateUser(SysUsers user) throws SystemException { | |
| 76 | - if (empty(user)) | |
| 77 | - return false; | |
| 80 | + @Override | |
| 81 | + @Transactional | |
| 82 | + public boolean updateUser(SysUsers user) throws SystemException { | |
| 83 | + if (empty(user)) | |
| 84 | + return false; | |
| 85 | + if (null == user.getType()) {//没有勾选管理,就是用户 | |
| 86 | + user.setType(1); | |
| 87 | + } | |
| 88 | + if (null == user.getEnable()) { | |
| 89 | + user.setEnable(1); | |
| 90 | + } | |
| 91 | + if (StrUtils.isNotEmpty(user.getPwd())) { | |
| 92 | + // 初始密码 | |
| 93 | + this.initPwd(user); | |
| 94 | + } | |
| 78 | 95 | |
| 79 | - // 初始密码 | |
| 80 | - this.initPwd(user); | |
| 96 | + Integer tag = userMapper.updateById(user); | |
| 97 | + return tag != null && tag >= 1; | |
| 98 | + } | |
| 81 | 99 | |
| 82 | - Integer tag = userMapper.updateById(user); | |
| 83 | - return tag != null && tag >= 1; | |
| 84 | - } | |
| 100 | + /* | |
| 101 | + * @Override public SysUsers getUserById(String userId) throws | |
| 102 | + * SystemException { if (StringUtils.isBlank(userId)) return null; return | |
| 103 | + * userMapper.selectById(userId); } | |
| 104 | + */ | |
| 85 | 105 | |
| 86 | - /* | |
| 87 | - * @Override public SysUsers getUserById(String userId) throws | |
| 88 | - * SystemException { if (StringUtils.isBlank(userId)) return null; return | |
| 89 | - * userMapper.selectById(userId); } | |
| 90 | - */ | |
| 106 | + @Override | |
| 107 | + @Transactional | |
| 108 | + public boolean enabled(String userId) throws SystemException { | |
| 109 | + // TODO 编写SQL 修改 | |
| 110 | + SysUsers user = this.selectById(userId); | |
| 111 | + if (empty(user)) | |
| 112 | + return false; | |
| 91 | 113 | |
| 92 | - @Override | |
| 93 | - @Transactional | |
| 94 | - public boolean enabled(String userId) throws SystemException { | |
| 95 | - // TODO 编写SQL 修改 | |
| 96 | - SysUsers user = this.selectById(userId); | |
| 97 | - if (empty(user)) | |
| 98 | - return false; | |
| 114 | + // 判断当前用户的启用,禁用情况 | |
| 115 | + if (StatusEnum.isEnabled(user.getEnable())) { | |
| 116 | + user.setEnable(StatusEnum.DISENABLED.getStatus()); | |
| 117 | + } else { | |
| 118 | + user.setEnable(StatusEnum.ENABLED.getStatus()); | |
| 119 | + } | |
| 120 | + return this.updateUser(user); | |
| 121 | + } | |
| 99 | 122 | |
| 100 | - // 判断当前用户的启用,禁用情况 | |
| 101 | - if (StatusEnum.isEnabled(user.getEnable())) { | |
| 102 | - user.setEnable(StatusEnum.DISENABLED.getStatus()); | |
| 103 | - } else { | |
| 104 | - user.setEnable(StatusEnum.ENABLED.getStatus()); | |
| 105 | - } | |
| 106 | - return this.updateUser(user); | |
| 107 | - } | |
| 123 | + @Override | |
| 124 | + @Transactional | |
| 125 | + public boolean delete(String userId) throws SystemException { | |
| 108 | 126 | |
| 109 | - @Override | |
| 110 | - @Transactional | |
| 111 | - public boolean delete(String userId) throws SystemException { | |
| 127 | + if (StringUtils.isBlank(userId)) | |
| 128 | + return false; | |
| 129 | + // TODO 通过sql 修改 | |
| 130 | + SysUsers user = userMapper.selectById(userId); | |
| 131 | + if (user != null) { | |
| 132 | + Integer ifDel = user.getIfdel(); | |
| 133 | + if (ifDel == null || ifDel == ValidityEnum.VALIDITY.getValidity()) { | |
| 134 | + ifDel = ValidityEnum.UNVALIDITY.getValidity(); | |
| 135 | + } else { | |
| 136 | + ifDel = ValidityEnum.VALIDITY.getValidity(); | |
| 137 | + } | |
| 138 | + user.setIfdel(ifDel); | |
| 139 | + Integer tag = userMapper.updateById(user); | |
| 140 | + return tag != null && tag >= 1; | |
| 141 | + } | |
| 142 | + return false; | |
| 143 | + } | |
| 112 | 144 | |
| 113 | - if (StringUtils.isBlank(userId)) | |
| 114 | - return false; | |
| 115 | - // TODO 通过sql 修改 | |
| 116 | - SysUsers user = userMapper.selectById(userId); | |
| 117 | - if (user != null) { | |
| 118 | - Integer ifDel = user.getIfdel() ; | |
| 119 | - if (ifDel == null || ifDel == ValidityEnum.VALIDITY.getValidity()) { | |
| 120 | - ifDel = ValidityEnum.UNVALIDITY.getValidity(); | |
| 121 | - } else { | |
| 122 | - ifDel = ValidityEnum.VALIDITY.getValidity(); | |
| 123 | - } | |
| 124 | - user.setIfdel(ifDel); | |
| 125 | - Integer tag = userMapper.updateById(user); | |
| 126 | - return tag != null && tag >= 1; | |
| 127 | - } | |
| 128 | - return false; | |
| 129 | - } | |
| 130 | - | |
| 131 | 145 | @Override |
| 132 | 146 | public Integer deleteLogicById(Serializable id) { |
| 133 | 147 | return baseMapper.deleteLogicById(id); |
| 148 | + } | |
| 149 | + | |
| 150 | + @Override | |
| 151 | + public boolean isExistAccount(String username) { | |
| 152 | + SysUsers entity = selectOne(new EntityWrapper<SysUsers>().where("account={0}", "'" + username + "'")); | |
| 153 | + if (null == entity) { | |
| 154 | + return false; | |
| 155 | + } | |
| 156 | + return true; | |
| 134 | 157 | } |
| 135 | 158 | |
| 136 | 159 | } |
center.manager/src/main/webapp/WEB-INF/views/role/role_list.html
View file @
e0ba7aa
center.manager/src/main/webapp/WEB-INF/views/user/user_edit.html
View file @
e0ba7aa
| ... | ... | @@ -2,27 +2,84 @@ |
| 2 | 2 | <div class="ibox float-e-margins"> |
| 3 | 3 | <div class="ibox-content"> |
| 4 | 4 | <form id="validForm" class="form-horizontal m-t" novalidate="novalidate"> |
| 5 | - <input type="hidden" id="user.id" name="id" value="$!user.id"/> | |
| 6 | - <div class="form-group"> | |
| 7 | - <label class="col-sm-3 control-label">用户名:</label> | |
| 8 | - <div class="col-sm-8"> | |
| 9 | - <input type="text" placeholder="用户名" value="$!user.name" aria-required="true" required="true" class="form-control" minlength="2" name="name" id="name"> | |
| 10 | - </div> | |
| 11 | - </div> | |
| 12 | - <div class="form-group"> | |
| 13 | - <label class="col-sm-3 control-label">密码:</label> | |
| 14 | - <div class="col-sm-8"> | |
| 15 | - <input type="password" placeholder="密码" aria-required="true" required="true" minlength="3" name="pwd" class="form-control" id="pwd"> | |
| 16 | - </div> | |
| 17 | - </div> | |
| 18 | - <div class="hr-line-dashed"></div> | |
| 19 | - <div class="form-group"> | |
| 20 | - <div class="col-sm-4 col-sm-offset-3 pull-right"> | |
| 21 | - <button type="button" class="btn btn-primary" onclick="save();"><i class="fa fa-check"></i> 提交</button> | |
| 22 | - <button type="button" class="btn btn-white" onclick="parent.closeAll();"><i class="fa fa-close"></i> 取消</button> | |
| 23 | - </div> | |
| 24 | - </div> | |
| 25 | - </form> | |
| 5 | + <input id="resource" name="resource" type="hidden" value="$!rolePermissions"/> | |
| 6 | + <input type="hidden" id="role.id" name="id" value="$!role.id"/> | |
| 7 | + <div class="form-group"> | |
| 8 | + <label class="col-sm-3 control-label">账号:</label> | |
| 9 | + <div class="col-sm-8"> | |
| 10 | + <input type="text" placeholder="登录账号" value="$!user.account" aria-required="true" required="true" class="form-control" minlength="2" name="account" id="account"> | |
| 11 | + </div> | |
| 12 | + </div> | |
| 13 | + <div class="form-group"> | |
| 14 | + <label class="col-sm-3 control-label">用户姓名:</label> | |
| 15 | + <div class="col-sm-8"> | |
| 16 | + <input type="text" placeholder="用户姓名" value="$!user.name" aria-required="true" required="true" class="form-control" minlength="2" name="name" id="name"> | |
| 17 | + </div> | |
| 18 | + </div> | |
| 19 | + <div class="form-group"> | |
| 20 | + <label class="col-sm-3 control-label">密码:</label> | |
| 21 | + <div class="col-sm-8"> | |
| 22 | + <input type="text" placeholder="登录密码" value="" #if("$!user.id" == "") aria-required="true" required="true" minlength="2" #end class="form-control" name="pwd" id="pwd"> | |
| 23 | + </div> | |
| 24 | + </div> | |
| 25 | + <div class="form-group"> | |
| 26 | + <label class="col-sm-3 control-label">手机号:</label> | |
| 27 | + <div class="col-sm-8"> | |
| 28 | + <input type="text" placeholder="手机号" value="$!user.phone" aria-required="true" required="true" class="form-control" minlength="2" name="phone" id="phone"> | |
| 29 | + </div> | |
| 30 | + </div> | |
| 31 | + <div class="form-group"> | |
| 32 | + <label class="col-sm-3 control-label">备注:</label> | |
| 33 | + <div class="col-sm-8"> | |
| 34 | + <input type="text" placeholder="备注信息" value="$!user.orgId" aria-required="true" required="true" class="form-control" minlength="2" name="remarks" id="remarks"> | |
| 35 | + </div> | |
| 36 | + </div> | |
| 37 | + <div class="form-group"> | |
| 38 | + <label class="col-sm-3 control-label">机构:</label> | |
| 39 | + <div class="col-sm-8"> | |
| 40 | + <input type="text" placeholder="所属机构" value="$!user.orgId" aria-required="true" required="true" class="form-control" minlength="2" name="orgId" id="orgId"> | |
| 41 | + </div> | |
| 42 | + </div> | |
| 43 | + <div class="form-group"> | |
| 44 | + <label class="col-sm-3 control-label">部门:</label> | |
| 45 | + <div class="col-sm-8"> | |
| 46 | + <input type="text" placeholder="所属部门" value="$!user.deptId" aria-required="true" required="true" class="form-control" minlength="2" name="deptId" id="deptId"> | |
| 47 | + </div> | |
| 48 | + </div> | |
| 49 | + <div class="form-group"> | |
| 50 | + <label class="col-sm-3 control-label"></label> | |
| 51 | + <div class="col-sm-8"> | |
| 52 | + <label class="checkbox-inline i-checks"> | |
| 53 | + <div class="icheckbox_square-green" style="position: relative;"> | |
| 54 | + <input type="checkbox" value="1" name="enable" #if ($user.enable == 1) checked="checked" #end | |
| 55 | + style="position: absolute; opacity: 0;" > | |
| 56 | + <ins class="iCheck-helper" | |
| 57 | + style="position: absolute; top: 0%; left: 0%; display: block; width: 100%; height: 100%; margin: 0px; padding: 0px; background: rgb(255, 255, 255); border: 0px; opacity: 0;"></ins> | |
| 58 | + </div>是否可用(选中可用,不选中不可用) | |
| 59 | + </label> | |
| 60 | + </div> | |
| 61 | + </div> | |
| 62 | + <div class="form-group"> | |
| 63 | + <label class="col-sm-3 control-label"></label> | |
| 64 | + <div class="col-sm-8"> | |
| 65 | + <label class="checkbox-inline i-checks"> | |
| 66 | + <div class="icheckbox_square-green" style="position: relative;"> | |
| 67 | + <input type="checkbox" value="0" name="type" #if ($user.type == 0) checked="checked" #end | |
| 68 | + style="position: absolute; opacity: 0;" > | |
| 69 | + <ins class="iCheck-helper" | |
| 70 | + style="position: absolute; top: 0%; left: 0%; display: block; width: 100%; height: 100%; margin: 0px; padding: 0px; background: rgb(255, 255, 255); border: 0px; opacity: 0;"></ins> | |
| 71 | + </div>是否管理员(选中为管理员) | |
| 72 | + </label> | |
| 73 | + </div> | |
| 74 | + </div> | |
| 75 | + <div class="hr-line-dashed"></div> | |
| 76 | + <div class="form-group"> | |
| 77 | + <div class="col-sm-4 col-sm-offset-3 pull-right"> | |
| 78 | + <button type="button" class="btn btn-primary" onclick="save();"><i class="fa fa-check"></i> 提交</button> | |
| 79 | + <button type="button" class="btn btn-white" onclick="parent.closeAll();"><i class="fa fa-close"></i> 取消</button> | |
| 80 | + </div> | |
| 81 | + </div> | |
| 82 | + </form> | |
| 26 | 83 | </div> |
| 27 | 84 | </div> |
| 28 | 85 | <script type="text/javascript"> |
center.manager/src/main/webapp/WEB-INF/views/user/user_list.html
View file @
e0ba7aa
| ... | ... | @@ -36,13 +36,13 @@ |
| 36 | 36 | var controllerRequestMappint = "/sysUsers/"; |
| 37 | 37 | |
| 38 | 38 | function add() { |
| 39 | - popWindow("新增角色", APP.PATH + controllerRequestMappint + "0/toEdit",700,550); | |
| 39 | + fullWindow("新增用户", APP.PATH + controllerRequestMappint + "0/toEdit"); | |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | function edit(){ |
| 43 | 43 | var id = getSingleSelectedValue("dataTable","id"); |
| 44 | 44 | if(id){ |
| 45 | - popWindow("修改橘色", APP.PATH + controllerRequestMappint + id + "/toEdit",700,550); | |
| 45 | + fullWindow("修改用户", APP.PATH + controllerRequestMappint + id + "/toEdit"); | |
| 46 | 46 | } |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | |
| 50 | 50 | |
| 51 | 51 | |
| 52 | 52 | |
| ... | ... | @@ -61,31 +61,33 @@ |
| 61 | 61 | title: '编号' |
| 62 | 62 | },{ |
| 63 | 63 | field: 'type', |
| 64 | - title: '类型' | |
| 64 | + title: '类型', | |
| 65 | + formatter:function(value,row,index){ | |
| 66 | + if(value == 0){ | |
| 67 | + return '管理员' | |
| 68 | + }else{ | |
| 69 | + return '用户'; | |
| 70 | + } | |
| 71 | + } | |
| 65 | 72 | }, { |
| 66 | 73 | field: 'account', |
| 67 | 74 | title: '帐号' |
| 68 | 75 | },{ |
| 76 | + field: 'name', | |
| 77 | + title: '姓名' | |
| 78 | + },{ | |
| 69 | 79 | field: 'orgId', |
| 70 | 80 | title: '机构' |
| 71 | 81 | },{ |
| 72 | 82 | field: 'deptId', |
| 73 | 83 | title: '部门' |
| 74 | 84 | },{ |
| 75 | - field: 'name', | |
| 76 | - title: '名称' | |
| 77 | - },{ | |
| 78 | 85 | field: 'phone', |
| 79 | 86 | title: '手机号' |
| 80 | 87 | },{ |
| 81 | - field: 'publishId', | |
| 82 | - title: '发布者' | |
| 83 | - },{ | |
| 84 | - field: 'ifDel', | |
| 85 | - title: '是否删除' | |
| 86 | - },{ | |
| 87 | 88 | field: 'enable', |
| 88 | - title: '启/停用' | |
| 89 | + title: '启/停用', | |
| 90 | + formatter:enableFormatter | |
| 89 | 91 | }]; |
| 90 | 92 | </script> |
| 91 | 93 | #end |
mybatis-plus/src/test/java/com/baomidou/mybatisplus/test/generator/MysqlGenerator.java
View file @
e0ba7aa
| ... | ... | @@ -44,7 +44,7 @@ |
| 44 | 44 | gc.setOutputDir("E://mybatis-plus-generate"); |
| 45 | 45 | gc.setAuthor("fangcheng"); |
| 46 | 46 | //strategy.setInclude(new String[] { "SYS_USERS","SYS_USER_ROLE_MAPS","SYS_ROLES" }); // 需要生成的表 |
| 47 | - strategy.setInclude(new String[] { "SYS_ROLE_PERMISSION_MAPS" }); // 需要生成的表 | |
| 47 | + strategy.setInclude(new String[] { "SYS_USERS" }); // 需要生成的表 | |
| 48 | 48 | // pc.setParent("com.lyms.hospital"); |
| 49 | 49 | pc.setParent("com.lyms.cm"); |
| 50 | 50 |