Commit 98f4a662cbd44211edda12dbcbb3752a8df3f2c7
1 parent
c5047ec9f4
Exists in
master
role init voer
Showing 30 changed files with 628 additions and 334 deletions
- center.manager/src/main/java/com/lyms/cm/controller/sys/SysRolesController.java
- center.manager/src/main/java/com/lyms/cm/controller/sys/SysUsersController.java
- center.manager/src/main/java/com/lyms/cm/dao/sys/SysRolesMapper.java
- center.manager/src/main/java/com/lyms/cm/dao/sys/SysRolesMapper.xml
- center.manager/src/main/java/com/lyms/cm/dao/sys/SysUserRoleMapsMapper.java
- center.manager/src/main/java/com/lyms/cm/dao/sys/SysUserRoleMapsMapper.xml
- center.manager/src/main/java/com/lyms/cm/dao/sys/SysUsersMapper.java
- center.manager/src/main/java/com/lyms/cm/dao/sys/SysUsersMapper.xml
- center.manager/src/main/java/com/lyms/cm/entity/sys/SysRoles.java
- center.manager/src/main/java/com/lyms/cm/entity/sys/SysUserRoleMaps.java
- center.manager/src/main/java/com/lyms/cm/entity/sys/SysUsers.java
- center.manager/src/main/java/com/lyms/cm/service/sys/SysRolesService.java
- center.manager/src/main/java/com/lyms/cm/service/sys/SysUserRoleMapsService.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/SysUserRoleMapsServiceImpl.java
- center.manager/src/main/java/com/lyms/cm/service/sys/impl/SysUsersServiceImpl.java
- center.manager/src/main/resources/xml/app-datasource.xml
- center.manager/src/main/webapp/WEB-INF/views/common/base.html
- center.manager/src/main/webapp/WEB-INF/views/common/base_list.html
- center.manager/src/main/webapp/WEB-INF/views/role/role_edit.html
- 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
- core.sdk/src/main/java/com/lyms/mybatis/DeleteLogicByIdSqlInjector.java
- mybatis-plus/src/main/resources/template/entity.java.vm
- mybatis-plus/src/main/resources/template/mapper.java.vm
- mybatis-plus/src/main/resources/template/service.java.vm
- mybatis-plus/src/main/resources/template/serviceImpl.java.vm
- mybatis-plus/src/test/java/com/baomidou/mybatisplus/test/generator/MysqlGenerator.java
center.manager/src/main/java/com/lyms/cm/controller/sys/SysRolesController.java
View file @
98f4a66
| 1 | 1 | package com.lyms.cm.controller.sys; |
| 2 | 2 | |
| 3 | - | |
| 3 | +import org.apache.commons.lang3.StringUtils; | |
| 4 | 4 | import org.springframework.beans.factory.annotation.Autowired; |
| 5 | 5 | import org.springframework.stereotype.Controller; |
| 6 | +import org.springframework.ui.Model; | |
| 7 | +import org.springframework.web.bind.annotation.PathVariable; | |
| 6 | 8 | import org.springframework.web.bind.annotation.RequestMapping; |
| 7 | 9 | import org.springframework.web.bind.annotation.RequestMethod; |
| 8 | 10 | import org.springframework.web.bind.annotation.ResponseBody; |
| 9 | 11 | |
| 12 | +import com.baomidou.mybatisplus.mapper.EntityWrapper; | |
| 10 | 13 | import com.baomidou.mybatisplus.plugins.Page; |
| 11 | 14 | import com.lyms.cm.entity.sys.SysRoles; |
| 12 | 15 | import com.lyms.cm.service.sys.SysRolesService; |
| 16 | +import com.lyms.constants.OperationName; | |
| 17 | +import com.lyms.util.StrUtils; | |
| 18 | +import com.lyms.web.bean.AjaxResult; | |
| 13 | 19 | import com.lyms.web.controller.BaseController; |
| 14 | 20 | |
| 15 | 21 | /** |
| 16 | 22 | |
| ... | ... | @@ -23,11 +29,10 @@ |
| 23 | 29 | @Controller |
| 24 | 30 | @RequestMapping("/sysRoles") |
| 25 | 31 | public class SysRolesController extends BaseController { |
| 26 | - | |
| 32 | + | |
| 27 | 33 | @Autowired |
| 28 | 34 | private SysRolesService sysRolesService; |
| 29 | - | |
| 30 | - | |
| 35 | + | |
| 31 | 36 | @RequestMapping("/toList") |
| 32 | 37 | public String list() { |
| 33 | 38 | return "/role/role_list"; |
| 34 | 39 | |
| 35 | 40 | |
| ... | ... | @@ -35,10 +40,65 @@ |
| 35 | 40 | |
| 36 | 41 | @RequestMapping(value = "/getRoleList", method = { RequestMethod.POST }) |
| 37 | 42 | @ResponseBody |
| 38 | - public java.util.Map<String, Object> getRoleList(){ | |
| 43 | + public java.util.Map<String, Object> getRoleList() { | |
| 39 | 44 | Page<SysRoles> page = getPage(); |
| 40 | - return toGridData(sysRolesService.selectPage(page)); | |
| 45 | + EntityWrapper<SysRoles> ew = new EntityWrapper<SysRoles>(); | |
| 46 | + ew.where("ifDel=0"); | |
| 47 | + return toGridData(sysRolesService.selectPage(page,ew)); | |
| 41 | 48 | } |
| 42 | - | |
| 49 | + | |
| 50 | + /** | |
| 51 | + * 跳转到编辑页面 | |
| 52 | + * | |
| 53 | + * @return | |
| 54 | + */ | |
| 55 | + @RequestMapping(value = { "/{id}/toEdit" }, method = RequestMethod.GET) | |
| 56 | + public String toEdit(@PathVariable String id, Model model) { | |
| 57 | + if (!StringUtils.isBlank(id) && !"0".equals(id)) { | |
| 58 | + SysRoles role = sysRolesService.selectById(id); | |
| 59 | + model.addAttribute("role", role); | |
| 60 | + } | |
| 61 | + return "/role/role_edit"; | |
| 62 | + } | |
| 63 | + | |
| 64 | + /** | |
| 65 | + * 创建用户 | |
| 66 | + * <p> | |
| 67 | + * TODO | |
| 68 | + * | |
| 69 | + * @param user | |
| 70 | + * @return | |
| 71 | + */ | |
| 72 | + @RequestMapping(value = "/create", method = RequestMethod.POST) | |
| 73 | + @ResponseBody | |
| 74 | + public AjaxResult create(SysRoles role, AjaxResult ajaxResult) { | |
| 75 | + role.setId(StrUtils.uuid()); | |
| 76 | + role.setIfdel(0); | |
| 77 | + boolean tag = sysRolesService.insert(role); | |
| 78 | + return handleAjaxResult(ajaxResult, tag, OperationName.CREATE); | |
| 79 | + } | |
| 80 | + | |
| 81 | + /** | |
| 82 | + * 修改信息 | |
| 83 | + */ | |
| 84 | + @RequestMapping(value = "/update", method = { RequestMethod.POST }) | |
| 85 | + @ResponseBody | |
| 86 | + public AjaxResult update(SysRoles role, AjaxResult ajaxResult) { | |
| 87 | + boolean tag = sysRolesService.updateById(role); | |
| 88 | + return handleAjaxResult(ajaxResult, tag, OperationName.UPDATE); | |
| 89 | + } | |
| 90 | + | |
| 91 | + /** | |
| 92 | + * 删除用户 | |
| 93 | + * | |
| 94 | + * @return | |
| 95 | + */ | |
| 96 | + @RequestMapping(value = "/{id}/delete", method = { RequestMethod.GET, RequestMethod.POST }) | |
| 97 | + @ResponseBody | |
| 98 | + public AjaxResult delete(@PathVariable String id, AjaxResult ajaxResult) { | |
| 99 | + int tag = sysRolesService.deleteLogicById(id); | |
| 100 | + return handleAjaxResult(ajaxResult, tag, OperationName.DELETE); | |
| 101 | + } | |
| 102 | + | |
| 43 | 103 | } |
center.manager/src/main/java/com/lyms/cm/controller/sys/SysUsersController.java
View file @
98f4a66
| ... | ... | @@ -11,6 +11,7 @@ |
| 11 | 11 | import org.springframework.web.bind.annotation.RequestMethod; |
| 12 | 12 | import org.springframework.web.bind.annotation.ResponseBody; |
| 13 | 13 | |
| 14 | +import com.baomidou.mybatisplus.mapper.EntityWrapper; | |
| 14 | 15 | import com.baomidou.mybatisplus.plugins.Page; |
| 15 | 16 | import com.lyms.cm.entity.sys.SysUsers; |
| 16 | 17 | import com.lyms.cm.service.sys.SysUsersService; |
| ... | ... | @@ -44,7 +45,7 @@ |
| 44 | 45 | @RequestMapping(value = "/create", method = RequestMethod.POST) |
| 45 | 46 | @ResponseBody |
| 46 | 47 | public AjaxResult create(SysUsers user, AjaxResult ajaxResult) { |
| 47 | - boolean tag = userService.updateUser(user); | |
| 48 | + boolean tag = userService.addUser(user); | |
| 48 | 49 | return handleAjaxResult(ajaxResult, tag, OperationName.UPDATE); |
| 49 | 50 | } |
| 50 | 51 | |
| ... | ... | @@ -69,7 +70,9 @@ |
| 69 | 70 | @ResponseBody |
| 70 | 71 | public Map<String, Object> list(Model model) { |
| 71 | 72 | Page<SysUsers> page = getPage(); |
| 72 | - page = userService.selectPage(page); | |
| 73 | + EntityWrapper<SysUsers> ew = new EntityWrapper<SysUsers>(); | |
| 74 | + ew.where("ifDel=0"); | |
| 75 | + page = userService.selectPage(page,ew); | |
| 73 | 76 | return toGridData(page); |
| 74 | 77 | } |
| 75 | 78 | |
| ... | ... | @@ -90,7 +93,7 @@ |
| 90 | 93 | /** |
| 91 | 94 | * 修改信息 |
| 92 | 95 | */ |
| 93 | - @RequestMapping(value = "/edit", method = { RequestMethod.POST }) | |
| 96 | + @RequestMapping(value = "/update", method = { RequestMethod.POST }) | |
| 94 | 97 | @ResponseBody |
| 95 | 98 | public AjaxResult update(SysUsers user, AjaxResult ajaxResult) { |
| 96 | 99 | boolean tag = userService.updateUser(user); |
| ... | ... | @@ -105,8 +108,8 @@ |
| 105 | 108 | */ |
| 106 | 109 | @RequestMapping(value = "/{id}/delete", method = { RequestMethod.GET, RequestMethod.POST }) |
| 107 | 110 | @ResponseBody |
| 108 | - public AjaxResult del(@PathVariable String id, AjaxResult ajaxResult) { | |
| 109 | - boolean tag = userService.delete(id); | |
| 111 | + public AjaxResult delete(@PathVariable String id, AjaxResult ajaxResult) { | |
| 112 | + int tag = userService.deleteLogicById(id); | |
| 110 | 113 | return handleAjaxResult(ajaxResult, tag, OperationName.DELETE); |
| 111 | 114 | } |
| 112 | 115 |
center.manager/src/main/java/com/lyms/cm/dao/sys/SysRolesMapper.java
View file @
98f4a66
| 1 | 1 | package com.lyms.cm.dao.sys; |
| 2 | 2 | |
| 3 | - | |
| 4 | -import com.baomidou.mybatisplus.mapper.BaseMapper; | |
| 5 | 3 | import com.lyms.cm.entity.sys.SysRoles; |
| 6 | - | |
| 4 | +import com.baomidou.mybatisplus.mapper.BaseMapper; | |
| 7 | 5 | import org.springframework.stereotype.Repository; |
| 6 | +import java.io.Serializable; | |
| 8 | 7 | /** |
| 9 | 8 | * <p> |
| 10 | 9 | * Mapper接口 |
| 11 | 10 | * </p> |
| 12 | 11 | * |
| 13 | - * @author maliang | |
| 14 | - * @since 2017-03-02 | |
| 12 | + * @author fangcheng | |
| 13 | + * @since 2017-03-07 | |
| 15 | 14 | */ |
| 16 | 15 | @Repository |
| 17 | 16 | public interface SysRolesMapper extends BaseMapper<SysRoles> { |
| 17 | + | |
| 18 | + public Integer deleteLogicById(Serializable id); | |
| 18 | 19 | |
| 19 | 20 | } |
center.manager/src/main/java/com/lyms/cm/dao/sys/SysRolesMapper.xml
View file @
98f4a66
| ... | ... | @@ -2,6 +2,24 @@ |
| 2 | 2 | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| 3 | 3 | <mapper namespace="com.lyms.cm.dao.sys.SysRolesMapper"> |
| 4 | 4 | |
| 5 | + <!-- 通用查询映射结果 --> | |
| 6 | + <resultMap id="BaseResultMap" type="com.lyms.cm.entity.sys.SysRoles"> | |
| 7 | + <id column="ID" property="id" /> | |
| 8 | + <result column="TYPE" property="type" /> | |
| 9 | + <result column="NAME" property="name" /> | |
| 10 | + <result column="PUBLISH_ID" property="publishId" /> | |
| 11 | + <result column="ENABLE" property="enable" /> | |
| 12 | + <result column="IFDEL" property="ifdel" /> | |
| 13 | + <result column="REMARKS" property="remarks" /> | |
| 14 | + <result column="SHORT_CODE" property="shortCode" /> | |
| 15 | + <result column="ORG_ID" property="orgId" /> | |
| 16 | + <result column="CREATED" property="created" /> | |
| 17 | + <result column="MODIFIED" property="modified" /> | |
| 18 | + </resultMap> | |
| 5 | 19 | |
| 20 | + <!-- 通用查询结果列 --> | |
| 21 | + <sql id="Base_Column_List"> | |
| 22 | + ID AS id, TYPE AS type, NAME AS name, PUBLISH_ID AS publishId, ENABLE AS enable, IFDEL AS ifdel, REMARKS AS remarks, SHORT_CODE AS shortCode, ORG_ID AS orgId, CREATED AS created, MODIFIED AS modified | |
| 23 | + </sql> | |
| 6 | 24 | </mapper> |
center.manager/src/main/java/com/lyms/cm/dao/sys/SysUserRoleMapsMapper.java
View file @
98f4a66
| 1 | +package com.lyms.cm.dao.sys; | |
| 2 | + | |
| 3 | +import com.lyms.cm.entity.sys.SysUserRoleMaps; | |
| 4 | +import com.baomidou.mybatisplus.mapper.BaseMapper; | |
| 5 | +import org.springframework.stereotype.Repository; | |
| 6 | +import java.io.Serializable; | |
| 7 | +/** | |
| 8 | + * <p> | |
| 9 | + * Mapper接口 | |
| 10 | + * </p> | |
| 11 | + * | |
| 12 | + * @author fangcheng | |
| 13 | + * @since 2017-03-07 | |
| 14 | + */ | |
| 15 | +@Repository | |
| 16 | +public interface SysUserRoleMapsMapper extends BaseMapper<SysUserRoleMaps> { | |
| 17 | + | |
| 18 | + public Integer deleteLogicById(Serializable id); | |
| 19 | + | |
| 20 | +} |
center.manager/src/main/java/com/lyms/cm/dao/sys/SysUserRoleMapsMapper.xml
View file @
98f4a66
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
| 3 | +<mapper namespace="com.lyms.cm.dao.sys.SysUserRoleMapsMapper"> | |
| 4 | + | |
| 5 | + <!-- 通用查询映射结果 --> | |
| 6 | + <resultMap id="BaseResultMap" type="com.lyms.cm.entity.sys.SysUserRoleMaps"> | |
| 7 | + <result column="ID" property="id" /> | |
| 8 | + <result column="USER_ID" property="userId" /> | |
| 9 | + <result column="ROLE_ID" property="roleId" /> | |
| 10 | + <result column="IFDEL" property="ifdel" /> | |
| 11 | + </resultMap> | |
| 12 | + | |
| 13 | + <!-- 通用查询结果列 --> | |
| 14 | + <sql id="Base_Column_List"> | |
| 15 | + ID AS id, USER_ID AS userId, ROLE_ID AS roleId, IFDEL AS ifdel | |
| 16 | + </sql> | |
| 17 | +</mapper> |
center.manager/src/main/java/com/lyms/cm/dao/sys/SysUsersMapper.java
View file @
98f4a66
| 1 | 1 | package com.lyms.cm.dao.sys; |
| 2 | 2 | |
| 3 | -import org.springframework.stereotype.Repository; | |
| 4 | - | |
| 5 | -import com.baomidou.mybatisplus.mapper.BaseMapper; | |
| 6 | 3 | import com.lyms.cm.entity.sys.SysUsers; |
| 7 | - | |
| 4 | +import com.baomidou.mybatisplus.mapper.BaseMapper; | |
| 5 | +import org.springframework.stereotype.Repository; | |
| 6 | +import java.io.Serializable; | |
| 8 | 7 | /** |
| 9 | 8 | * <p> |
| 10 | 9 | * Mapper接口 |
| 11 | 10 | * </p> |
| 12 | 11 | * |
| 13 | - * @author maliang | |
| 14 | - * @since 2017-03-02 | |
| 12 | + * @author fangcheng | |
| 13 | + * @since 2017-03-07 | |
| 15 | 14 | */ |
| 16 | 15 | @Repository |
| 17 | 16 | public interface SysUsersMapper extends BaseMapper<SysUsers> { |
| 17 | + | |
| 18 | + public Integer deleteLogicById(Serializable id); | |
| 18 | 19 | |
| 19 | 20 | } |
center.manager/src/main/java/com/lyms/cm/dao/sys/SysUsersMapper.xml
View file @
98f4a66
| ... | ... | @@ -2,6 +2,36 @@ |
| 2 | 2 | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| 3 | 3 | <mapper namespace="com.lyms.cm.dao.sys.SysUsersMapper"> |
| 4 | 4 | |
| 5 | + <!-- 通用查询映射结果 --> | |
| 6 | + <resultMap id="BaseResultMap" type="com.lyms.cm.entity.sys.SysUsers"> | |
| 7 | + <result column="ID" property="id" /> | |
| 8 | + <result column="TYPE" property="type" /> | |
| 9 | + <result column="ORG_ID" property="orgId" /> | |
| 10 | + <result column="DEPT_ID" property="deptId" /> | |
| 11 | + <result column="NAME" property="name" /> | |
| 12 | + <result column="ACCOUNT" property="account" /> | |
| 13 | + <result column="PWD" property="pwd" /> | |
| 14 | + <result column="PHONE" property="phone" /> | |
| 15 | + <result column="PUBLISH_ID" property="publishId" /> | |
| 16 | + <result column="IFDEL" property="ifdel" /> | |
| 17 | + <result column="ENABLE" property="enable" /> | |
| 18 | + <result column="MODIFIED" property="modified" /> | |
| 19 | + <result column="CREATED" property="created" /> | |
| 20 | + <result column="REMARKS" property="remarks" /> | |
| 21 | + <result column="LAST_LOGIN_TIME" property="lastLoginTime" /> | |
| 22 | + <result column="FOREIGN_ID" property="foreignId" /> | |
| 23 | + <result column="OTHER_ACCOUNT" property="otherAccount" /> | |
| 24 | + <result column="EMPLOYEE_ID" property="employeeId" /> | |
| 25 | + <result column="EXPIR_TIME" property="expirTime" /> | |
| 26 | + <result column="LEVEL" property="level" /> | |
| 27 | + <result column="AVATAR" property="avatar" /> | |
| 28 | + <result column="WORK_TIME" property="workTime" /> | |
| 29 | + <result column="GOOD_AT" property="goodAt" /> | |
| 30 | + </resultMap> | |
| 5 | 31 | |
| 32 | + <!-- 通用查询结果列 --> | |
| 33 | + <sql id="Base_Column_List"> | |
| 34 | + ID AS id, TYPE AS type, ORG_ID AS orgId, DEPT_ID AS deptId, NAME AS name, ACCOUNT AS account, PWD AS pwd, PHONE AS phone, PUBLISH_ID AS publishId, IFDEL AS ifdel, ENABLE AS enable, MODIFIED AS modified, CREATED AS created, REMARKS AS remarks, LAST_LOGIN_TIME AS lastLoginTime, FOREIGN_ID AS foreignId, OTHER_ACCOUNT AS otherAccount, EMPLOYEE_ID AS employeeId, EXPIR_TIME AS expirTime, LEVEL AS level, AVATAR AS avatar, WORK_TIME AS workTime, GOOD_AT AS goodAt | |
| 35 | + </sql> | |
| 6 | 36 | </mapper> |
center.manager/src/main/java/com/lyms/cm/entity/sys/SysRoles.java
View file @
98f4a66
| 1 | 1 | package com.lyms.cm.entity.sys; |
| 2 | 2 | |
| 3 | +import com.baomidou.mybatisplus.annotations.TableId; | |
| 4 | +import com.baomidou.mybatisplus.annotations.TableName; | |
| 5 | +import com.baomidou.mybatisplus.annotations.TableField; | |
| 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 | -import com.lyms.cm.enums.StatusEnum; | |
| 9 | - | |
| 10 | 9 | /** |
| 11 | 10 | * <p> |
| 12 | 11 | * 角色表 |
| 13 | 12 | * </p> |
| 14 | 13 | * |
| 15 | - * @author maliang | |
| 16 | - * @since 2017-03-02 | |
| 14 | + * @author fangcheng | |
| 15 | + * @since 2017-03-07 | |
| 17 | 16 | */ |
| 18 | 17 | @TableName("SYS_ROLES") |
| 19 | 18 | public class SysRoles implements Serializable { |
| 20 | 19 | |
| 21 | - private static final long serialVersionUID = 1L; | |
| 20 | + private static final long serialVersionUID = 1L; | |
| 22 | 21 | |
| 23 | 22 | /** |
| 24 | 23 | * |
| 25 | 24 | */ |
| 26 | - @TableField(value = "ID") | |
| 25 | + @TableId(value="ID") | |
| 27 | 26 | private String id; |
| 28 | 27 | /** |
| 29 | 28 | * 0:管理员角色,1:用户角色 |
| 30 | 29 | */ |
| 31 | - @TableField(value = "TYPE") | |
| 30 | + @TableField(value="TYPE") | |
| 32 | 31 | private Integer type; |
| 33 | 32 | /** |
| 34 | 33 | * 角色名称 |
| 35 | 34 | */ |
| 36 | - @TableField(value = "NAME") | |
| 35 | + @TableField(value="NAME") | |
| 37 | 36 | private String name; |
| 38 | 37 | /** |
| 39 | 38 | * |
| 40 | 39 | */ |
| 41 | - @TableField(value = "PUBLISH_ID") | |
| 40 | + @TableField(value="PUBLISH_ID") | |
| 42 | 41 | private String publishId; |
| 43 | 42 | /** |
| 44 | 43 | * 1:启用,2:停用 |
| 45 | 44 | */ |
| 46 | - @TableField(value = "ENABLE") | |
| 45 | + @TableField(value="ENABLE") | |
| 47 | 46 | private Integer enable; |
| 48 | 47 | /** |
| 49 | 48 | * 1:有效,2:无效 |
| 50 | 49 | */ |
| 51 | - @TableField(value = "YN") | |
| 52 | - private Integer yn; | |
| 50 | + @TableField(value="IFDEL") | |
| 51 | + private Integer ifdel; | |
| 53 | 52 | /** |
| 54 | 53 | * 备注 |
| 55 | 54 | */ |
| 56 | - @TableField(value = "REMARKS") | |
| 55 | + @TableField(value="REMARKS") | |
| 57 | 56 | private String remarks; |
| 58 | 57 | /** |
| 59 | 58 | * 简码 |
| 60 | 59 | */ |
| 61 | - @TableField(value = "SHORT_CODE") | |
| 60 | + @TableField(value="SHORT_CODE") | |
| 62 | 61 | private String shortCode; |
| 63 | 62 | /** |
| 64 | 63 | * 机构id |
| 65 | 64 | */ |
| 66 | - @TableField(value = "ORG_ID") | |
| 65 | + @TableField(value="ORG_ID") | |
| 67 | 66 | private String orgId; |
| 68 | 67 | /** |
| 69 | 68 | * |
| 70 | 69 | */ |
| 71 | - @TableField(value = "CREATED") | |
| 70 | + @TableField(value="CREATED") | |
| 72 | 71 | private Date created; |
| 73 | 72 | /** |
| 74 | 73 | * |
| 75 | 74 | */ |
| 76 | - @TableField(value = "MODIFIED") | |
| 75 | + @TableField(value="MODIFIED") | |
| 77 | 76 | private Date modified; |
| 78 | 77 | |
| 78 | + | |
| 79 | 79 | public String getId() { |
| 80 | 80 | return id; |
| 81 | 81 | } |
| 82 | 82 | |
| ... | ... | @@ -116,12 +116,12 @@ |
| 116 | 116 | this.enable = enable; |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | - public Integer getYn() { | |
| 120 | - return yn; | |
| 119 | + public Integer getIfdel() { | |
| 120 | + return ifdel; | |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | - public void setYn(Integer yn) { | |
| 124 | - this.yn = yn; | |
| 123 | + public void setIfdel(Integer ifdel) { | |
| 124 | + this.ifdel = ifdel; | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | public String getRemarks() { |
| ... | ... | @@ -162,10 +162,6 @@ |
| 162 | 162 | |
| 163 | 163 | public void setModified(Date modified) { |
| 164 | 164 | this.modified = modified; |
| 165 | - } | |
| 166 | - | |
| 167 | - public boolean isEnabled() { | |
| 168 | - return StatusEnum.isEnabled(this.getEnable()); | |
| 169 | 165 | } |
| 170 | 166 | |
| 171 | 167 | } |
center.manager/src/main/java/com/lyms/cm/entity/sys/SysUserRoleMaps.java
View file @
98f4a66
| 1 | +package com.lyms.cm.entity.sys; | |
| 2 | + | |
| 3 | +import java.io.Serializable; | |
| 4 | + | |
| 5 | +import com.baomidou.mybatisplus.annotations.TableField; | |
| 6 | +import com.baomidou.mybatisplus.annotations.TableName; | |
| 7 | + | |
| 8 | +/** | |
| 9 | + * <p> | |
| 10 | + * 用户角色关系表 | |
| 11 | + * </p> | |
| 12 | + * | |
| 13 | + * @author fangcheng | |
| 14 | + * @since 2017-03-07 | |
| 15 | + */ | |
| 16 | +@TableName("SYS_USER_ROLE_MAPS") | |
| 17 | +public class SysUserRoleMaps implements Serializable { | |
| 18 | + | |
| 19 | + private static final long serialVersionUID = 1L; | |
| 20 | + | |
| 21 | + /** | |
| 22 | + * | |
| 23 | + */ | |
| 24 | + @TableField(value="ID") | |
| 25 | + private String id; | |
| 26 | + /** | |
| 27 | + * | |
| 28 | + */ | |
| 29 | + @TableField(value="USER_ID") | |
| 30 | + private String userId; | |
| 31 | + /** | |
| 32 | + * | |
| 33 | + */ | |
| 34 | + @TableField(value="ROLE_ID") | |
| 35 | + private String roleId; | |
| 36 | + /** | |
| 37 | + * | |
| 38 | + */ | |
| 39 | + @TableField(value="IFDEL") | |
| 40 | + private Integer ifdel; | |
| 41 | + | |
| 42 | + | |
| 43 | + public String getId() { | |
| 44 | + return id; | |
| 45 | + } | |
| 46 | + | |
| 47 | + public void setId(String id) { | |
| 48 | + this.id = id; | |
| 49 | + } | |
| 50 | + | |
| 51 | + public String getUserId() { | |
| 52 | + return userId; | |
| 53 | + } | |
| 54 | + | |
| 55 | + public void setUserId(String userId) { | |
| 56 | + this.userId = userId; | |
| 57 | + } | |
| 58 | + | |
| 59 | + public String getRoleId() { | |
| 60 | + return roleId; | |
| 61 | + } | |
| 62 | + | |
| 63 | + public void setRoleId(String roleId) { | |
| 64 | + this.roleId = roleId; | |
| 65 | + } | |
| 66 | + | |
| 67 | + public Integer getIfdel() { | |
| 68 | + return ifdel; | |
| 69 | + } | |
| 70 | + | |
| 71 | + public void setIfdel(Integer ifdel) { | |
| 72 | + this.ifdel = ifdel; | |
| 73 | + } | |
| 74 | + | |
| 75 | +} |
center.manager/src/main/java/com/lyms/cm/entity/sys/SysUsers.java
View file @
98f4a66
| ... | ... | @@ -5,152 +5,137 @@ |
| 5 | 5 | |
| 6 | 6 | import com.baomidou.mybatisplus.annotations.TableField; |
| 7 | 7 | import com.baomidou.mybatisplus.annotations.TableName; |
| 8 | -import com.lyms.cm.enums.StatusEnum; | |
| 9 | -import com.lyms.cm.enums.TypeEnum; | |
| 10 | -import com.lyms.cm.enums.ValidityEnum; | |
| 11 | 8 | |
| 12 | 9 | /** |
| 13 | 10 | * <p> |
| 14 | 11 | * 用户表 |
| 15 | 12 | * </p> |
| 16 | 13 | * |
| 17 | - * @author maliang | |
| 18 | - * @since 2017-03-02 | |
| 14 | + * @author fangcheng | |
| 15 | + * @since 2017-03-07 | |
| 19 | 16 | */ |
| 20 | 17 | @TableName("SYS_USERS") |
| 21 | 18 | public class SysUsers implements Serializable { |
| 22 | 19 | |
| 23 | - private static final long serialVersionUID = 1L; | |
| 20 | + private static final long serialVersionUID = 1L; | |
| 24 | 21 | |
| 25 | - // 初始默认值 | |
| 26 | - public SysUsers() { | |
| 27 | - // this.setType(UserTypeEnum.USER.getType()); | |
| 28 | - // this.setEnable(UserStatusEnum.ENABLED.getStatus()); | |
| 29 | - // this.setCreated(new Date()); | |
| 30 | - } | |
| 31 | - | |
| 32 | 22 | /** |
| 33 | 23 | * |
| 34 | 24 | */ |
| 35 | - @TableField(value = "ID") | |
| 25 | + @TableField(value="ID") | |
| 36 | 26 | private String id; |
| 37 | 27 | /** |
| 38 | 28 | * 0:管理员,1:用户 |
| 39 | - * <p> | |
| 40 | - * {@link TypeEnum#MANAGER} OR {@link TypeEnum#USER} | |
| 41 | 29 | */ |
| 42 | - @TableField(value = "TYPE") | |
| 43 | - private Integer type = TypeEnum.USER.getType(); | |
| 30 | + @TableField(value="TYPE") | |
| 31 | + private Integer type; | |
| 44 | 32 | /** |
| 45 | 33 | * 机构id |
| 46 | 34 | */ |
| 47 | - @TableField(value = "ORG_ID") | |
| 35 | + @TableField(value="ORG_ID") | |
| 48 | 36 | private String orgId; |
| 49 | 37 | /** |
| 50 | 38 | * 部门id |
| 51 | 39 | */ |
| 52 | - @TableField(value = "DEPT_ID") | |
| 40 | + @TableField(value="DEPT_ID") | |
| 53 | 41 | private String deptId; |
| 54 | 42 | /** |
| 55 | 43 | * 名称 |
| 56 | 44 | */ |
| 57 | - @TableField(value = "NAME") | |
| 45 | + @TableField(value="NAME") | |
| 58 | 46 | private String name; |
| 59 | 47 | /** |
| 60 | 48 | * 帐号 |
| 61 | 49 | */ |
| 62 | - @TableField(value = "ACCOUNT") | |
| 50 | + @TableField(value="ACCOUNT") | |
| 63 | 51 | private String account; |
| 64 | 52 | /** |
| 65 | 53 | * 名字 |
| 66 | 54 | */ |
| 67 | - @TableField(value = "PWD") | |
| 55 | + @TableField(value="PWD") | |
| 68 | 56 | private String pwd; |
| 69 | 57 | /** |
| 70 | 58 | * 手机号 |
| 71 | 59 | */ |
| 72 | - @TableField(value = "PHONE") | |
| 60 | + @TableField(value="PHONE") | |
| 73 | 61 | private String phone; |
| 74 | 62 | /** |
| 75 | 63 | * 发布者id |
| 76 | 64 | */ |
| 77 | - @TableField(value = "PUBLISH_ID") | |
| 65 | + @TableField(value="PUBLISH_ID") | |
| 78 | 66 | private Integer publishId; |
| 79 | 67 | /** |
| 80 | 68 | * 1:有效,2:无效 |
| 81 | - * <p> | |
| 82 | - * {@link ValidityEnum#VALIDITY} OR {@link ValidityEnum#UNVALIDITY} | |
| 83 | 69 | */ |
| 84 | - @TableField(value = "YN") | |
| 85 | - private Integer yn = ValidityEnum.VALIDITY.getValidity(); | |
| 70 | + @TableField(value="IFDEL") | |
| 71 | + private Integer ifdel; | |
| 86 | 72 | /** |
| 87 | 73 | * 1:启用,2:停用 |
| 88 | - * <p> | |
| 89 | - * {@link StatusEnum#ENABLED} OR {@link StatusEnum#DISENABLED} | |
| 90 | 74 | */ |
| 91 | - @TableField(value = "ENABLE") | |
| 92 | - private Integer enable = StatusEnum.ENABLED.getStatus(); | |
| 75 | + @TableField(value="ENABLE") | |
| 76 | + private Integer enable; | |
| 93 | 77 | /** |
| 94 | 78 | * 最后修改时间 |
| 95 | 79 | */ |
| 96 | - @TableField(value = "MODIFIED") | |
| 80 | + @TableField(value="MODIFIED") | |
| 97 | 81 | private Date modified; |
| 98 | 82 | /** |
| 99 | 83 | * 创建时间 |
| 100 | 84 | */ |
| 101 | - @TableField(value = "CREATED") | |
| 85 | + @TableField(value="CREATED") | |
| 102 | 86 | private Date created; |
| 103 | 87 | /** |
| 104 | 88 | * 备注 |
| 105 | 89 | */ |
| 106 | - @TableField(value = "REMARKS") | |
| 90 | + @TableField(value="REMARKS") | |
| 107 | 91 | private String remarks; |
| 108 | 92 | /** |
| 109 | 93 | * 最后登录时间 |
| 110 | 94 | */ |
| 111 | - @TableField(value = "LAST_LOGIN_TIME") | |
| 95 | + @TableField(value="LAST_LOGIN_TIME") | |
| 112 | 96 | private Date lastLoginTime; |
| 113 | 97 | /** |
| 114 | 98 | * 导入数据的源id |
| 115 | 99 | */ |
| 116 | - @TableField(value = "FOREIGN_ID") | |
| 100 | + @TableField(value="FOREIGN_ID") | |
| 117 | 101 | private String foreignId; |
| 118 | 102 | /** |
| 119 | 103 | * 医院的帐号 |
| 120 | 104 | */ |
| 121 | - @TableField(value = "OTHER_ACCOUNT") | |
| 105 | + @TableField(value="OTHER_ACCOUNT") | |
| 122 | 106 | private String otherAccount; |
| 123 | 107 | /** |
| 124 | 108 | * |
| 125 | 109 | */ |
| 126 | - @TableField(value = "EMPLOYEE_ID") | |
| 110 | + @TableField(value="EMPLOYEE_ID") | |
| 127 | 111 | private String employeeId; |
| 128 | 112 | /** |
| 129 | 113 | * |
| 130 | 114 | */ |
| 131 | - @TableField(value = "EXPIR_TIME") | |
| 115 | + @TableField(value="EXPIR_TIME") | |
| 132 | 116 | private Date expirTime; |
| 133 | 117 | /** |
| 134 | 118 | * |
| 135 | 119 | */ |
| 136 | - @TableField(value = "LEVEL") | |
| 120 | + @TableField(value="LEVEL") | |
| 137 | 121 | private Integer level; |
| 138 | 122 | /** |
| 139 | 123 | * |
| 140 | 124 | */ |
| 141 | - @TableField(value = "AVATAR") | |
| 125 | + @TableField(value="AVATAR") | |
| 142 | 126 | private String avatar; |
| 143 | 127 | /** |
| 144 | 128 | * |
| 145 | 129 | */ |
| 146 | - @TableField(value = "WORK_TIME") | |
| 130 | + @TableField(value="WORK_TIME") | |
| 147 | 131 | private String workTime; |
| 148 | 132 | /** |
| 149 | 133 | * |
| 150 | 134 | */ |
| 151 | - @TableField(value = "GOOD_AT") | |
| 135 | + @TableField(value="GOOD_AT") | |
| 152 | 136 | private String goodAt; |
| 153 | 137 | |
| 138 | + | |
| 154 | 139 | public String getId() { |
| 155 | 140 | return id; |
| 156 | 141 | } |
| 157 | 142 | |
| ... | ... | @@ -223,12 +208,12 @@ |
| 223 | 208 | this.publishId = publishId; |
| 224 | 209 | } |
| 225 | 210 | |
| 226 | - public Integer getYn() { | |
| 227 | - return yn; | |
| 211 | + public Integer getIfdel() { | |
| 212 | + return ifdel; | |
| 228 | 213 | } |
| 229 | 214 | |
| 230 | - public void setYn(Integer yn) { | |
| 231 | - this.yn = yn; | |
| 215 | + public void setIfdel(Integer ifdel) { | |
| 216 | + this.ifdel = ifdel; | |
| 232 | 217 | } |
| 233 | 218 | |
| 234 | 219 | public Integer getEnable() { |
| ... | ... | @@ -333,10 +318,6 @@ |
| 333 | 318 | |
| 334 | 319 | public void setGoodAt(String goodAt) { |
| 335 | 320 | this.goodAt = goodAt; |
| 336 | - } | |
| 337 | - | |
| 338 | - public boolean isEnabled() { | |
| 339 | - return StatusEnum.isEnabled(this.getEnable()); | |
| 340 | 321 | } |
| 341 | 322 | |
| 342 | 323 | } |
center.manager/src/main/java/com/lyms/cm/service/sys/SysRolesService.java
View file @
98f4a66
| 1 | 1 | package com.lyms.cm.service.sys; |
| 2 | 2 | |
| 3 | 3 | import com.lyms.cm.entity.sys.SysRoles; |
| 4 | -import com.lyms.exception.SystemException; | |
| 5 | 4 | import com.lyms.web.service.BaseService; |
| 5 | +import java.io.Serializable; | |
| 6 | 6 | |
| 7 | 7 | /** |
| 8 | 8 | * <p> |
| 9 | - * 角色服务类 | |
| 9 | + * 服务类 | |
| 10 | 10 | * </p> |
| 11 | 11 | * |
| 12 | 12 | * @author maliang |
| 13 | - * @since 2017-03-02 | |
| 13 | + * @since 2017-03-07 | |
| 14 | 14 | */ |
| 15 | 15 | public interface SysRolesService extends BaseService<SysRoles> { |
| 16 | 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 | - * @param roleId | |
| 39 | - * @return | |
| 40 | - * @throws SystemException | |
| 41 | - */ | |
| 42 | - public boolean deleteRole(String roleId) throws SystemException; | |
| 43 | - | |
| 44 | - /** | |
| 45 | - * 分页获取角色信息 | |
| 46 | - * <p> | |
| 47 | - * 目前没有参数设置,过滤 | |
| 48 | - * | |
| 49 | - * @param page | |
| 50 | - * @return | |
| 51 | - */ | |
| 52 | - // public Page<SysRoles> getRolesByPage(Page<SysRoles> page) throws | |
| 53 | - // SystemException; | |
| 54 | - | |
| 55 | - /** | |
| 56 | - * 根据roleId 获取角色信息 | |
| 57 | - * | |
| 58 | - * @param roleId | |
| 59 | - * @return | |
| 60 | - * @throws SystemException | |
| 61 | - */ | |
| 62 | - // public SysRoles getRoleById(String roleId) throws SystemException; | |
| 63 | - | |
| 64 | - /** | |
| 65 | - * 禁/启用角色 | |
| 66 | - * | |
| 67 | - * @param roleId | |
| 68 | - * @return | |
| 69 | - * @throws SystemException | |
| 70 | - */ | |
| 71 | - public boolean enable(String roleId) throws SystemException; | |
| 17 | + /** | |
| 18 | + * <li>@Description:逻辑删除,ifDel = 1 为删除,否则为没有删除 | |
| 19 | + * <li>@param id 删除主键id | |
| 20 | + * <li>@return 大于0修改成功,否则为失败 | |
| 21 | + */ | |
| 22 | + public Integer deleteLogicById(Serializable id); | |
| 72 | 23 | |
| 73 | 24 | } |
center.manager/src/main/java/com/lyms/cm/service/sys/SysUserRoleMapsService.java
View file @
98f4a66
| 1 | +package com.lyms.cm.service.sys; | |
| 2 | + | |
| 3 | +import com.lyms.cm.entity.sys.SysUserRoleMaps; | |
| 4 | +import com.lyms.web.service.BaseService; | |
| 5 | +import java.io.Serializable; | |
| 6 | + | |
| 7 | +/** | |
| 8 | + * <p> | |
| 9 | + * 服务类 | |
| 10 | + * </p> | |
| 11 | + * | |
| 12 | + * @author fangcheng | |
| 13 | + * @since 2017-03-07 | |
| 14 | + */ | |
| 15 | +public interface SysUserRoleMapsService extends BaseService<SysUserRoleMaps> { | |
| 16 | + | |
| 17 | + /** | |
| 18 | + * <li>@Description:逻辑删除,ifDel = 1 为删除,否则为没有删除 | |
| 19 | + * <li>@param id 删除主键id | |
| 20 | + * <li>@return 大于0修改成功,否则为失败 | |
| 21 | + */ | |
| 22 | + public Integer deleteLogicById(Serializable id); | |
| 23 | + | |
| 24 | +} |
center.manager/src/main/java/com/lyms/cm/service/sys/SysUsersService.java
View file @
98f4a66
| 1 | 1 | package com.lyms.cm.service.sys; |
| 2 | 2 | |
| 3 | +import java.io.Serializable; | |
| 4 | + | |
| 3 | 5 | import com.lyms.cm.entity.sys.SysUsers; |
| 4 | 6 | import com.lyms.exception.SystemException; |
| 5 | 7 | import com.lyms.web.service.BaseService; |
| 6 | 8 | |
| 7 | 9 | |
| 8 | 10 | |
| 9 | 11 | |
| ... | ... | @@ -14,53 +16,60 @@ |
| 14 | 16 | */ |
| 15 | 17 | public interface SysUsersService extends BaseService<SysUsers> { |
| 16 | 18 | |
| 17 | - /** | |
| 18 | - * 添加用户 | |
| 19 | - * | |
| 20 | - * @param user | |
| 21 | - * @return | |
| 22 | - * @author maliang | |
| 23 | - */ | |
| 24 | - public boolean addUser(SysUsers user) throws SystemException; | |
| 19 | + /** | |
| 20 | + * 添加用户 | |
| 21 | + * | |
| 22 | + * @param user | |
| 23 | + * @return | |
| 24 | + * @author maliang | |
| 25 | + */ | |
| 26 | + public boolean addUser(SysUsers user) throws SystemException; | |
| 25 | 27 | |
| 26 | - /** | |
| 27 | - * 修改用户信息 | |
| 28 | - * | |
| 29 | - * @param user | |
| 30 | - * @return | |
| 31 | - * @author maliang | |
| 32 | - */ | |
| 33 | - public boolean updateUser(SysUsers user) throws SystemException; | |
| 28 | + /** | |
| 29 | + * 修改用户信息 | |
| 30 | + * | |
| 31 | + * @param user | |
| 32 | + * @return | |
| 33 | + * @author maliang | |
| 34 | + */ | |
| 35 | + public boolean updateUser(SysUsers user) throws SystemException; | |
| 34 | 36 | |
| 35 | - /** | |
| 36 | - * 根据ID获取用户信息 | |
| 37 | - * | |
| 38 | - * @param userId | |
| 39 | - * @return | |
| 40 | - * @author maliang | |
| 41 | - */ | |
| 42 | - // public SysUsers getUserById(String userId) throws SystemException; | |
| 37 | + /** | |
| 38 | + * 根据ID获取用户信息 | |
| 39 | + * | |
| 40 | + * @param userId | |
| 41 | + * @return | |
| 42 | + * @author maliang | |
| 43 | + */ | |
| 44 | + // public SysUsers getUserById(String userId) throws SystemException; | |
| 43 | 45 | |
| 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; | |
| 46 | + /** | |
| 47 | + * 启用/停用 | |
| 48 | + * <p> | |
| 49 | + * 根据用户ID操作 | |
| 50 | + * <p> | |
| 51 | + * | |
| 52 | + * @param userId | |
| 53 | + * @return | |
| 54 | + * @author maliang | |
| 55 | + */ | |
| 56 | + public boolean enabled(String userId) throws SystemException; | |
| 55 | 57 | |
| 56 | - /** | |
| 57 | - * 删除用户信息 | |
| 58 | - * | |
| 59 | - * @param userId | |
| 60 | - * @return | |
| 61 | - * @throws SystemException | |
| 62 | - */ | |
| 63 | - public boolean delete(String userId) throws SystemException; | |
| 58 | + /** | |
| 59 | + * 删除用户信息 | |
| 60 | + * | |
| 61 | + * @param userId | |
| 62 | + * @return | |
| 63 | + * @throws SystemException | |
| 64 | + */ | |
| 65 | + public boolean delete(String userId) throws SystemException; | |
| 66 | + | |
| 67 | + /** | |
| 68 | + * <li>@Description:逻辑删除,ifDel = 1 为删除,否则为没有删除 | |
| 69 | + * <li>@param id 删除主键id | |
| 70 | + * <li>@return 大于0修改成功,否则为失败 | |
| 71 | + */ | |
| 72 | + public Integer deleteLogicById(Serializable id); | |
| 64 | 73 | |
| 65 | 74 | } |
center.manager/src/main/java/com/lyms/cm/service/sys/impl/SysRolesServiceImpl.java
View file @
98f4a66
| 1 | 1 | package com.lyms.cm.service.sys.impl; |
| 2 | 2 | |
| 3 | -import org.apache.commons.lang3.StringUtils; | |
| 4 | -import org.springframework.beans.factory.annotation.Autowired; | |
| 5 | -import org.springframework.stereotype.Service; | |
| 6 | -import org.springframework.transaction.annotation.Transactional; | |
| 7 | - | |
| 8 | -import com.baomidou.mybatisplus.service.impl.ServiceImpl; | |
| 9 | -import com.lyms.cm.dao.sys.SysRolesMapper; | |
| 10 | 3 | import com.lyms.cm.entity.sys.SysRoles; |
| 11 | -import com.lyms.cm.enums.StatusEnum; | |
| 12 | -import com.lyms.cm.enums.ValidityEnum; | |
| 4 | +import com.lyms.cm.dao.sys.SysRolesMapper; | |
| 13 | 5 | import com.lyms.cm.service.sys.SysRolesService; |
| 14 | -import com.lyms.exception.SystemException; | |
| 6 | +import com.baomidou.mybatisplus.service.impl.ServiceImpl; | |
| 7 | +import org.springframework.stereotype.Service; | |
| 8 | +import java.io.Serializable; | |
| 15 | 9 | |
| 16 | 10 | /** |
| 17 | 11 | * <p> |
| 18 | - * 角色表 服务实现类 | |
| 12 | + * 角色表 服务实现类 | |
| 19 | 13 | * </p> |
| 20 | 14 | * |
| 21 | 15 | * @author maliang |
| 22 | - * @since 2017-03-02 | |
| 16 | + * @since 2017-03-07 | |
| 23 | 17 | */ |
| 24 | 18 | @Service |
| 25 | 19 | public class SysRolesServiceImpl extends ServiceImpl<SysRolesMapper, SysRoles> implements SysRolesService { |
| 26 | - | |
| 27 | - @Autowired | |
| 28 | - private SysRolesMapper roleMapper; | |
| 29 | - | |
| 30 | - /** | |
| 31 | - * 实体空判断 | |
| 32 | - * | |
| 33 | - * @param role | |
| 34 | - * @return | |
| 35 | - */ | |
| 36 | - private boolean empty(SysRoles role) { | |
| 37 | - return role == null; | |
| 20 | + | |
| 21 | + public Integer deleteLogicById(Serializable id){ | |
| 22 | + return baseMapper.deleteLogicById(id); | |
| 38 | 23 | } |
| 39 | - | |
| 40 | - @Transactional | |
| 41 | - @Override | |
| 42 | - public boolean addRole(SysRoles role) throws SystemException { | |
| 43 | - if (empty(role)) | |
| 44 | - return false; | |
| 45 | - Integer tag = roleMapper.insert(role); | |
| 46 | - return tag != null && tag >= 1; | |
| 47 | - } | |
| 48 | - | |
| 49 | - @Override | |
| 50 | - @Transactional | |
| 51 | - public boolean updateRole(SysRoles role) throws SystemException { | |
| 52 | - if (empty(role)) | |
| 53 | - return false; | |
| 54 | - Integer tag = roleMapper.updateById(role); | |
| 55 | - return tag != null && tag >= 1; | |
| 56 | - } | |
| 57 | - | |
| 58 | - @Override | |
| 59 | - @Transactional | |
| 60 | - public boolean deleteRole(String roleId) throws SystemException { | |
| 61 | - if (StringUtils.isBlank(roleId)) | |
| 62 | - return false; | |
| 63 | - // 并非真实删除,通过字段属性控制 | |
| 64 | - // TODO 通过sql 修改 | |
| 65 | - SysRoles role = roleMapper.selectById(roleId); | |
| 66 | - if (role != null) { | |
| 67 | - Integer yn = role.getYn(); | |
| 68 | - if (yn == null || yn == ValidityEnum.VALIDITY.getValidity()) { | |
| 69 | - yn = ValidityEnum.UNVALIDITY.getValidity(); | |
| 70 | - } else { | |
| 71 | - yn = ValidityEnum.VALIDITY.getValidity(); | |
| 72 | - } | |
| 73 | - role.setYn(yn); | |
| 74 | - Integer tag = roleMapper.updateById(role); | |
| 75 | - return tag != null && tag >= 1; | |
| 76 | - } | |
| 77 | - return false; | |
| 78 | - } | |
| 79 | - | |
| 80 | - /* | |
| 81 | - * @Override public Page<SysRoles> getRolesByPage(Page<SysRoles> page) | |
| 82 | - * throws SystemException { | |
| 83 | - * | |
| 84 | - * if (page == null) return null; | |
| 85 | - * | |
| 86 | - * // TODO 添加参数过滤 List<SysRoles> roles = roleMapper.selectPage(page, null); | |
| 87 | - * page.setRecords(roles); | |
| 88 | - * | |
| 89 | - * return page; } | |
| 90 | - * | |
| 91 | - * @Override public SysRoles getRoleById(String roleId) throws | |
| 92 | - * SystemException { if (StringUtils.isBlank(roleId)) return null; return | |
| 93 | - * roleMapper.selectById(roleId); } | |
| 94 | - */ | |
| 95 | - | |
| 96 | - @Transactional | |
| 97 | - @Override | |
| 98 | - public boolean enable(String roleId) throws SystemException { | |
| 99 | - | |
| 100 | - SysRoles role = this.selectById(roleId); | |
| 101 | - | |
| 102 | - if (empty(role)) | |
| 103 | - return false; | |
| 104 | - | |
| 105 | - // 判断当前用户的启用,禁用情况 | |
| 106 | - // TODO 拆分成SQL执行,两种操作 | |
| 107 | - if (role.isEnabled()) { | |
| 108 | - role.setEnable(StatusEnum.DISENABLED.getStatus()); | |
| 109 | - } else { | |
| 110 | - role.setEnable(StatusEnum.ENABLED.getStatus()); | |
| 111 | - } | |
| 112 | - | |
| 113 | - return false; | |
| 114 | - } | |
| 115 | - | |
| 116 | 24 | } |
center.manager/src/main/java/com/lyms/cm/service/sys/impl/SysUserRoleMapsServiceImpl.java
View file @
98f4a66
| 1 | +package com.lyms.cm.service.sys.impl; | |
| 2 | + | |
| 3 | +import com.lyms.cm.entity.sys.SysUserRoleMaps; | |
| 4 | +import com.lyms.cm.dao.sys.SysUserRoleMapsMapper; | |
| 5 | +import com.lyms.cm.service.sys.SysUserRoleMapsService; | |
| 6 | +import com.baomidou.mybatisplus.service.impl.ServiceImpl; | |
| 7 | +import org.springframework.stereotype.Service; | |
| 8 | +import java.io.Serializable; | |
| 9 | + | |
| 10 | +/** | |
| 11 | + * <p> | |
| 12 | + * 用户角色关系表 服务实现类 | |
| 13 | + * </p> | |
| 14 | + * | |
| 15 | + * @author fangcheng | |
| 16 | + * @since 2017-03-07 | |
| 17 | + */ | |
| 18 | +@Service | |
| 19 | +public class SysUserRoleMapsServiceImpl extends ServiceImpl<SysUserRoleMapsMapper, SysUserRoleMaps> implements SysUserRoleMapsService { | |
| 20 | + | |
| 21 | + public Integer deleteLogicById(Serializable id){ | |
| 22 | + return baseMapper.deleteLogicById(id); | |
| 23 | + } | |
| 24 | +} |
center.manager/src/main/java/com/lyms/cm/service/sys/impl/SysUsersServiceImpl.java
View file @
98f4a66
| 1 | 1 | package com.lyms.cm.service.sys.impl; |
| 2 | 2 | |
| 3 | +import java.io.Serializable; | |
| 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; |
| ... | ... | @@ -60,6 +62,7 @@ |
| 60 | 62 | return false; |
| 61 | 63 | // 设置user ID |
| 62 | 64 | user.setId(StrUtils.uuid()); |
| 65 | + user.setIfdel(0); | |
| 63 | 66 | // 设置用户密码 |
| 64 | 67 | this.initPwd(user); |
| 65 | 68 | |
| ... | ... | @@ -95,7 +98,7 @@ |
| 95 | 98 | return false; |
| 96 | 99 | |
| 97 | 100 | // 判断当前用户的启用,禁用情况 |
| 98 | - if (user.isEnabled()) { | |
| 101 | + if (StatusEnum.isEnabled(user.getEnable())) { | |
| 99 | 102 | user.setEnable(StatusEnum.DISENABLED.getStatus()); |
| 100 | 103 | } else { |
| 101 | 104 | user.setEnable(StatusEnum.ENABLED.getStatus()); |
| 102 | 105 | |
| 103 | 106 | |
| 104 | 107 | |
| ... | ... | @@ -112,18 +115,23 @@ |
| 112 | 115 | // TODO 通过sql 修改 |
| 113 | 116 | SysUsers user = userMapper.selectById(userId); |
| 114 | 117 | if (user != null) { |
| 115 | - Integer yn = user.getYn(); | |
| 116 | - if (yn == null || yn == ValidityEnum.VALIDITY.getValidity()) { | |
| 117 | - yn = ValidityEnum.UNVALIDITY.getValidity(); | |
| 118 | + Integer ifDel = user.getIfdel() ; | |
| 119 | + if (ifDel == null || ifDel == ValidityEnum.VALIDITY.getValidity()) { | |
| 120 | + ifDel = ValidityEnum.UNVALIDITY.getValidity(); | |
| 118 | 121 | } else { |
| 119 | - yn = ValidityEnum.VALIDITY.getValidity(); | |
| 122 | + ifDel = ValidityEnum.VALIDITY.getValidity(); | |
| 120 | 123 | } |
| 121 | - user.setYn(yn); | |
| 124 | + user.setIfdel(ifDel); | |
| 122 | 125 | Integer tag = userMapper.updateById(user); |
| 123 | 126 | return tag != null && tag >= 1; |
| 124 | 127 | } |
| 125 | 128 | return false; |
| 126 | 129 | } |
| 130 | + | |
| 131 | + @Override | |
| 132 | + public Integer deleteLogicById(Serializable id) { | |
| 133 | + return baseMapper.deleteLogicById(id); | |
| 134 | + } | |
| 127 | 135 | |
| 128 | 136 | } |
center.manager/src/main/resources/xml/app-datasource.xml
View file @
98f4a66
| ... | ... | @@ -62,8 +62,16 @@ |
| 62 | 62 | </map> |
| 63 | 63 | </property> |
| 64 | 64 | </bean> |
| 65 | + <!-- 自定义注入器 --> | |
| 66 | + <bean id="deleteLogicByIdSqlInjector" class="com.lyms.mybatis.DeleteLogicByIdSqlInjector" /> | |
| 67 | + <!-- 注入配置 --> | |
| 68 | + <bean id="globalConfig" class="com.baomidou.mybatisplus.entity.GlobalConfiguration"> | |
| 69 | + <property name="sqlInjector" ref="deleteLogicByIdSqlInjector" /> | |
| 70 | + </bean> | |
| 65 | 71 | |
| 66 | 72 | <bean id="sqlSessionFactory" class="com.baomidou.mybatisplus.spring.MybatisSqlSessionFactoryBean"> |
| 73 | + <!-- 自定义注入 deleteByIdForYn 方法 --> | |
| 74 | + <property name="globalConfig" ref="globalConfig" /> | |
| 67 | 75 | <property name="dataSource" ref="dynamicDataSource" /> |
| 68 | 76 | <property name="plugins"> |
| 69 | 77 | <array> |
| ... | ... | @@ -82,7 +90,7 @@ |
| 82 | 90 | </property> |
| 83 | 91 | <property name="typeAliasesPackage" value="com.lyms.cm.entity" /> |
| 84 | 92 | </bean> |
| 85 | - | |
| 93 | + | |
| 86 | 94 | <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer"> |
| 87 | 95 | <!-- 可以指定多个包名 以逗号或分号分隔 --> |
| 88 | 96 | <property name="basePackage" value="com.lyms.cm.dao" /> |
center.manager/src/main/webapp/WEB-INF/views/common/base.html
View file @
98f4a66
| ... | ... | @@ -12,6 +12,7 @@ |
| 12 | 12 | <link href="${ctx}/static/css/bootstrap.min14ed.css" rel="stylesheet"/> |
| 13 | 13 | <link href="${ctx}/static/css/font-awesome.min93e3.css" rel="stylesheet"/> |
| 14 | 14 | <link href="${ctx}/static/css/animate.min.css" rel="stylesheet"/> |
| 15 | + <link href="${ctx}/static/css/plugins/iCheck/custom.css" rel="stylesheet"> | |
| 15 | 16 | <link href="${ctx}/static/css/style.min.css" rel="stylesheet"/> |
| 16 | 17 | <link href="${ctx}/static/css/extends.style.css" rel="stylesheet"/> |
| 17 | 18 | #block("css")#end |
| 18 | 19 | |
| ... | ... | @@ -22,7 +23,11 @@ |
| 22 | 23 | </head> |
| 23 | 24 | #block("body")#end |
| 24 | 25 | <script src="${ctx}/static/js/jquery.min.js"></script> |
| 26 | +<script src="${ctx}/static/js/plugins/iCheck/icheck.min.js"></script> | |
| 25 | 27 | <script src="${ctx}/static/js/bootstrap.min.js"/></script> |
| 28 | +<script type="text/javascript"> | |
| 29 | +$(document).ready(function(){$(".i-checks").iCheck({checkboxClass:"icheckbox_square-green",radioClass:"iradio_square-green",})}); | |
| 30 | +</script> | |
| 26 | 31 | #block("js")#end |
| 27 | 32 | </html> |
center.manager/src/main/webapp/WEB-INF/views/common/base_list.html
View file @
98f4a66
| ... | ... | @@ -10,6 +10,7 @@ |
| 10 | 10 | <link href="${ctx}/static/css/font-awesome.min93e3.css" rel="stylesheet"> |
| 11 | 11 | <link href="${ctx}/static/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet"> |
| 12 | 12 | <link href="${ctx}/static/css/animate.min.css" rel="stylesheet"> |
| 13 | + <link href="${ctx}/static/css/plugins/iCheck/custom.css" rel="stylesheet"> | |
| 13 | 14 | <link href="${ctx}/static/css/style.min862f.css" rel="stylesheet"> |
| 14 | 15 | <link href="${ctx}/static/css/extends.style.css" rel="stylesheet"/> |
| 15 | 16 | #block("css")#end |
| 16 | 17 | |
| ... | ... | @@ -29,9 +30,13 @@ |
| 29 | 30 | <script src="${ctx}/static/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script> |
| 30 | 31 | <script src="${ctx}/static/js/plugins/jquery-validation/dist/jquery.validate.min.js"></script> |
| 31 | 32 | <script src="${ctx}/static/js/plugins/jquery-validation/dist/localization/messages_zh.min.js"></script> |
| 33 | +<script src="${ctx}/static/js/plugins/iCheck/icheck.min.js"></script> | |
| 32 | 34 | #block("js")#end |
| 33 | 35 | <script src="${ctx}/static/js/base/base_table_init.js"></script> |
| 34 | 36 | <script src="${ctx}/static/js/base/common.js"></script> |
| 37 | +<script type="text/javascript"> | |
| 38 | +$(document).ready(function(){$(".i-checks").iCheck({checkboxClass:"icheckbox_square-green",radioClass:"iradio_square-green",})}); | |
| 39 | +</script> | |
| 35 | 40 | </body> |
| 36 | 41 | </html> |
center.manager/src/main/webapp/WEB-INF/views/role/role_edit.html
View file @
98f4a66
| 1 | +#override("body") | |
| 2 | +<div class="ibox float-e-margins"> | |
| 3 | + <div class="ibox-content"> | |
| 4 | + <form id="validForm" class="form-horizontal m-t" novalidate="novalidate"> | |
| 5 | + <input type="hidden" id="role.id" name="id" value="$!role.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="$!role.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="text" placeholder="角色备注" value="$!role.remarks" aria-required="true" required="true" class="form-control" minlength="2" name="remarks" id="remarks"> | |
| 16 | + </div> | |
| 17 | + </div> | |
| 18 | + <div class="form-group"> | |
| 19 | + <label class="col-sm-3 control-label">角色简码:</label> | |
| 20 | + <div class="col-sm-8"> | |
| 21 | + <input type="text" placeholder="角色简码" value="$!role.shortCode" aria-required="true" required="true" class="form-control" minlength="2" name="shortCode" id="shortCode"> | |
| 22 | + </div> | |
| 23 | + </div> | |
| 24 | + <div class="form-group"> | |
| 25 | + <label class="col-sm-3 control-label">所属机构:</label> | |
| 26 | + <div class="col-sm-8"> | |
| 27 | + <input type="text" placeholder="所属机构" value="$!role.orgId" aria-required="true" required="true" class="form-control" minlength="2" name="orgId" id="orgId"> | |
| 28 | + </div> | |
| 29 | + </div> | |
| 30 | + <div class="form-group"> | |
| 31 | + <div class="col-sm-8"> | |
| 32 | + <label class="checkbox-inline i-checks"> | |
| 33 | + <div class="icheckbox_square-green" style="position: relative;"> | |
| 34 | + <input type="checkbox" value="option1" | |
| 35 | + style="position: absolute; opacity: 0;"> | |
| 36 | + <ins class="iCheck-helper" | |
| 37 | + 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> | |
| 38 | + </div>是否可用 | |
| 39 | + </label> | |
| 40 | + </div> | |
| 41 | + </div> | |
| 42 | + <div class="hr-line-dashed"></div> | |
| 43 | + <div class="form-group"> | |
| 44 | + <div class="col-sm-4 col-sm-offset-3 pull-right"> | |
| 45 | + <button type="button" class="btn btn-primary" onclick="save();"><i class="fa fa-check"></i> 提交</button> | |
| 46 | + <button type="button" class="btn btn-white" onclick="parent.closeAll();"><i class="fa fa-close"></i> 取消</button> | |
| 47 | + </div> | |
| 48 | + </div> | |
| 49 | + </form> | |
| 50 | + </div> | |
| 51 | +</div> | |
| 52 | +<script type="text/javascript"> | |
| 53 | + var controllerRequestMappint = "/sysRoles/"; | |
| 54 | + function save(){ | |
| 55 | + if($('#validForm').valid()){ | |
| 56 | + var data = $('#validForm').serialize(); | |
| 57 | + data = data + "&" + $('#roleForm').serialize(); | |
| 58 | + if("$!role.id" == ""){ | |
| 59 | + ajaxPost(APP.PATH + controllerRequestMappint + "create",data); | |
| 60 | + }else{ | |
| 61 | + ajaxPost(APP.PATH + controllerRequestMappint + "update",data); | |
| 62 | + } | |
| 63 | + parent.reloadGrid('dataTable'); | |
| 64 | + } | |
| 65 | + } | |
| 66 | +</script> | |
| 67 | +#end | |
| 68 | +#extends("/common/base_list.html") |
center.manager/src/main/webapp/WEB-INF/views/role/role_list.html
View file @
98f4a66
| ... | ... | @@ -22,9 +22,9 @@ |
| 22 | 22 | <div class="row"> |
| 23 | 23 | <div class="col-sm-12"> |
| 24 | 24 | <div id="toolbar"> |
| 25 | - <button class="btn btn-info " type="button"><i class="fa fa-plus"></i> 新增</button> | |
| 26 | - <button class="btn btn-info " type="button"><i class="fa fa-paste"></i> 编辑</button> | |
| 27 | - <button class="btn btn-info " type="button"><i class="fa fa-trash"></i> 删除</button> | |
| 25 | + <button class="btn btn-info " type="button" onclick="add();"><i class="fa fa-plus"></i> 新增</button> | |
| 26 | + <button class="btn btn-info " type="button" onclick="edit();"><i class="fa fa-paste"></i> 编辑</button> | |
| 27 | + <button class="btn btn-info " type="button" onclick="del();"><i class="fa fa-trash"></i> 删除</button> | |
| 28 | 28 | </div> |
| 29 | 29 | <table id="dataTable"></table> |
| 30 | 30 | </div> |
| 31 | 31 | |
| ... | ... | @@ -33,9 +33,25 @@ |
| 33 | 33 | #end |
| 34 | 34 | #override("js") |
| 35 | 35 | <script type="text/javascript"> |
| 36 | +var controllerRequestMappint = "/sysRoles/"; | |
| 37 | + | |
| 38 | +function add() { | |
| 39 | + popWindow("新增角色", APP.PATH + controllerRequestMappint + "0/toEdit",700,550); | |
| 40 | +} | |
| 41 | + | |
| 42 | +function edit(){ | |
| 43 | + var id = getSingleSelectedValue("dataTable","id"); | |
| 44 | + if(id){ | |
| 45 | + popWindow("修改橘色", APP.PATH + controllerRequestMappint + id + "/toEdit",700,550); | |
| 46 | + } | |
| 47 | +} | |
| 48 | + | |
| 49 | +function del(){ | |
| 50 | + goDelete("dataTable","id", APP.PATH + controllerRequestMappint + "@value@/delete"); | |
| 51 | +} | |
| 36 | 52 | ## 参考 base_table_init.js 或者根据empty_bootstrap_table_init.js 来自己创建特殊的table |
| 37 | 53 | ## 注意:自己创建的特殊的table不能extends base_list.html |
| 38 | -var default_dataUrl = "${ctx}/sysRoles/getRoleList"; | |
| 54 | +var default_dataUrl = "${ctx}" + controllerRequestMappint + "getRoleList"; | |
| 39 | 55 | var default_dataColumns = [{ |
| 40 | 56 | field: 'check_state', |
| 41 | 57 | title: '', |
| 42 | 58 | |
| ... | ... | @@ -47,11 +63,20 @@ |
| 47 | 63 | field: 'name', |
| 48 | 64 | title: '角色名' |
| 49 | 65 | }, { |
| 50 | - field: 'description', | |
| 51 | - title: '描述' | |
| 66 | + field: 'type', | |
| 67 | + title: '角色类型' | |
| 68 | + }, { | |
| 69 | + field: 'remarks', | |
| 70 | + title: '备注' | |
| 52 | 71 | },{ |
| 53 | - field: 'resources', | |
| 54 | - title: '资源列表' | |
| 72 | + field: 'orgId', | |
| 73 | + title: '机构id' | |
| 74 | + },{ | |
| 75 | + field: 'publishId', | |
| 76 | + title: '发布人id' | |
| 77 | + },{ | |
| 78 | + field: 'enable', | |
| 79 | + title: '启用状态' | |
| 55 | 80 | }]; |
| 56 | 81 | </script> |
| 57 | 82 | #end |
center.manager/src/main/webapp/WEB-INF/views/user/user_edit.html
View file @
98f4a66
center.manager/src/main/webapp/WEB-INF/views/user/user_list.html
View file @
98f4a66
| ... | ... | @@ -33,23 +33,25 @@ |
| 33 | 33 | #end |
| 34 | 34 | #override("js") |
| 35 | 35 | <script type="text/javascript"> |
| 36 | +var controllerRequestMappint = "/sysUsers/"; | |
| 37 | + | |
| 36 | 38 | function add() { |
| 37 | - popWindow("新增用户", APP.PATH + "/user/0/toEdit",700,400); | |
| 39 | + popWindow("新增角色", APP.PATH + controllerRequestMappint + "0/toEdit",700,550); | |
| 38 | 40 | } |
| 39 | 41 | |
| 40 | 42 | function edit(){ |
| 41 | 43 | var id = getSingleSelectedValue("dataTable","id"); |
| 42 | 44 | if(id){ |
| 43 | - popWindow("修改用户", APP.PATH+"/sysUsers/" + id + "/toEdit",700,400); | |
| 45 | + popWindow("修改橘色", APP.PATH + controllerRequestMappint + id + "/toEdit",700,550); | |
| 44 | 46 | } |
| 45 | 47 | } |
| 46 | 48 | |
| 47 | 49 | function del(){ |
| 48 | - goDelete("dataTable","id", APP.PATH + "/sysUsers/@value@/delete"); | |
| 50 | + goDelete("dataTable","id", APP.PATH + controllerRequestMappint + "@value@/delete"); | |
| 49 | 51 | } |
| 50 | 52 | ## 参考 base_table_init.js 或者根据empty_bootstrap_table_init.js 来自己创建特殊的table |
| 51 | 53 | ## 注意:自己创建的特殊的table不能extends base_list.html |
| 52 | -var default_dataUrl = APP.PATH + "/sysUsers/list"; | |
| 54 | +var default_dataUrl = APP.PATH + controllerRequestMappint + "list"; | |
| 53 | 55 | var default_dataColumns = [{ |
| 54 | 56 | field: 'check_state', |
| 55 | 57 | title: '', |
| ... | ... | @@ -79,8 +81,8 @@ |
| 79 | 81 | field: 'publishId', |
| 80 | 82 | title: '发布者' |
| 81 | 83 | },{ |
| 82 | - field: 'yn', | |
| 83 | - title: '状态' | |
| 84 | + field: 'ifDel', | |
| 85 | + title: '是否删除' | |
| 84 | 86 | },{ |
| 85 | 87 | field: 'enable', |
| 86 | 88 | title: '启/停用' |
core.sdk/src/main/java/com/lyms/mybatis/DeleteLogicByIdSqlInjector.java
View file @
98f4a66
| 1 | +package com.lyms.mybatis; | |
| 2 | + | |
| 3 | +import org.apache.ibatis.builder.MapperBuilderAssistant; | |
| 4 | +import org.apache.ibatis.mapping.SqlSource; | |
| 5 | +import org.apache.ibatis.session.Configuration; | |
| 6 | + | |
| 7 | +import com.baomidou.mybatisplus.entity.TableInfo; | |
| 8 | +import com.baomidou.mybatisplus.mapper.AutoSqlInjector; | |
| 9 | + | |
| 10 | +public class DeleteLogicByIdSqlInjector extends AutoSqlInjector { | |
| 11 | + | |
| 12 | + @Override | |
| 13 | + public void inject(Configuration configuration, MapperBuilderAssistant builderAssistant, Class<?> mapperClass, | |
| 14 | + Class<?> modelClass, TableInfo table) { | |
| 15 | + /* 添加一个自定义方法 */ | |
| 16 | + deleteLogicById(mapperClass, modelClass, table); | |
| 17 | + } | |
| 18 | + | |
| 19 | + /** | |
| 20 | + * <li>@Description:逻辑删除,(YN=1有效:没有删除)(YN=0无效:被删除) | |
| 21 | + * <li>@param mapperClass | |
| 22 | + * <li>@param modelClass | |
| 23 | + * <li>@param table | |
| 24 | + * <li>创建人:方承 | |
| 25 | + * <li>创建时间:2017年3月7日 | |
| 26 | + * <li>修改人: | |
| 27 | + * <li>修改时间: | |
| 28 | + */ | |
| 29 | + public void deleteLogicById(Class<?> mapperClass, Class<?> modelClass, TableInfo table) { | |
| 30 | + /* 执行 SQL ,动态 SQL 参考类 SqlMethod */ | |
| 31 | + | |
| 32 | + String sql = String.format("UPDATE %s SET ifdel=1 WHERE id=#{id}", table.getTableName()); | |
| 33 | + /* mapper 接口方法名一致 */ | |
| 34 | + String method = "deleteLogicById"; | |
| 35 | + SqlSource sqlSource = languageDriver.createSqlSource(configuration, sql, modelClass); | |
| 36 | + // 注意!! 这里是更新、删除、插入、调用方法注入不一样!! | |
| 37 | + this.addUpdateMappedStatement(mapperClass, modelClass, method, sqlSource); | |
| 38 | + | |
| 39 | + } | |
| 40 | + | |
| 41 | +} |
mybatis-plus/src/main/resources/template/entity.java.vm
View file @
98f4a66
| ... | ... | @@ -8,9 +8,7 @@ |
| 8 | 8 | #end |
| 9 | 9 | import com.baomidou.mybatisplus.annotations.TableId; |
| 10 | 10 | import com.baomidou.mybatisplus.annotations.TableField; |
| 11 | -#if(${addTabeName}) | |
| 12 | 11 | import com.baomidou.mybatisplus.annotations.TableName; |
| 13 | -#end | |
| 14 | 12 | import java.io.Serializable; |
| 15 | 13 | #if(${table.hasDate}) |
| 16 | 14 | import java.util.Date; |
mybatis-plus/src/main/resources/template/mapper.java.vm
View file @
98f4a66
| ... | ... | @@ -3,6 +3,7 @@ |
| 3 | 3 | import ${package.Entity}.${entity}; |
| 4 | 4 | import ${superMapperClassPackage}; |
| 5 | 5 | import org.springframework.stereotype.Repository; |
| 6 | +import java.io.Serializable; | |
| 6 | 7 | /** |
| 7 | 8 | * <p> |
| 8 | 9 | * Mapper接口 |
| ... | ... | @@ -13,6 +14,8 @@ |
| 13 | 14 | */ |
| 14 | 15 | @Repository |
| 15 | 16 | public interface ${table.mapperName} extends ${superMapperClass}<${entity}> { |
| 17 | + | |
| 18 | + public Integer deleteLogicById(Serializable id); | |
| 16 | 19 | |
| 17 | 20 | } |
mybatis-plus/src/main/resources/template/service.java.vm
View file @
98f4a66
| ... | ... | @@ -2,6 +2,7 @@ |
| 2 | 2 | |
| 3 | 3 | import ${package.Entity}.${entity}; |
| 4 | 4 | import ${superServiceClassPackage}; |
| 5 | +import java.io.Serializable; | |
| 5 | 6 | |
| 6 | 7 | /** |
| 7 | 8 | * <p> |
| ... | ... | @@ -12,6 +13,13 @@ |
| 12 | 13 | * @since ${date} |
| 13 | 14 | */ |
| 14 | 15 | public interface ${table.serviceName} extends ${superServiceClass}<${entity}> { |
| 16 | + | |
| 17 | + /** | |
| 18 | + * <li>@Description:逻辑删除,ifDel = 1 为删除,否则为没有删除 | |
| 19 | + * <li>@param id 删除主键id | |
| 20 | + * <li>@return 大于0修改成功,否则为失败 | |
| 21 | + */ | |
| 22 | + public Integer deleteLogicById(Serializable id); | |
| 15 | 23 | |
| 16 | 24 | } |
mybatis-plus/src/main/resources/template/serviceImpl.java.vm
View file @
98f4a66
| ... | ... | @@ -5,6 +5,7 @@ |
| 5 | 5 | import ${package.Service}.${table.serviceName}; |
| 6 | 6 | import ${superServiceImplClassPackage}; |
| 7 | 7 | import org.springframework.stereotype.Service; |
| 8 | +import java.io.Serializable; | |
| 8 | 9 | |
| 9 | 10 | /** |
| 10 | 11 | * <p> |
| ... | ... | @@ -17,5 +18,8 @@ |
| 17 | 18 | @Service |
| 18 | 19 | public class ${table.serviceImplName} extends ${superServiceImplClass}<${table.mapperName}, ${entity}> implements ${table.serviceName} { |
| 19 | 20 | |
| 21 | + public Integer deleteLogicById(Serializable id){ | |
| 22 | + return baseMapper.deleteLogicById(id); | |
| 23 | + } | |
| 20 | 24 | } |
mybatis-plus/src/test/java/com/baomidou/mybatisplus/test/generator/MysqlGenerator.java
View file @
98f4a66
| ... | ... | @@ -42,12 +42,13 @@ |
| 42 | 42 | |
| 43 | 43 | private static void customSet(GlobalConfig gc,StrategyConfig strategy,PackageConfig pc){ |
| 44 | 44 | gc.setOutputDir("E://mybatis-plus-generate"); |
| 45 | - gc.setAuthor("maliang"); | |
| 45 | + gc.setAuthor("fangcheng"); | |
| 46 | + //strategy.setInclude(new String[] { "SYS_USERS","SYS_USER_ROLE_MAPS","SYS_ROLES" }); // 需要生成的表 | |
| 46 | 47 | strategy.setInclude(new String[] { "SYS_USERS","SYS_USER_ROLE_MAPS","SYS_ROLES" }); // 需要生成的表 |
| 47 | 48 | // pc.setParent("com.lyms.hospital"); |
| 48 | - pc.setParent("com.lyms.cm.entity.sys"); | |
| 49 | + pc.setParent("com.lyms.cm"); | |
| 49 | 50 | |
| 50 | -// pc.setFunctionName("sys"); //com.lyms.hospital.web.controller.sys 加在controller后面 | |
| 51 | + pc.setFunctionName("sys"); //com.lyms.hospital.web.controller.sys 加在controller后面 | |
| 51 | 52 | // pc.setModuleName("sys"); //com.lyms.hospital.sys.controller 加在controller前面 |
| 52 | 53 | |
| 53 | 54 | //以下基本不变 |
| ... | ... | @@ -86,8 +87,8 @@ |
| 86 | 87 | gc.setFileOverride(true); |
| 87 | 88 | gc.setActiveRecord(false); |
| 88 | 89 | gc.setEnableCache(false);// XML 二级缓存 |
| 89 | - gc.setBaseResultMap(false);// XML ResultMap | |
| 90 | - gc.setBaseColumnList(false);// XML columList | |
| 90 | + gc.setBaseResultMap(true);// XML ResultMap | |
| 91 | + gc.setBaseColumnList(true);// XML columList | |
| 91 | 92 | //gc.setAuthor("Yanghu"); |
| 92 | 93 | |
| 93 | 94 | // 自定义文件命名,注意 %s 会自动填充表实体属性! |