kcscDev/kcsc-back-end/src/main/resources/mybatisMapper/AdminUsersMapper.xml

50 lines
1.5 KiB
XML

<?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.dbnt.kcscbackend.admin.users.mapper.AdminUsersMapper">
<select id="selectUserList" parameterType="UserInfo" resultType="UserInfo">
select user_seq,
a.user_id,
a.email,
b.item_nm as user_se,
a.user_nm,
a.phone_num,
a.user_role,
c.item_nm as status
from user_info a
inner join tc_code_item b on a.user_se = b.item_cd
inner join tc_code_item c on a.status = c.item_cd
<include refid="selectUserListWhere"></include>
order by user_seq asc
limit #{rowCnt} offset #{firstIndex}
</select>
<select id="selectUserListCnt" parameterType="UserInfo" resultType="int">
select count(*)
from user_info
<include refid="selectUserListWhere"></include>
</select>
<sql id="selectUserListWhere">
<where>
<if test='userSe != null and userSe != ""'>
and user_se = #{userSe}
</if>
<if test='searchKeyword != null and searchKeyword != ""'>
<if test='searchCondition == "id"'>
and user_id like '%'||#{searchKeyword}||'%'
</if>
<if test='searchCondition == "name"'>
and user_nm like '%'||#{searchKeyword}||'%'
</if>
<if test='searchCondition == "email"'>
and email like '%'||#{searchKeyword}||'%'
</if>
<if test='searchCondition == "phoneNum"'>
and phone_num like '%'||#{searchKeyword}||'%'
</if>
</if>
</where>
</sql>
</mapper>