TContractorMapper.xml 8.02 KB
Newer Older
耿迪迪's avatar
耿迪迪 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 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 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
<?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.TContractorMapper">
    
    <resultMap type="TContractor" id="TContractorResult">
        <result property="id"    column="id"    />
        <result property="contractorName"    column="contractor_name"    />
        <result property="certificateName"    column="certificate_name"    />
        <result property="certificateUrl"    column="certificate_url"    />
        <result property="teamInformation"    column="team_information"    />
        <result property="contractorEvaluate"    column="contractor_evaluate"    />
        <result property="violationRecords"    column="violation_records"    />
        <result property="legalPerson"    column="legal_person"    />
        <result property="legalPersonPhone"    column="legal_person_phone"    />
        <result property="keyPerson"    column="key_person"    />
        <result property="keyPersonPhone"    column="key_person_phone"    />
        <result property="safetyPerson"    column="safety_person"    />
        <result property="safetyPersonPhone"    column="safety_person_phone"    />
        <result property="status"    column="status"    />
        <result property="isDel"    column="is_del"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateTime"    column="update_time"    />
    </resultMap>

    <sql id="selectTContractorVo">
        select id, contractor_name, certificate_name, certificate_url, team_information, contractor_evaluate, violation_records, legal_person, legal_person_phone, key_person, key_person_phone, safety_person, safety_person_phone, status, is_del, create_time, update_time from t_contractor
    </sql>

    <select id="selectTContractorList" parameterType="TContractor" resultMap="TContractorResult">
        <include refid="selectTContractorVo"/>
        <where>  is_del = '0'
            <if test="contractorName != null  and contractorName != ''"> and contractor_name like concat('%', #{contractorName}, '%')</if>
            <if test="certificateName != null  and certificateName != ''"> and certificate_name like concat('%', #{certificateName}, '%')</if>
            <if test="certificateUrl != null  and certificateUrl != ''"> and certificate_url = #{certificateUrl}</if>
            <if test="teamInformation != null  and teamInformation != ''"> and team_information = #{teamInformation}</if>
            <if test="contractorEvaluate != null  and contractorEvaluate != ''"> and contractor_evaluate = #{contractorEvaluate}</if>
            <if test="violationRecords != null  and violationRecords != ''"> and violation_records = #{violationRecords}</if>
            <if test="legalPerson != null  and legalPerson != ''"> and legal_person = #{legalPerson}</if>
            <if test="legalPersonPhone != null  and legalPersonPhone != ''"> and legal_person_phone = #{legalPersonPhone}</if>
            <if test="keyPerson != null  and keyPerson != ''"> and key_person = #{keyPerson}</if>
            <if test="keyPersonPhone != null  and keyPersonPhone != ''"> and key_person_phone = #{keyPersonPhone}</if>
            <if test="safetyPerson != null  and safetyPerson != ''"> and safety_person = #{safetyPerson}</if>
            <if test="safetyPersonPhone != null  and safetyPersonPhone != ''"> and safety_person_phone = #{safetyPersonPhone}</if>
            <if test="status != null  and status != ''"> and status = #{status}</if>
            <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
                AND date_format(create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
            </if>
            <if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
                AND date_format(create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
            </if>
        </where>
    </select>
    
    <select id="selectTContractorById" parameterType="Long" resultMap="TContractorResult">
        <include refid="selectTContractorVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertTContractor" parameterType="TContractor">
        insert into t_contractor
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="contractorName != null">contractor_name,</if>
            <if test="certificateName != null">certificate_name,</if>
            <if test="certificateUrl != null">certificate_url,</if>
            <if test="teamInformation != null">team_information,</if>
            <if test="contractorEvaluate != null">contractor_evaluate,</if>
            <if test="violationRecords != null">violation_records,</if>
            <if test="legalPerson != null">legal_person,</if>
            <if test="legalPersonPhone != null">legal_person_phone,</if>
            <if test="keyPerson != null">key_person,</if>
            <if test="keyPersonPhone != null">key_person_phone,</if>
            <if test="safetyPerson != null">safety_person,</if>
            <if test="safetyPersonPhone != null">safety_person_phone,</if>
            <if test="status != null">status,</if>
            <if test="isDel != null">is_del,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateTime != null">update_time,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="contractorName != null">#{contractorName},</if>
            <if test="certificateName != null">#{certificateName},</if>
            <if test="certificateUrl != null">#{certificateUrl},</if>
            <if test="teamInformation != null">#{teamInformation},</if>
            <if test="contractorEvaluate != null">#{contractorEvaluate},</if>
            <if test="violationRecords != null">#{violationRecords},</if>
            <if test="legalPerson != null">#{legalPerson},</if>
            <if test="legalPersonPhone != null">#{legalPersonPhone},</if>
            <if test="keyPerson != null">#{keyPerson},</if>
            <if test="keyPersonPhone != null">#{keyPersonPhone},</if>
            <if test="safetyPerson != null">#{safetyPerson},</if>
            <if test="safetyPersonPhone != null">#{safetyPersonPhone},</if>
            <if test="status != null">#{status},</if>
            <if test="isDel != null">#{isDel},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateTime != null">#{updateTime},</if>
         </trim>
    </insert>

    <update id="updateTContractor" parameterType="TContractor">
        update t_contractor
        <trim prefix="SET" suffixOverrides=",">
            <if test="contractorName != null">contractor_name = #{contractorName},</if>
            certificate_name = #{certificateName},
            certificate_url = #{certificateUrl},
            team_information = #{teamInformation},
            contractor_evaluate = #{contractorEvaluate},
            violation_records = #{violationRecords},
            legal_person = #{legalPerson},
            legal_person_phone = #{legalPersonPhone},
            key_person = #{keyPerson},
            key_person_phone = #{keyPersonPhone},
            safety_person = #{safetyPerson},
            safety_person_phone = #{safetyPersonPhone},
            <if test="status != null">status = #{status},</if>
            <if test="isDel != null">is_del = #{isDel},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteTContractorById" parameterType="Long">
        delete from t_contractor where id = #{id}
    </delete>

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