<?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="cn.wise.sc.cement.business.mapper.SysUserMapper"> <sql id="where"> <where> <if test="params.status != null "> and su.status = #{params.status} </if> <if test="params.groupId != null"> and su.group_id = #{params.groupId} </if> <if test="params.name != null and params.name != ''"> and su.name like concat('%', #{params.name}, '%') </if> </where> </sql> <select id="getPage" resultType="cn.wise.sc.cement.business.model.vo.UserVo"> SELECT su.*, sg.name as groupName, sp.name as postName FROM sys_user su left join sys_group sg on sg.id = su.group_id left join sys_post sp on sp.id = su.post_id <include refid="where"/> ORDER BY su.create_time DESC </select> <select id="getById" resultType="cn.wise.sc.cement.business.model.vo.UserVo"> SELECT su.*, sg.name as groupName, sp.name as postName, sr.id as roleId, sr.name as roleName FROM sys_user su left join sys_group sg on sg.id = su.group_id left join sys_post sp on sp.id = su.post_id left join sys_role_user sru on sru.user_id = su.id left join sys_role sr on sr.id = sru.role_id where su.id = #{id} </select> <insert id="saveUserRoles"> insert into sys_role_user(role_id, user_id) values (#{roleId}, #{userId}) </insert> <!-- <select id="exportList" resultType="java.util.HashMap">--> <!-- SELECT--> <!-- su.id as 序号,--> <!-- su.username as 用户账号,--> <!-- su.name as 真实姓名,--> <!-- (--> <!-- CASE su.sex--> <!-- WHEN 0 THEN '女'--> <!-- ELSE '男'--> <!-- END--> <!-- )as 性别,--> <!-- su.group_id as 组别id,--> <!-- su.post_id as 职务id,--> <!-- su.wx_id as 微信号,--> <!-- su.qualifications as 职称,--> <!-- (--> <!-- CASE su.status--> <!-- WHEN 0 THEN '禁用'--> <!-- ELSE '启用'--> <!-- END--> <!-- )as 状态,--> <!-- su.work_year as 工作年限,--> <!-- su.phone as 手机号,--> <!-- su.fax as 传真,--> <!-- su.major as 专业,--> <!-- su.email as 邮箱,--> <!-- su.technology_date as 从事本技术领域日期,--> <!-- su.technology_year as 从事本技术领域年限,--> <!-- su.education as 文化程度,--> <!-- su.create_time as 创建时间,--> <!-- su.update_time as 修改时间,--> <!-- su.remark as 备注--> <!-- FROM sys_user su--> <!-- <include refid="where" />--> <!-- ORDER BY su.id ASC--> <!-- </select>--> </mapper>