Commit d93353a6 by duanhq

增加用户角色实体以及相应的数据层操作类 by duanht 2019/1/2

git-svn-id: svn://192.168.3.233/frms/code/car-service/trunk/car-service@16205 aeb6102e-e053-11e5-9fec-f9ebc45caf4b
1 parent 2d5e3518
package com.glsx.manager.mapper;
import com.glsx.manager.pojo.role.SysRole;
import com.glsx.manager.pojo.role.SysRoleExample;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface SysRoleMapper {
long countByExample(SysRoleExample example);
int deleteByExample(SysRoleExample example);
int deleteByPrimaryKey(Integer id);
int insert(SysRole record);
int insertSelective(SysRole record);
List<SysRole> selectByExample(SysRoleExample example);
SysRole selectByPrimaryKey(Integer id);
int updateByExampleSelective(@Param("record") SysRole record, @Param("example") SysRoleExample example);
int updateByExample(@Param("record") SysRole record, @Param("example") SysRoleExample example);
int updateByPrimaryKeySelective(SysRole record);
int updateByPrimaryKey(SysRole record);
}
\ No newline at end of file \ No newline at end of file
package com.glsx.manager.mapper;
import java.util.List;
import com.glsx.manager.pojo.user.SysUser;
import com.glsx.manager.pojo.user.SysUserExample;
import com.glsx.manager.pojo.vo.UserQueryVo;
import org.apache.ibatis.annotations.Param;
public interface SysUserMapper {
long countByExample(SysUserExample example);
int deleteByExample(SysUserExample example);
int deleteByPrimaryKey(Integer id);
int insert(SysUser record);
int insertSelective(SysUser record);
List<SysUser> selectByExample(SysUserExample example);
SysUser selectByPrimaryKey(Integer id);
int updateByExampleSelective(@Param("record") SysUser record, @Param("example") SysUserExample example);
int updateByExample(@Param("record") SysUser record, @Param("example") SysUserExample example);
int updateByPrimaryKeySelective(SysUser record);
int updateByPrimaryKey(SysUser record);
List<SysUser> getUserList(UserQueryVo userQueryVo);
int deleteUserById(List<Integer> id);
}
\ No newline at end of file \ No newline at end of file
package com.glsx.manager.mapper;
import com.glsx.manager.pojo.user.SysUserRole;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface SysUserOrgMapper {
int deleteByPrimaryKey(Long id);
int insert(SysUserRole record);
int insertSelective(SysUserRole record);
SysUserRole selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(SysUserRole record);
int updateByPrimaryKey(SysUserRole record);
List<SysUserRole> findUserOrgs(@Param(value = "userId") Integer userId);
int deleteByUserId(@Param(value = "userId") int userId);
}
\ No newline at end of file \ No newline at end of file
package com.glsx.manager.mapper;
import java.util.List;
import com.glsx.manager.pojo.user.SysUserRole;
import org.apache.ibatis.annotations.Param;
public interface SysUserRoleMapper {
int deleteByPrimaryKey(Long id);
int insert(SysUserRole record);
int insertSelective(SysUserRole record);
SysUserRole selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(SysUserRole record);
int updateByPrimaryKey(SysUserRole record);
List<SysUserRole> findUserRoles(@Param(value="userId") Long userId);
int deleteByUserId(@Param(value="userId") int userId);
}
\ No newline at end of file \ No newline at end of file
package com.glsx.manager.pojo;
import java.util.Date;
/**
* 基础模型
* @author Louis
* @date Sep 13, 2018
*/
public class BaseModel {
private Integer id;
private String createBy;
private Date createTime;
private String updateBy;
private Date updateTime;
private String remake;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getCreateBy() {
return createBy;
}
public void setCreateBy(String createBy) {
this.createBy = createBy;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public String getUpdateBy() {
return updateBy;
}
public void setUpdateBy(String updateBy) {
this.updateBy = updateBy;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public String getRemake() {
return remake;
}
public void setRemake(String remake) {
this.remake = remake;
}
}
package com.glsx.manager.pojo.role;
import com.glsx.manager.pojo.BaseModel;
public class SysRole extends BaseModel {
private String roleName;
private String permissionCharacter;
private Integer displaySort;
private String roleRemark;
private Byte roleStatus;
public String getRoleName() {
return roleName;
}
public void setRoleName(String roleName) {
this.roleName = roleName == null ? null : roleName.trim();
}
public String getPermissionCharacter() {
return permissionCharacter;
}
public void setPermissionCharacter(String permissionCharacter) {
this.permissionCharacter = permissionCharacter == null ? null : permissionCharacter.trim();
}
public Integer getDisplaySort() {
return displaySort;
}
public void setDisplaySort(Integer displaySort) {
this.displaySort = displaySort;
}
public String getRoleRemark() {
return roleRemark;
}
public void setRoleRemark(String roleRemark) {
this.roleRemark = roleRemark == null ? null : roleRemark.trim();
}
public Byte getRoleStatus() {
return roleStatus;
}
public void setRoleStatus(Byte roleStatus) {
this.roleStatus = roleStatus;
}
}
\ No newline at end of file \ No newline at end of file
package com.glsx.manager.pojo.user;
import com.glsx.manager.pojo.BaseModel;
import java.util.ArrayList;
import java.util.List;
public class SysUser extends BaseModel {
private String username;
private String name;
private Integer orgId;
private Integer phoneNumber;
private Byte userStatus;
private String password;
private String mail;
private String sex;
private String occupation;
private List<SysUserRole> userRoles = new ArrayList<>();
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username == null ? null : username.trim();
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
public Integer getOrgId() {
return orgId;
}
public void setOrgId(Integer orgId) {
this.orgId = orgId;
}
public Integer getPhoneNumber() {
return phoneNumber;
}
public void setPhoneNumber(Integer phoneNumber) {
this.phoneNumber = phoneNumber;
}
public Byte getUserStatus() {
return userStatus;
}
public void setUserStatus(Byte userStatus) {
this.userStatus = userStatus;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password == null ? null : password.trim();
}
public String getMail() {
return mail;
}
public void setMail(String mail) {
this.mail = mail == null ? null : mail.trim();
}
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex == null ? null : sex.trim();
}
public String getOccupation() {
return occupation;
}
public void setOccupation(String occupation) {
this.occupation = occupation == null ? null : occupation.trim();
}
public List<SysUserRole> getUserRoles() {
return userRoles;
}
public void setUserRoles(List<SysUserRole> userRoles) {
this.userRoles = userRoles;
}
}
\ No newline at end of file \ No newline at end of file
package com.glsx.manager.pojo.user;
import com.glsx.manager.pojo.BaseModel;
public class SysUserOrg extends BaseModel {
private Integer userId;
private Integer orgId;
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public Integer getOrgId() {
return orgId;
}
public void setOrgId(Integer orgId) {
this.orgId = orgId;
}
}
\ No newline at end of file \ No newline at end of file
package com.glsx.manager.pojo.user;
import com.glsx.manager.pojo.BaseModel;
public class SysUserRole extends BaseModel {
private Integer userId;
private Integer roleId;
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public Integer getRoleId() {
return roleId;
}
public void setRoleId(Integer roleId) {
this.roleId = roleId;
}
}
\ No newline at end of file \ No newline at end of file
package com.glsx.manager.pojo.vo;
import java.io.Serializable;
import java.util.List;
/**
* 查询条件基类,所有的QueryVo都要继承这个类
* Created by IntelliJ IDEA.<br/>
* User: liuyf<br/>
* Date: 2017/9/11<br/>
* Time: 9:24<br/>
*/
public class BaseQueryVo implements Serializable {
/**
* 查询值
*/
private Integer id;
private Integer int1;
private Integer int2;
private Integer int3;
private String string1;
private String string2;
private String string3;
/**
* 对应Mapper.xml foreach collection的list/array
*/
// private List<Integer> list;
// private Integer[] array;
/**
* 用户id,分组id,分类id,车辆id,工单id,设备id
* List对应Mapper.xml foreach collection的list
*/
private Integer userId;
private Integer groupId;
private Integer classId;
private Integer vehicleId;
private Integer wordOrderId;
private Integer trackInfoId;
private List<Integer> groupIdList;
private List<Integer> classIdList;
private List<Integer> vehicleIdList;
private List<Integer> wordOrderIdList;
private List<Integer> trackInfoIdList;
/**
* 开始时间
*/
private String sTime;
/**
* 截止时间
*/
private String eTime;
/**
* 当前时间
*/
private String cTime;
/**
* 追加table关联
*/
private String appendSqlWithTable;
/**
* 追加table关联,带列参数
*/
private String appendSqlWithInTable;
/**
* 权限控制的关联条件(sql语句),追加Where条件
*/
private String appendSqlWithCondition;
/**
* 权限控制的关联条件(sql语句),追加Order排序
*/
private String appendSqlWithOrderByTemp;
/**
* 分组权限控制的表关联
*/
private String appendSqlWithGroupTable;
/**
* 分组权限控制的关联条件(sql语句)
*/
private String appendSqlWithGroupCondition;
/**
* 分类权限控制的表关联
*/
private String appendSqlWithClassTable;
/**
* 分类权限控制的关联条件(sql语句)
*/
private String appendSqlWithClassCondition;
/**
* 映射用户对应车辆关系sql
*/
private String appendSqlWithOrTable;
/**
* 根据时间段拼装sql语句
*/
private String appendSqlByTimeRange;
/**
* 清除所有sql
*/
public void emptyAllSql() {
setAppendSqlWithTable("");
setAppendSqlWithInTable("");
setAppendSqlWithCondition("");
setAppendSqlWithOrderByTemp("");
setAppendSqlWithGroupTable("");
setAppendSqlWithGroupCondition("");
setAppendSqlWithClassTable("");
setAppendSqlWithClassCondition("");
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getInt1() {
return int1;
}
public void setInt1(Integer int1) {
this.int1 = int1;
}
public Integer getInt2() {
return int2;
}
public void setInt2(Integer int2) {
this.int2 = int2;
}
public Integer getInt3() {
return int3;
}
public void setInt3(Integer int3) {
this.int3 = int3;
}
public String getString1() {
return string1;
}
public void setString1(String string1) {
this.string1 = string1;
}
public String getString2() {
return string2;
}
public void setString2(String string2) {
this.string2 = string2;
}
public String getString3() {
return string3;
}
public void setString3(String string3) {
this.string3 = string3;
}
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public Integer getGroupId() {
return groupId;
}
public void setGroupId(Integer groupId) {
this.groupId = groupId;
}
public Integer getClassId() {
return classId;
}
public void setClassId(Integer classId) {
this.classId = classId;
}
public Integer getVehicleId() {
return vehicleId;
}
public void setVehicleId(Integer vehicleId) {
this.vehicleId = vehicleId;
}
public Integer getWordOrderId() {
return wordOrderId;
}
public void setWordOrderId(Integer wordOrderId) {
this.wordOrderId = wordOrderId;
}
public Integer getTrackInfoId() {
return trackInfoId;
}
public void setTrackInfoId(Integer trackInfoId) {
this.trackInfoId = trackInfoId;
}
public List<Integer> getGroupIdList() {
return groupIdList;
}
public void setGroupIdList(List<Integer> groupIdList) {
this.groupIdList = groupIdList;
}
public List<Integer> getClassIdList() {
return classIdList;
}
public void setClassIdList(List<Integer> classIdList) {
this.classIdList = classIdList;
}
public List<Integer> getVehicleIdList() {
return vehicleIdList;
}
public void setVehicleIdList(List<Integer> vehicleIdList) {
this.vehicleIdList = vehicleIdList;
}
public List<Integer> getWordOrderIdList() {
return wordOrderIdList;
}
public void setWordOrderIdList(List<Integer> wordOrderIdList) {
this.wordOrderIdList = wordOrderIdList;
}
public List<Integer> getTrackInfoIdList() {
return trackInfoIdList;
}
public void setTrackInfoIdList(List<Integer> trackInfoIdList) {
this.trackInfoIdList = trackInfoIdList;
}
// public List<Integer> getList() {
// return list;
// }
//
// public void setList(List<Integer> list) {
// this.list = list;
// }
//
// public Integer[] getArray() {
// return array;
// }
//
// public void setArray(Integer[] array) {
// this.array = array;
// }
public String getsTime() {
return sTime;
}
public void setsTime(String sTime) {
this.sTime = sTime;
}
public String geteTime() {
return eTime;
}
public void seteTime(String eTime) {
this.eTime = eTime;
}
public String getcTime() {
return cTime;
}
public void setcTime(String cTime) {
this.cTime = cTime;
}
public String getAppendSqlWithTable() {
return appendSqlWithTable;
}
public void setAppendSqlWithTable(String appendSqlWithTable) {
this.appendSqlWithTable = appendSqlWithTable;
}
public String getAppendSqlWithInTable() {
return appendSqlWithInTable;
}
public void setAppendSqlWithInTable(String appendSqlWithInTable) {
this.appendSqlWithInTable = appendSqlWithInTable;
}
public String getAppendSqlWithCondition() {
return appendSqlWithCondition;
}
public void setAppendSqlWithCondition(String appendSqlWithCondition) {
this.appendSqlWithCondition = appendSqlWithCondition;
}
public String getAppendSqlWithOrderByTemp() {
return appendSqlWithOrderByTemp;
}
public void setAppendSqlWithOrderByTemp(String appendSqlWithOrderByTemp) {
this.appendSqlWithOrderByTemp = appendSqlWithOrderByTemp;
}
public String getAppendSqlWithGroupTable() {
return appendSqlWithGroupTable;
}
public void setAppendSqlWithGroupTable(String appendSqlWithGroupTable) {
this.appendSqlWithGroupTable = appendSqlWithGroupTable;
}
public String getAppendSqlWithGroupCondition() {
return appendSqlWithGroupCondition;
}
public void setAppendSqlWithGroupCondition(String appendSqlWithGroupCondition) {
this.appendSqlWithGroupCondition = appendSqlWithGroupCondition;
}
public String getAppendSqlWithClassTable() {
return appendSqlWithClassTable;
}
public void setAppendSqlWithClassTable(String appendSqlWithClassTable) {
this.appendSqlWithClassTable = appendSqlWithClassTable;
}
public String getAppendSqlWithClassCondition() {
return appendSqlWithClassCondition;
}
public void setAppendSqlWithClassCondition(String appendSqlWithClassCondition) {
this.appendSqlWithClassCondition = appendSqlWithClassCondition;
}
public String getAppendSqlWithOrTable() {
return appendSqlWithOrTable;
}
public void setAppendSqlWithOrTable(String appendSqlWithOrTable) {
this.appendSqlWithOrTable = appendSqlWithOrTable;
}
public String getAppendSqlByTimeRange() {
return appendSqlByTimeRange;
}
public void setAppendSqlByTimeRange(String appendSqlByTimeRange) {
this.appendSqlByTimeRange = appendSqlByTimeRange;
}
}
package com.glsx.manager.pojo.vo;
import java.util.List;
public class UserQueryVo extends BaseQueryVo {
/**
* 勾选导出
*/
private List<Integer> idList;
/**
*登录名称
*/
private int loginName;
/**
* 用户状态
*/
private int userStatus;
public List<Integer> getIdList() {
return idList;
}
public void setIdList(List<Integer> idList) {
this.idList = idList;
}
public int getLoginName() {
return loginName;
}
public void setLoginName(int loginName) {
this.loginName = loginName;
}
public int getUserStatus() {
return userStatus;
}
public void setUserStatus(int userStatus) {
this.userStatus = userStatus;
}
@Override
public String toString() {
return "UserQueryVo{" +
"idList=" + idList +
", loginName=" + loginName +
", userStatus=" + userStatus +
'}';
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.glsx.manager.mapper.SysUserOrgMapper">
<resultMap id="BaseResultMap" type="com.glsx.manager.pojo.user.SysUserOrg">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="user_id" jdbcType="INTEGER" property="userId" />
<result column="org_id" jdbcType="INTEGER" property="org_id" />
</resultMap>
<sql id="Base_Column_List">
id, user_id, role_id
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from sys_user_role
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from sys_user_role
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.louis.kitty.admin.model.SysUserRole">
insert into sys_user_role (id, user_id, role_id
)
values (#{id,jdbcType=INTEGER}, #{userId,jdbcType=INTEGER}, #{roleId,jdbcType=INTEGER}
)
</insert>
<insert id="insertSelective" parameterType="com.glsx.manager.pojo.user.SysUserRole">
insert into sys_user_role
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="userId != null">
user_id,
</if>
<if test="roleId != null">
role_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="userId != null">
#{userId,jdbcType=INTEGER},
</if>
<if test="roleId != null">
#{roleId,jdbcType=INTEGER},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.glsx.manager.pojo.user.SysUserRole">
update sys_user_role
<set>
<if test="userId != null">
user_id = #{userId,jdbcType=INTEGER},
</if>
<if test="roleId != null">
role_id = #{roleId,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.glsx.manager.pojo.user.SysUserRole">
update sys_user_role
set user_id = #{userId,jdbcType=INTEGER},
role_id = #{roleId,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER}
</update>
<select id="findUserRoles" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from sys_user_role
where user_id = #{userId,jdbcType=INTEGER}
</select>
<delete id="deleteByUserId" parameterType="java.lang.Integer">
delete from sys_user_role
where user_id = #{userId,jdbcType=INTEGER}
</delete>
</mapper>
\ No newline at end of file \ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.glsx.manager.mapper.SysUserRoleMapper">
<resultMap id="BaseResultMap" type="com.glsx.manager.pojo.user.SysUserRole">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="user_id" jdbcType="INTEGER" property="userId" />
<result column="role_id" jdbcType="INTEGER" property="roleId" />
</resultMap>
<sql id="Base_Column_List">
id, user_id, role_id
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from sys_user_role
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from sys_user_role
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.louis.kitty.admin.model.SysUserRole">
insert into sys_user_role (id, user_id, role_id
)
values (#{id,jdbcType=INTEGER}, #{userId,jdbcType=INTEGER}, #{roleId,jdbcType=INTEGER}
)
</insert>
<insert id="insertSelective" parameterType="com.glsx.manager.pojo.user.SysUserRole">
insert into sys_user_role
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="userId != null">
user_id,
</if>
<if test="roleId != null">
role_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="userId != null">
#{userId,jdbcType=INTEGER},
</if>
<if test="roleId != null">
#{roleId,jdbcType=INTEGER},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.glsx.manager.pojo.user.SysUserRole">
update sys_user_role
<set>
<if test="userId != null">
user_id = #{userId,jdbcType=INTEGER},
</if>
<if test="roleId != null">
role_id = #{roleId,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.glsx.manager.pojo.user.SysUserRole">
update sys_user_role
set user_id = #{userId,jdbcType=INTEGER},
role_id = #{roleId,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER}
</update>
<select id="findUserRoles" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from sys_user_role
where user_id = #{userId,jdbcType=INTEGER}
</select>
<delete id="deleteByUserId" parameterType="java.lang.Integer">
delete from sys_user_role
where user_id = #{userId,jdbcType=INTEGER}
</delete>
</mapper>
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!