1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- <?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.zglc.kg.dao.UserDao">
- <!-- 可根据自己的需求,是否要使用 -->
- <resultMap type="com.zglc.kg.entity.UserEntity" id="userMap">
- <result property="id" column="id"/>
- <result property="userName" column="user_name"/>
- <result property="realName" column="real_name"/>
- <result property="password" column="password"/>
- <result property="departmentId" column="department_id"/>
- <result property="departmentName" column="department_name"/>
- <result property="roleId" column="role_id"/>
- <result property="roleName" column="role_name"/>
- <result property="sex" column="sex"/>
- <result property="birth" column="birth"/>
- <result property="img" column="img"/>
- <result property="isEnable" column="is_enable"/>
- <result property="remark" column="remark"/>
- </resultMap>
- <select id="listAll" resultMap="userMap">
- select id,user_name,real_name,password,department_id,department_name,role_id,role_name,sex,birth,img,is_enable,
- remark
- from t_user
- where id > 1
- </select>
- <select id="getCount" resultType="java.lang.Integer">
- select count(1)
- from t_user
- where id > 1
- </select>
- <select id="findByName" parameterType="String" resultMap="userMap">
- select id,user_name,real_name,password,department_id,department_name,role_id,role_name,sex,birth,img,is_enable,remark
- from t_user where user_name like #{name}
- and id > 1
- </select>
- <select id="findByUser" parameterType="com.zglc.kg.entity.UserEntity" resultMap="userMap">
- select id,user_name,real_name,password,department_id,department_name,role_id,role_name,sex,birth,img,is_enable,
- remark from t_user where 1=1
- <if test="userName != null">
- and user_name like (CONCAT(CONCAT('%',#{userName}),'%'))
- </if>
- <if test="departmentName != null">
- and department_name = #{departmentName}
- </if>
- <if test="roleName != null">
- and role_name = #{roleName}
- </if>
- <if test="sex != null">
- and sex = #{sex}
- </if>
- </select>
- </mapper>
|