YZProjectCloud/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/manage/BasSignetMapper.xml

114 lines
5.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.yanzhu.manage.mapper.BasSignetMapper">
<resultMap type="BasSignet" id="BasSignetResult">
<result property="id" column="id" />
<result property="comId" column="com_id" />
<result property="comName" column="com_name" />
<result property="projectId" column="project_id" />
<result property="projectName" column="project_name" />
<result property="userId" column="user_id" />
<result property="userName" column="user_name" />
<result property="signetPath" column="signet_path" />
<result property="signetNumber" column="signet_number" />
<result property="isDel" column="is_del" />
<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="selectBasSignetVo">
select bs.id, bs.com_id, sd.dept_name as com_name, bs.project_id, pi.project_name, bs.user_id, su.nick_name as user_name, bs.signet_path, bs.signet_number, bs.is_del, bs.create_by, bs.create_time, bs.update_by, bs.update_time, bs.remark from bas_signet bs
left join pro_project_info pi on pi.id = bs.project_id
left join sys_dept sd on sd.dept_id = bs.com_id
left join sys_user su on su.user_id = bs.user_id
</sql>
<select id="selectBasSignetList" parameterType="BasSignet" resultMap="BasSignetResult">
<include refid="selectBasSignetVo"/>
<where>
<if test="comId != null "> and bs.com_id = #{comId}</if>
<if test="projectId != null "> and bs.project_id = #{projectId}</if>
<if test="activeComId != null "> and bs.com_id = #{activeComId}</if>
<if test="activeProjectId != null "> and bs.project_id = #{activeProjectId}</if>
<if test="projectName != null and projectName != ''"> and pi.project_name like concat('%', #{projectName}, '%')</if>
<if test="userName != null and userName != ''"> and su.nick_name like concat('%', #{userName}, '%')</if>
<if test="userId != null "> and bs.user_id = #{userId}</if>
<if test="isDel != null "> and bs.is_del = #{isDel}</if>
</where>
order by bs.id desc
</select>
<select id="selectBasSignetById" parameterType="Long" resultMap="BasSignetResult">
<include refid="selectBasSignetVo"/>
where bs.id = #{id}
</select>
<insert id="insertBasSignet" parameterType="BasSignet" useGeneratedKeys="true" keyProperty="id">
insert into bas_signet
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="comId != null">com_id,</if>
<if test="projectId != null">project_id,</if>
<if test="userId != null">user_id,</if>
<if test="signetPath != null">signet_path,</if>
<if test="signetNumber != null">signet_number,</if>
<if test="isDel != null">is_del,</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="comId != null">#{comId},</if>
<if test="projectId != null">#{projectId},</if>
<if test="userId != null">#{userId},</if>
<if test="signetPath != null">#{signetPath},</if>
<if test="signetNumber != null">#{signetNumber},</if>
<if test="isDel != null">#{isDel},</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="updateBasSignet" parameterType="BasSignet">
update bas_signet
<trim prefix="SET" suffixOverrides=",">
<if test="comId != null">com_id = #{comId},</if>
<if test="projectId != null">project_id = #{projectId},</if>
<if test="userId != null">user_id = #{userId},</if>
<if test="signetPath != null">signet_path = #{signetPath},</if>
<if test="signetNumber != null">signet_number = #{signetNumber},</if>
<if test="isDel != null">is_del = #{isDel},</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="deleteBasSignetById" parameterType="Long">
delete from bas_signet where id = #{id}
</delete>
<delete id="deleteBasSignetByParams" parameterType="Long">
delete from bas_signet where project_id = #{proId} and user_id = #{userId}
</delete>
<delete id="deleteBasSignetByIds" parameterType="String">
delete from bas_signet where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>