<?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.zehong.system.mapper.TChangeApplyApprovalMapper"> <resultMap type="TChangeApplyApproval" id="TChangeApplyApprovalResult"> <result property="changeApplyId" column="change_apply_id" /> <result property="changeUnit" column="change_unit" /> <result property="changeProjectName" column="change_project_name" /> <result property="tableData" column="table_data" /> <result property="enterPerson" column="enter_person" /> <result property="enterTime" column="enter_time" /> <result property="trainMaterial" column="train_material" /> <result property="changeApplyStatus" column="change_apply_status" /> <result property="isDel" column="is_del" /> <result property="remark" column="remark" /> <result property="approvalPerson" column="approvalPerson" /> <result property="approvalSign" column="approvalSign"/> </resultMap> <sql id="selectTChangeApplyApprovalVo"> select change_apply_id, change_unit, change_project_name, table_data, enter_person, enter_time, train_material, change_apply_status, is_del, remark from t_change_apply_approval </sql> <select id="selectTChangeApplyApprovalList" parameterType="TChangeApplyApproval" resultMap="TChangeApplyApprovalResult"> <include refid="selectTChangeApplyApprovalVo"/> <where> <if test="changeUnit != null and changeUnit != ''"> and change_unit = #{changeUnit}</if> <if test="changeProjectName != null and changeProjectName != ''"> and change_project_name like concat('%', #{changeProjectName}, '%')</if> <if test="tableData != null and tableData != ''"> and table_data = #{tableData}</if> <if test="enterPerson != null "> and enter_person = #{enterPerson}</if> <if test="enterTimeBegin != null and enterTimeEnd != null "> and enter_time BETWEEN #{enterTimeBegin} AND #{enterTimeEnd}</if> <if test="trainMaterial != null and trainMaterial != ''"> and train_material = #{trainMaterial}</if> <if test="changeApplyStatus != null and changeApplyStatus != ''"> and change_apply_status = #{changeApplyStatus}</if> <if test="isDel != null and isDel != ''"> and is_del = #{isDel}</if> </where> ORDER BY enter_time DESC </select> <select id="selectTChangeApplyApprovalListApp" parameterType="TChangeApplyApproval" resultMap="TChangeApplyApprovalResult"> SELECT a.*,r.approval_sign as approvalSign FROM t_change_apply_approver r LEFT JOIN t_change_apply_approval a ON a.`change_apply_id` = r.`change_apply_id` <where> <if test="changeUnit != null and changeUnit != ''"> and a.change_unit = #{changeUnit}</if> <if test="changeProjectName != null and changeProjectName != ''"> and a.change_project_name like concat('%', #{changeProjectName}, '%')</if> <if test="tableData != null and tableData != ''"> and a.table_data = #{tableData}</if> <if test="enterPerson != null "> and enter_person = #{enterPerson}</if> <if test="enterTimeBegin != null and enterTimeEnd != null "> and a.enter_time BETWEEN #{enterTimeBegin} AND #{enterTimeEnd}</if> <if test="trainMaterial != null and trainMaterial != ''"> and a.train_material = #{trainMaterial}</if> <if test="changeApplyStatus != null and changeApplyStatus != ''"> and a.change_apply_status = #{changeApplyStatus}</if> <if test="isDel != null and isDel != ''"> and a.is_del = #{isDel}</if> <if test="approvalPerson != null"> and r.approval_person = #{approvalPerson}</if> </where> ORDER BY enter_time DESC </select> <select id="selectTChangeApplyApprovalById" parameterType="Long" resultMap="TChangeApplyApprovalResult"> <include refid="selectTChangeApplyApprovalVo"/> where change_apply_id = #{changeApplyId} </select> <insert id="insertTChangeApplyApproval" parameterType="TChangeApplyApproval" useGeneratedKeys="true" keyProperty="changeApplyId"> insert into t_change_apply_approval <trim prefix="(" suffix=")" suffixOverrides=","> <if test="changeUnit != null">change_unit,</if> <if test="changeProjectName != null">change_project_name,</if> <if test="tableData != null">table_data,</if> <if test="enterPerson != null">enter_person,</if> <if test="enterTime != null">enter_time,</if> <if test="trainMaterial != null">train_material,</if> <if test="changeApplyStatus != null">change_apply_status,</if> <if test="isDel != null">is_del,</if> <if test="remark != null">remark,</if> </trim> <trim prefix="values (" suffix=")" suffixOverrides=","> <if test="changeUnit != null">#{changeUnit},</if> <if test="changeProjectName != null">#{changeProjectName},</if> <if test="tableData != null">#{tableData},</if> <if test="enterPerson != null">#{enterPerson},</if> <if test="enterTime != null">#{enterTime},</if> <if test="trainMaterial != null">#{trainMaterial},</if> <if test="changeApplyStatus != null">#{changeApplyStatus},</if> <if test="isDel != null">#{isDel},</if> <if test="remark != null">#{remark},</if> </trim> </insert> <update id="updateTChangeApplyApproval" parameterType="TChangeApplyApproval"> update t_change_apply_approval <trim prefix="SET" suffixOverrides=","> <if test="changeUnit != null">change_unit = #{changeUnit},</if> <if test="changeProjectName != null">change_project_name = #{changeProjectName},</if> <if test="tableData != null">table_data = #{tableData},</if> <if test="enterPerson != null">enter_person = #{enterPerson},</if> <if test="enterTime != null">enter_time = #{enterTime},</if> <if test="trainMaterial != null">train_material = #{trainMaterial},</if> <if test="changeApplyStatus != null">change_apply_status = #{changeApplyStatus},</if> <if test="isDel != null">is_del = #{isDel},</if> <if test="remark != null">remark = #{remark},</if> </trim> where change_apply_id = #{changeApplyId} </update> <delete id="deleteTChangeApplyApprovalById" parameterType="Long"> delete from t_change_apply_approval where change_apply_id = #{changeApplyId} </delete> <delete id="deleteTChangeApplyApprovalByIds" parameterType="String"> delete from t_change_apply_approval where change_apply_id in <foreach item="changeApplyId" collection="array" open="(" separator="," close=")"> #{changeApplyId} </foreach> </delete> </mapper>