DisposalSiteMapper.xml 18.8 KB
<?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.trash.disposalSite.mapper.DisposalSiteMapper">
    
    <resultMap type="DisposalSite" id="DisposalSiteResult">
        <result property="id"    column="id"    />
        <result property="name"    column="name"    />
        <result property="certificateNumber"    column="certificate_number"    />
        <result property="address"    column="address"    />
        <result property="engineeringProperty"    column="engineering_property"    />
        <result property="siteType"    column="site_type"    />
        <result property="localArea"    column="local_area"    />
        <result property="operatingArea"    column="operating_area"    />
        <result property="trashType"    column="trash_type"    />
        <result property="constructionUnit"    column="construction_unit"    />
        <result property="constructionUnitPerson"    column="construction_unit_person"    />
        <result property="constructionUnitPersonPhone"    column="construction_unit_person_phone"    />
        <result property="validityBeginDate"    column="validity_begin_date"    />
        <result property="validityEndDate"    column="validity_end_date"    />
        <result property="squareMeasure"    column="square_measure"    />
        <result property="surplusSquareMeasure"    column="surplus_square_measure"    />
        <result property="carWashingFacilities"    column="car_washing_facilities"    />
        <result property="exitRoadCondition"    column="exit_road_condition"    />
        <result property="lightingFacility"    column="lighting_facility"    />
        <result property="videoSurveillanceFacility"    column="video_surveillance_facility"    />
        <result property="preparer"    column="preparer"    />
        <result property="handlingAdvice"    column="handling_advice"    />
        <result property="absorbSource"    column="absorb_source"    />
        <result property="electronicFence"    column="electronic_fence"    />
        <result property="creditStatus"    column="credit_status"    />
        <result property="approvalDocument"    column="approval_document"    />
        <result property="approvalData"    column="approval_data"    />
        <result property="scenePhoto"    column="scene_photo"    />
        <result property="carWashingFacilitiesImage"    column="car_washing_facilities_image"    />
        <result property="termRange"    column="term_range"    />
        <result property="safetyAssessmentReport"    column="safety_assessment_report"    />
        <result property="environmentalApproval"    column="environmental_approval"    />
        <result property="authorization"    column="authorization"    />
        <result property="otherInformation"    column="other_information"    />
        <result property="companyIds"    column="company_ids"    />
        <result property="status"    column="status"    />
        <result property="createTime"    column="create_time"    />
        <result property="createBy"    column="create_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="qrCode"    column="qr_code"    />
        <result property="auditStatus"    column="audit_status"    />
        <result property="addressGps"    column="address_gps"    />
    </resultMap>

    <sql id="selectDisposalSiteVo">
        select id, name, certificate_number, address, engineering_property, site_type, local_area, operating_area, trash_type, construction_unit, construction_unit_person, construction_unit_person_phone, validity_begin_date, validity_end_date, square_measure, surplus_square_measure, car_washing_facilities, exit_road_condition, lighting_facility, video_surveillance_facility, preparer, handling_advice, absorb_source, electronic_fence, credit_status, approval_document, approval_data, scene_photo, car_washing_facilities_image, term_range, safety_assessment_report, environmental_approval, `authorization`, other_information, company_ids, status, create_time, create_by, update_time, update_by, qr_code,audit_status,address_gps from disposal_site
    </sql>

    <select id="selectDisposalSiteList" parameterType="DisposalSite" resultMap="DisposalSiteResult">
        <include refid="selectDisposalSiteVo"/>
        <where>  
            <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
            <if test="certificateNumber != null  and certificateNumber != ''"> and certificate_number = #{certificateNumber}</if>
            <if test="address != null  and address != ''"> and address = #{address}</if>
            <if test="engineeringProperty != null  and engineeringProperty != ''"> and engineering_property = #{engineeringProperty}</if>
            <if test="siteType != null  and siteType != ''"> and site_type = #{siteType}</if>
            <if test="localArea != null  and localArea != ''"> and local_area = #{localArea}</if>
            <if test="operatingArea != null  and operatingArea != ''"> and operating_area = #{operatingArea}</if>
            <if test="trashType != null  and trashType != ''"> and trash_type = #{trashType}</if>
            <if test="constructionUnit != null  and constructionUnit != ''"> and construction_unit = #{constructionUnit}</if>
            <if test="constructionUnitPerson != null  and constructionUnitPerson != ''"> and construction_unit_person = #{constructionUnitPerson}</if>
            <if test="constructionUnitPersonPhone != null  and constructionUnitPersonPhone != ''"> and construction_unit_person_phone = #{constructionUnitPersonPhone}</if>
            <if test="validityBeginDate != null "> and validity_begin_date = #{validityBeginDate}</if>
            <if test="validityEndDate != null "> and validity_end_date = #{validityEndDate}</if>
            <if test="squareMeasure != null  and squareMeasure != ''"> and square_measure = #{squareMeasure}</if>
            <if test="surplusSquareMeasure != null  and surplusSquareMeasure != ''"> and surplus_square_measure = #{surplusSquareMeasure}</if>
            <if test="carWashingFacilities != null  and carWashingFacilities != ''"> and car_washing_facilities = #{carWashingFacilities}</if>
            <if test="exitRoadCondition != null  and exitRoadCondition != ''"> and exit_road_condition = #{exitRoadCondition}</if>
            <if test="lightingFacility != null  and lightingFacility != ''"> and lighting_facility = #{lightingFacility}</if>
            <if test="videoSurveillanceFacility != null  and videoSurveillanceFacility != ''"> and video_surveillance_facility = #{videoSurveillanceFacility}</if>
            <if test="preparer != null  and preparer != ''"> and preparer = #{preparer}</if>
            <if test="handlingAdvice != null  and handlingAdvice != ''"> and handling_advice = #{handlingAdvice}</if>
            <if test="absorbSource != null  and absorbSource != ''"> and absorb_source = #{absorbSource}</if>
            <if test="electronicFence != null  and electronicFence != ''"> and electronic_fence = #{electronicFence}</if>
            <if test="creditStatus != null  and creditStatus != ''"> and credit_status = #{creditStatus}</if>
            <if test="approvalDocument != null  and approvalDocument != ''"> and approval_document = #{approvalDocument}</if>
            <if test="approvalData != null  and approvalData != ''"> and approval_data = #{approvalData}</if>
            <if test="scenePhoto != null  and scenePhoto != ''"> and scene_photo = #{scenePhoto}</if>
            <if test="carWashingFacilitiesImage != null  and carWashingFacilitiesImage != ''"> and car_washing_facilities_image = #{carWashingFacilitiesImage}</if>
            <if test="termRange != null  and termRange != ''"> and term_range = #{termRange}</if>
            <if test="safetyAssessmentReport != null  and safetyAssessmentReport != ''"> and safety_assessment_report = #{safetyAssessmentReport}</if>
            <if test="environmentalApproval != null  and environmentalApproval != ''"> and environmental_approval = #{environmentalApproval}</if>
            <if test="authorization != null  and authorization != ''"> and `authorization` = #{authorization}</if>
            <if test="otherInformation != null  and otherInformation != ''"> and other_information = #{otherInformation}</if>
            <if test="companyIds != null  and companyIds != ''"> and company_ids = #{companyIds}</if>
            <if test="status != null "> and status = #{status}</if>
            <if test="qrCode != null  and qrCode != ''"> and qr_code = #{qrCode}</if>
            <if test="auditStatus != null "> and audit_status = #{auditStatus}</if>
        </where>
    </select>
    
    <select id="selectDisposalSiteById" parameterType="Long" resultMap="DisposalSiteResult">
        <include refid="selectDisposalSiteVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertDisposalSite" parameterType="DisposalSite" useGeneratedKeys="true" keyProperty="id">
        insert into disposal_site
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="name != null">name,</if>
            <if test="certificateNumber != null">certificate_number,</if>
            <if test="address != null">address,</if>
            <if test="engineeringProperty != null">engineering_property,</if>
            <if test="siteType != null">site_type,</if>
            <if test="localArea != null">local_area,</if>
            <if test="operatingArea != null">operating_area,</if>
            <if test="trashType != null">trash_type,</if>
            <if test="constructionUnit != null">construction_unit,</if>
            <if test="constructionUnitPerson != null">construction_unit_person,</if>
            <if test="constructionUnitPersonPhone != null">construction_unit_person_phone,</if>
            <if test="validityBeginDate != null">validity_begin_date,</if>
            <if test="validityEndDate != null">validity_end_date,</if>
            <if test="squareMeasure != null">square_measure,</if>
            <if test="surplusSquareMeasure != null">surplus_square_measure,</if>
            <if test="carWashingFacilities != null">car_washing_facilities,</if>
            <if test="exitRoadCondition != null">exit_road_condition,</if>
            <if test="lightingFacility != null">lighting_facility,</if>
            <if test="videoSurveillanceFacility != null">video_surveillance_facility,</if>
            <if test="preparer != null">preparer,</if>
            <if test="handlingAdvice != null">handling_advice,</if>
            <if test="absorbSource != null">absorb_source,</if>
            <if test="electronicFence != null">electronic_fence,</if>
            <if test="creditStatus != null">credit_status,</if>
            <if test="approvalDocument != null">approval_document,</if>
            <if test="approvalData != null">approval_data,</if>
            <if test="scenePhoto != null">scene_photo,</if>
            <if test="carWashingFacilitiesImage != null">car_washing_facilities_image,</if>
            <if test="termRange != null">term_range,</if>
            <if test="safetyAssessmentReport != null">safety_assessment_report,</if>
            <if test="environmentalApproval != null">environmental_approval,</if>
            <if test="authorization != null">`authorization`,</if>
            <if test="otherInformation != null">other_information,</if>
            <if test="companyIds != null">company_ids,</if>
            <if test="status != null">status,</if>
            <if test="createTime != null">create_time,</if>
            <if test="createBy != null">create_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="qrCode != null">qr_code,</if>
            <if test="auditStatus != null">audit_status,</if>
            <if test="addressGps != null">address_gps,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="name != null">#{name},</if>
            <if test="certificateNumber != null">#{certificateNumber},</if>
            <if test="address != null">#{address},</if>
            <if test="engineeringProperty != null">#{engineeringProperty},</if>
            <if test="siteType != null">#{siteType},</if>
            <if test="localArea != null">#{localArea},</if>
            <if test="operatingArea != null">#{operatingArea},</if>
            <if test="trashType != null">#{trashType},</if>
            <if test="constructionUnit != null">#{constructionUnit},</if>
            <if test="constructionUnitPerson != null">#{constructionUnitPerson},</if>
            <if test="constructionUnitPersonPhone != null">#{constructionUnitPersonPhone},</if>
            <if test="validityBeginDate != null">#{validityBeginDate},</if>
            <if test="validityEndDate != null">#{validityEndDate},</if>
            <if test="squareMeasure != null">#{squareMeasure},</if>
            <if test="surplusSquareMeasure != null">#{surplusSquareMeasure},</if>
            <if test="carWashingFacilities != null">#{carWashingFacilities},</if>
            <if test="exitRoadCondition != null">#{exitRoadCondition},</if>
            <if test="lightingFacility != null">#{lightingFacility},</if>
            <if test="videoSurveillanceFacility != null">#{videoSurveillanceFacility},</if>
            <if test="preparer != null">#{preparer},</if>
            <if test="handlingAdvice != null">#{handlingAdvice},</if>
            <if test="absorbSource != null">#{absorbSource},</if>
            <if test="electronicFence != null">#{electronicFence},</if>
            <if test="creditStatus != null">#{creditStatus},</if>
            <if test="approvalDocument != null">#{approvalDocument},</if>
            <if test="approvalData != null">#{approvalData},</if>
            <if test="scenePhoto != null">#{scenePhoto},</if>
            <if test="carWashingFacilitiesImage != null">#{carWashingFacilitiesImage},</if>
            <if test="termRange != null">#{termRange},</if>
            <if test="safetyAssessmentReport != null">#{safetyAssessmentReport},</if>
            <if test="environmentalApproval != null">#{environmentalApproval},</if>
            <if test="authorization != null">#{authorization},</if>
            <if test="otherInformation != null">#{otherInformation},</if>
            <if test="companyIds != null">#{companyIds},</if>
            <if test="status != null">#{status},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="qrCode != null">#{qrCode},</if>
            <if test="auditStatus != null">#{auditStatus},</if>
            <if test="addressGps != null">#{addressGps},</if>
         </trim>
    </insert>

    <update id="updateDisposalSite" parameterType="DisposalSite">
        update disposal_site
        <trim prefix="SET" suffixOverrides=",">
            <if test="name != null">`name` = #{name},</if>
            <if test="certificateNumber != null">certificate_number = #{certificateNumber},</if>
            <if test="address != null">address = #{address},</if>
            <if test="engineeringProperty != null">engineering_property = #{engineeringProperty},</if>
            <if test="siteType != null">site_type = #{siteType},</if>
            <if test="localArea != null">local_area = #{localArea},</if>
            <if test="operatingArea != null">operating_area = #{operatingArea},</if>
            <if test="trashType != null">trash_type = #{trashType},</if>
            <if test="constructionUnit != null">construction_unit = #{constructionUnit},</if>
            <if test="constructionUnitPerson != null">construction_unit_person = #{constructionUnitPerson},</if>
            <if test="constructionUnitPersonPhone != null">construction_unit_person_phone = #{constructionUnitPersonPhone},</if>
            <if test="validityBeginDate != null">validity_begin_date = #{validityBeginDate},</if>
            <if test="validityEndDate != null">validity_end_date = #{validityEndDate},</if>
            <if test="squareMeasure != null">square_measure = #{squareMeasure},</if>
            <if test="surplusSquareMeasure != null">surplus_square_measure = #{surplusSquareMeasure},</if>
            <if test="carWashingFacilities != null">car_washing_facilities = #{carWashingFacilities},</if>
            <if test="exitRoadCondition != null">exit_road_condition = #{exitRoadCondition},</if>
            <if test="lightingFacility != null">lighting_facility = #{lightingFacility},</if>
            <if test="videoSurveillanceFacility != null">video_surveillance_facility = #{videoSurveillanceFacility},</if>
            <if test="preparer != null">preparer = #{preparer},</if>
            <if test="handlingAdvice != null">handling_advice = #{handlingAdvice},</if>
            <if test="absorbSource != null">absorb_source = #{absorbSource},</if>
            <if test="electronicFence != null">electronic_fence = #{electronicFence},</if>
            <if test="creditStatus != null">credit_status = #{creditStatus},</if>
            <if test="approvalDocument != null">approval_document = #{approvalDocument},</if>
            <if test="approvalData != null">approval_data = #{approvalData},</if>
            <if test="scenePhoto != null">scene_photo = #{scenePhoto},</if>
            <if test="carWashingFacilitiesImage != null">car_washing_facilities_image = #{carWashingFacilitiesImage},</if>
            <if test="termRange != null">term_range = #{termRange},</if>
            <if test="safetyAssessmentReport != null">safety_assessment_report = #{safetyAssessmentReport},</if>
            <if test="environmentalApproval != null">environmental_approval = #{environmentalApproval},</if>
            <if test="authorization != null">`authorization` = #{authorization},</if>
            <if test="otherInformation != null">other_information = #{otherInformation},</if>
            <if test="companyIds != null">company_ids = #{companyIds},</if>
            <if test="status != null">`status` = #{status},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="qrCode != null">qr_code = #{qrCode},</if>
            <if test="auditStatus != null">audit_status = #{auditStatus},</if>
            <if test="addressGps != null">address_gps = #{addressGps},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteDisposalSiteById" parameterType="Long">
        delete from disposal_site where id = #{id}
    </delete>

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