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

46 lines
1.3 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,
user_id,
email,
user_se,
user_nm,
phone_num,
user_role,
use_yn
from user_info
<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='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>
</where>
</sql>
</mapper>