TTransactionProjectMapper.xml 5.64 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
<?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.TTransactionProjectMapper">
    
    <resultMap type="TTransactionProject" id="TTransactionProjectResult">
        <result property="transactionProjectId"    column="transaction_project_id"    />
        <result property="transactionProjectName"    column="transaction_project_name"    />
        <result property="transactionItemName"    column="transaction_item_name"    />
        <result property="context"    column="context"    />
        <result property="priceType"    column="price_type"    />
        <result property="price"    column="price"    />
        <result property="deptId"    column="deptId"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateTime"    column="update_time"    />
        <result property="isDel"    column="is_del"    />
        <result property="remark"    column="remark"    />
        <result property="deptName" column="dept_name"/>
    </resultMap>

    <sql id="selectTTransactionProjectVo">
23
        select transaction_project_id, transaction_project_name, transaction_item_name, context, price_type, price, dept_id AS deptId, create_time, update_time, is_del, remark,(SELECT dept.dept_name FROM sys_dept dept WHERE dept.dept_id = deptId)AS dept_name from t_transaction_project
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
    </sql>

    <select id="selectTTransactionProjectList" parameterType="TTransactionProject" resultMap="TTransactionProjectResult">
        <include refid="selectTTransactionProjectVo"/>
        <where>  
            <if test="transactionProjectName != null  and transactionProjectName != ''"> and transaction_project_name like concat('%', #{transactionProjectName}, '%')</if>
            <if test="transactionItemName != null  and transactionItemName != ''"> and transaction_item_name like concat('%', #{transactionItemName}, '%')</if>
            <if test="context != null  and context != ''"> and context = #{context}</if>
            <if test="priceType != null  and priceType != ''"> and price_type = #{priceType}</if>
            <if test="price != null "> and price = #{price}</if>
            <if test="deptId != null "> and dept_id = #{deptId}</if>
            <if test="isDel != null  and isDel != ''"> and is_del = #{isDel}</if>
        </where>
    </select>
    
    <select id="selectTTransactionProjectById" parameterType="Long" resultMap="TTransactionProjectResult">
        <include refid="selectTTransactionProjectVo"/>
        where transaction_project_id = #{transactionProjectId}
    </select>
        
    <insert id="insertTTransactionProject" parameterType="TTransactionProject" useGeneratedKeys="true" keyProperty="transactionProjectId">
        insert into t_transaction_project
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="transactionProjectName != null">transaction_project_name,</if>
            <if test="transactionItemName != null">transaction_item_name,</if>
            <if test="context != null">context,</if>
            <if test="priceType != null">price_type,</if>
            <if test="price != null">price,</if>
            <if test="deptId != null">dept_id,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="isDel != null">is_del,</if>
            <if test="remark != null">remark,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="transactionProjectName != null">#{transactionProjectName},</if>
            <if test="transactionItemName != null">#{transactionItemName},</if>
            <if test="context != null">#{context},</if>
            <if test="priceType != null">#{priceType},</if>
            <if test="price != null">#{price},</if>
            <if test="deptId != null">#{deptId},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="isDel != null">#{isDel},</if>
            <if test="remark != null">#{remark},</if>
         </trim>
    </insert>

    <update id="updateTTransactionProject" parameterType="TTransactionProject">
        update t_transaction_project
        <trim prefix="SET" suffixOverrides=",">
            <if test="transactionProjectName != null">transaction_project_name = #{transactionProjectName},</if>
            <if test="transactionItemName != null">transaction_item_name = #{transactionItemName},</if>
            <if test="context != null">context = #{context},</if>
            <if test="priceType != null">price_type = #{priceType},</if>
            <if test="price != null">price = #{price},</if>
            <if test="deptId != null">dept_id = #{deptId},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="isDel != null">is_del = #{isDel},</if>
            <if test="remark != null">remark = #{remark},</if>
        </trim>
        where transaction_project_id = #{transactionProjectId}
    </update>

    <delete id="deleteTTransactionProjectById" parameterType="Long">
        delete from t_transaction_project where transaction_project_id = #{transactionProjectId}
    </delete>

    <delete id="deleteTTransactionProjectByIds" parameterType="String">
        delete from t_transaction_project where transaction_project_id in 
        <foreach item="transactionProjectId" collection="array" open="(" separator="," close=")">
            #{transactionProjectId}
        </foreach>
    </delete>
</mapper>