guardia-mes/backend/src/main/resources/mapper/uiws/system/RoleMapper.xml

47 lines
1.8 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">
<!-- UIWS system 이식: 권한(tb_uiws_role). -->
<mapper namespace="com.zioinfo.mes.uiws.system.mapper.RoleMapper">
<sql id="kw">
<if test="keyword != null and keyword != ''">
AND (role_id ILIKE '%' || #{keyword} || '%' OR role_nm ILIKE '%' || #{keyword} || '%')
</if>
</sql>
<select id="search" resultType="com.zioinfo.mes.uiws.system.model.SysRole">
SELECT * FROM tb_uiws_role WHERE 1=1 <include refid="kw"/>
ORDER BY role_id ASC
LIMIT #{size} OFFSET #{offset}
</select>
<select id="countSearch" resultType="long">
SELECT COUNT(*) FROM tb_uiws_role WHERE 1=1 <include refid="kw"/>
</select>
<select id="findById" resultType="com.zioinfo.mes.uiws.system.model.SysRole">
SELECT * FROM tb_uiws_role WHERE role_id = #{roleId}
</select>
<select id="existsById" resultType="boolean">
SELECT EXISTS(SELECT 1 FROM tb_uiws_role WHERE role_id = #{roleId})
</select>
<insert id="insert" parameterType="com.zioinfo.mes.uiws.system.model.SysRole">
INSERT INTO tb_uiws_role (role_id, role_nm, role_desc, use_yn, created_by, created_at)
VALUES (#{roleId}, #{roleNm}, #{roleDesc}, #{useYn}, #{createdBy}, now())
</insert>
<update id="update" parameterType="com.zioinfo.mes.uiws.system.model.SysRole">
UPDATE tb_uiws_role SET
role_nm = #{roleNm}, role_desc = #{roleDesc}, use_yn = #{useYn},
updated_by = #{updatedBy}, updated_at = now()
WHERE role_id = #{roleId}
</update>
<delete id="deleteById">
DELETE FROM tb_uiws_role WHERE role_id = #{roleId}
</delete>
</mapper>