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

107 lines
5.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.yanzhu.manage.mapper.BasTemplateMapper">
<resultMap type="BasTemplate" id="BasTemplateResult">
<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="temName" column="tem_name" />
<result property="temType" column="tem_type" />
<result property="temPath" column="tem_path" />
<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="selectBasTemplateVo">
select bt.id, bt.com_id, sd.dept_name as com_name, bt.project_id, pi.project_name, bt.tem_name, bt.tem_type, bt.tem_path, bt.is_del, bt.create_by, bt.create_time, bt.update_by, bt.update_time, bt.remark from bas_template bt
left join pro_project_info pi on pi.id = bt.project_id
left join sys_dept sd on sd.dept_id = bt.com_id
</sql>
<select id="selectBasTemplateList" parameterType="BasTemplate" resultMap="BasTemplateResult">
<include refid="selectBasTemplateVo"/>
<where>
<if test="comId != null "> and bt.com_id = #{comId}</if>
<if test="projectId != null "> and bt.project_id = #{projectId}</if>
<if test="activeComId != null "> and bt.com_id = #{activeComId}</if>
<if test="activeProjectId != null "> and bt.project_id = #{activeProjectId}</if>
<if test="temName != null and temName != ''"> and bt.tem_name like concat('%', #{temName}, '%')</if>
<if test="temType != null and temType != ''"> and bt.tem_type = #{temType}</if>
<if test="isDel != null "> and bt.is_del = #{isDel}</if>
</where>
order by bt.id desc
</select>
<select id="selectBasTemplateById" parameterType="Long" resultMap="BasTemplateResult">
<include refid="selectBasTemplateVo"/>
where bt.id = #{id}
</select>
<insert id="insertBasTemplate" parameterType="BasTemplate" useGeneratedKeys="true" keyProperty="id">
insert into bas_template
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="comId != null">com_id,</if>
<if test="projectId != null">project_id,</if>
<if test="temName != null">tem_name,</if>
<if test="temType != null">tem_type,</if>
<if test="temPath != null">tem_path,</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="temName != null">#{temName},</if>
<if test="temType != null">#{temType},</if>
<if test="temPath != null">#{temPath},</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="updateBasTemplate" parameterType="BasTemplate">
update bas_template
<trim prefix="SET" suffixOverrides=",">
<if test="comId != null">com_id = #{comId},</if>
<if test="projectId != null">project_id = #{projectId},</if>
<if test="temName != null">tem_name = #{temName},</if>
<if test="temType != null">tem_type = #{temType},</if>
<if test="temPath != null">tem_path = #{temPath},</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="deleteBasTemplateById" parameterType="Long">
delete from bas_template where id = #{id}
</delete>
<delete id="deleteBasTemplateByIds" parameterType="String">
delete from bas_template where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>