alive-admin/alive-server/target/classes/mapper/system/UserMapper.xml

129 lines
6.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">
<mapper namespace="com.ruoyi.system.mapper.UserMapper">
<resultMap type="com.ruoyi.system.domain.User" id="UserResult">
<result property="id" column="id" />
<result property="createTime" column="create_time" />
<result property="createBy" column="create_by" />
<result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" />
<result property="flag" column="flag" />
<result property="name" column="name" />
<result property="address" column="address" />
<result property="directUserId" column="direct_user_id" />
<result property="parentAddress" column="parent_address" />
<result property="allParentId" column="all_parent_id" />
<result property="valid" column="valid" />
<result property="img" column="img" />
<result property="roleImg" column="role_img" />
</resultMap>
<sql id="selectUserVo">
select id, create_time, create_by, update_time, update_by, flag, name, address, direct_user_id, parent_address, all_parent_id, valid, img, role_img, from fai_user
</sql>
<select id="selectUserList" parameterType="com.ruoyi.system.domain.User" resultMap="UserResult">
<include refid="selectUserVo"/>
<where>
<if test="id != null "> and id = #{id}</if>
<if test="flag != null "> and flag = #{flag}</if>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="address != null and address != ''"> and address = #{address}</if>
<if test="directUserId != null "> and direct_user_id = #{directUserId}</if>
<if test="parentAddress != null and parentAddress != ''"> and parent_address = #{parentAddress}</if>
<if test="allParentId != null and allParentId != ''"> and all_parent_id = #{allParentId}</if>
<if test="valid != null "> and valid = #{valid}</if>
<if test="img != null and img != ''"> and img = #{img}</if>
<if test="roleImg != null and roleImg != ''"> and role_img = #{roleImg}</if>
<if test="params.beginTime != null and params.beginTime != '' and params.endTime != null and params.endTime != ''"> and create_time between #{params.beginTime} and #{params.endTime}</if>
</where>
order by id desc
</select>
<select id="findUser" parameterType="com.ruoyi.system.domain.User" resultMap="UserResult">
<include refid="selectUserVo"/>
<where>
<if test="id != null "> and id = #{id}</if>
<if test="flag != null "> and flag = #{flag}</if>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="address != null and address != ''"> and address = #{address}</if>
<if test="directUserId != null "> and direct_user_id = #{directUserId}</if>
<if test="parentAddress != null and parentAddress != ''"> and parent_address = #{parentAddress}</if>
<if test="allParentId != null and allParentId != ''"> and all_parent_id = #{allParentId}</if>
<if test="valid != null "> and valid = #{valid}</if>
<if test="img != null and img != ''"> and img = #{img}</if>
<if test="roleImg != null and roleImg != ''"> and role_img = #{roleImg}</if>
</where>
limit 1
</select>
<select id="selectUserById" parameterType="Integer" resultMap="UserResult">
<include refid="selectUserVo"/>
where id = #{id}
</select>
<insert id="insertUser" parameterType="com.ruoyi.system.domain.User" useGeneratedKeys="true" keyProperty="id">
insert into fai_user
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="createTime != null">create_time,</if>
<if test="createBy != null">create_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="flag != null">flag,</if>
<if test="name != null">name,</if>
<if test="address != null">address,</if>
<if test="directUserId != null">direct_user_id,</if>
<if test="parentAddress != null">parent_address,</if>
<if test="allParentId != null">all_parent_id,</if>
<if test="valid != null">valid,</if>
<if test="img != null">img,</if>
<if test="roleImg != null">role_img,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="createTime != null">#{createTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="flag != null">#{flag},</if>
<if test="name != null">#{name},</if>
<if test="address != null">#{address},</if>
<if test="directUserId != null">#{directUserId},</if>
<if test="parentAddress != null">#{parentAddress},</if>
<if test="allParentId != null">#{allParentId},</if>
<if test="valid != null">#{valid},</if>
<if test="img != null">#{img},</if>
<if test="roleImg != null">#{roleImg},</if>
</trim>
</insert>
<update id="updateUser" parameterType="com.ruoyi.system.domain.User">
update fai_user
<trim prefix="SET" suffixOverrides=",">
<if test="createTime != null">create_time = #{createTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="flag != null">flag = #{flag},</if>
<if test="name != null">name = #{name},</if>
<if test="address != null">address = #{address},</if>
<if test="directUserId != null">direct_user_id = #{directUserId},</if>
<if test="parentAddress != null">parent_address = #{parentAddress},</if>
<if test="allParentId != null">all_parent_id = #{allParentId},</if>
<if test="valid != null">valid = #{valid},</if>
<if test="img != null">img = #{img},</if>
<if test="roleImg != null">role_img = #{roleImg},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteUserByIds" parameterType="String">
delete from fai_user where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>