playlet/playlet-system/src/main/resources/mapper/system/PlayletUserMapper.xml

107 lines
5.3 KiB
XML
Raw Normal View History

<?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.playlet.system.mapper.PlayletUserMapper">
<resultMap type="PlayletUser" id="PlayletUserResult">
<result property="id" column="ID" />
<result property="phone" column="PHONE" />
<result property="nickName" column="NICK_NAME" />
<result property="password" column="PASSWORD" />
<result property="icon" column="ICON" />
<result property="agencyId" column="AGENCY_ID" />
<result property="parentId" column="PARENT_ID" />
<result property="createBy" column="CREATE_BY" />
<result property="createTime" column="CREATE_TIME" />
<result property="updateBy" column="UPDATE_BY" />
<result property="updateTime" column="UPDATE_TIME" />
<result property="remark" column="REMARK" />
</resultMap>
<sql id="selectPlayletUserVo">
select ID, PHONE, NICK_NAME, PASSWORD, ICON, AGENCY_ID, PARENT_ID, CREATE_BY, CREATE_TIME, UPDATE_BY, UPDATE_TIME, REMARK from playlet_user
</sql>
<select id="selectPlayletUserList" parameterType="PlayletUser" resultMap="PlayletUserResult">
<include refid="selectPlayletUserVo"/>
<where>
<if test="phone != null and phone != ''"> and PHONE = #{phone}</if>
<if test="nickName != null and nickName != ''"> and NICK_NAME like concat('%', #{nickName}, '%')</if>
<if test="password != null and password != ''"> and PASSWORD = #{password}</if>
<if test="icon != null and icon != ''"> and ICON = #{icon}</if>
<if test="agencyId != null and agencyId != ''"> and AGENCY_ID = #{agencyId}</if>
<if test="parentId != null and parentId != ''"> and PARENT_ID = #{parentId}</if>
<if test="createBy != null and createBy != ''"> and CREATE_BY = #{createBy}</if>
<if test="createTime != null "> and CREATE_TIME = #{createTime}</if>
<if test="updateBy != null and updateBy != ''"> and UPDATE_BY = #{updateBy}</if>
<if test="updateTime != null "> and UPDATE_TIME = #{updateTime}</if>
<if test="remark != null and REMARK != ''"> and REMARK = #{REMARK}</if>
</where>
</select>
<select id="selectPlayletUserByID" parameterType="Long" resultMap="PlayletUserResult">
<include refid="selectPlayletUserVo"/>
where ID = #{ID}
</select>
<insert id="insertPlayletUser" parameterType="PlayletUser" useGeneratedKeys="true" keyProperty="ID">
insert into playlet_user
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="phone != null">PHONE,</if>
<if test="nickName != null">NICK_NAME,</if>
<if test="password != null">PASSWORD,</if>
<if test="icon != null">ICON,</if>
<if test="agencyId != null">AGENCY_ID,</if>
<if test="parentId != null">PARENT_ID,</if>
<if test="createBy != null">CREATE_BY,</if>
<if test="createTime != null">CREATE_TIME,</if>
<if test="updateBy != null">UPDATE_BY,</if>
<if test="updateTime != null">UPDATE_TIME,</if>
<if test="remark != null">REMARK,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="phone != null">#{phone},</if>
<if test="nickName != null">#{nickName},</if>
<if test="password != null">#{password},</if>
<if test="icon != null">#{icon},</if>
<if test="agencyId != null">#{agencyId},</if>
<if test="parentId != null">#{parentId},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updatePlayletUser" parameterType="PlayletUser">
update playlet_user
<trim prefix="SET" suffixOverrides=",">
<if test="phone != null">PHONE = #{phone},</if>
<if test="nickName != null">NICK_NAME = #{nickName},</if>
<if test="password != null">PASSWORD = #{password},</if>
<if test="icon != null">ICON = #{icon},</if>
<if test="agencyId != null">AGENCY_ID = #{agencyId},</if>
<if test="parentId != null">PARENT_ID = #{parentId},</if>
<if test="createBy != null">CREATE_BY = #{createBy},</if>
<if test="createTime != null">CREATE_TIME = #{createTime},</if>
<if test="updateBy != null">UPDATE_BY = #{updateBy},</if>
<if test="updateTime != null">UPDATE_TIME = #{updateTime},</if>
<if test="remark != null">REMARK = #{remark},</if>
</trim>
where ID = #{id}
</update>
<delete id="deletePlayletUserByID" parameterType="Long">
delete from playlet_user where ID = #{id}
</delete>
<delete id="deletePlayletUserByIDs" parameterType="String">
delete from playlet_user where ID in
<foreach item="ID" collection="array" open="(" separator="," close=")">
#{ID}
</foreach>
</delete>
</mapper>