吉安感知网项目-后端
linwei
2 days ago 51a551a7f8eae7654f973d45cd2fa2952774673d
drone-service/drone-gd/src/main/java/org/sxkj/gd/orderdata/mapper/GdSupplyDemandMapper.xml
@@ -29,8 +29,108 @@
        <result column="is_deleted" property="isDeleted"/>
    </resultMap>
    <resultMap id="gdSupplyDemandVOResultMap" type="org.sxkj.gd.orderdata.vo.GdSupplyDemandVO" extends="gdSupplyDemandResultMap"/>
    <select id="selectGdSupplyDemandPage" resultMap="gdSupplyDemandResultMap">
    <sql id="gdSupplyDemandCondition">
        <if test="param.id != null">
            AND id = #{param.id}
        </if>
        <if test="param.demandName != null and param.demandName != ''">
            AND demand_name = #{param.demandName}
        </if>
        <if test="param.demandType != null and param.demandType != ''">
            AND demand_type = #{param.demandType}
        </if>
        <if test="param.contactPerson != null and param.contactPerson != ''">
            AND contact_person = #{param.contactPerson}
        </if>
        <if test="param.contactPhone != null and param.contactPhone != ''">
            AND contact_phone = #{param.contactPhone}
        </if>
        <if test="param.contactEmail != null and param.contactEmail != ''">
            AND contact_email = #{param.contactEmail}
        </if>
        <if test="param.demandStatus != null and param.demandStatus != ''">
            AND demand_status = #{param.demandStatus}
        </if>
        <if test="param.updateCycle != null and param.updateCycle != ''">
            AND update_cycle = #{param.updateCycle}
        </if>
        <if test="param.applyBasis != null and param.applyBasis != ''">
            AND apply_basis = #{param.applyBasis}
        </if>
        <if test="param.shareType != null and param.shareType != ''">
            AND share_type = #{param.shareType}
        </if>
        <if test="param.applicationScene != null and param.applicationScene != ''">
            AND application_scene = #{param.applicationScene}
        </if>
        <if test="param.responsibleDeptId != null and param.responsibleDeptId != ''">
            AND responsible_dept_id = #{param.responsibleDeptId}
        </if>
        <if test="param.applyTargetDeptId != null and param.applyTargetDeptId != ''">
            AND apply_target_dept_id = #{param.applyTargetDeptId}
        </if>
        <if test="param.dataSource != null and param.dataSource != ''">
            AND data_source = #{param.dataSource}
        </if>
        <if test="param.demandInfo != null and param.demandInfo != ''">
            AND demand_info = #{param.demandInfo}
        </if>
        <if test="param.areaCode != null and param.areaCode != ''">
            AND area_code = #{param.areaCode}
        </if>
        <if test="param.createUser != null">
            AND create_user = #{param.createUser}
        </if>
        <if test="param.createDept != null">
            AND create_dept = #{param.createDept}
        </if>
        <if test="param.createTime != null">
            AND create_time = #{param.createTime}
        </if>
        <if test="param.updateUser != null">
            AND update_user = #{param.updateUser}
        </if>
        <if test="param.updateTime != null">
            AND update_time = #{param.updateTime}
        </if>
        <if test="param.status != null and param.status != ''">
            AND status = #{param.status}
        </if>
    </sql>
    <select id="selectGdSupplyDemandList" resultMap="gdSupplyDemandResultMap">
        select * from ja_gd_supply_demand
        <where>
            is_deleted = 0
            <include refid="gdSupplyDemandCondition"/>
        </where>
    </select>
    <select id="selectGdSupplyDemandDetail" resultMap="gdSupplyDemandResultMap">
        select * from ja_gd_supply_demand
        <where>
            is_deleted = 0
            <include refid="gdSupplyDemandCondition"/>
            <if test="deptIdList != null and deptIdList.size > 0">
                AND (
                create_dept::text IN
                <foreach collection="deptIdList" item="deptId" open="(" separator="," close=")">
                    #{deptId}::text
                </foreach>
                OR
                apply_target_dept_id::text IN
                <foreach collection="deptIdList" item="deptId" open="(" separator="," close=")">
                    #{deptId}::text
                </foreach>
                )
            </if>
        </where>
        limit 1
    </select>
    <select id="selectGdSupplyDemandPage" resultMap="gdSupplyDemandVOResultMap">
        select * from ja_gd_supply_demand
        <where>
            is_deleted = 0
@@ -40,9 +140,120 @@
            <if test="param.demandStatus != null and param.demandStatus != ''">
                AND demand_status = #{param.demandStatus}
            </if>
            <if test="param.deptList != null and param.deptList.size > 0">
                AND (
                    create_dept::text IN
                    <foreach collection="param.deptList" item="deptId" open="(" separator="," close=")">
                        #{deptId}::text
                    </foreach>
                    OR apply_target_dept_id::text IN
                    <foreach collection="param.deptList" item="deptId" open="(" separator="," close=")">
                        #{deptId}::text
                    </foreach>
                )
            </if>
        </where>
    </select>
    <insert id="insertGdSupplyDemand" useGeneratedKeys="true" keyProperty="id">
        insert into ja_gd_supply_demand (
            demand_name,
            demand_type,
            contact_person,
            contact_phone,
            contact_email,
            demand_status,
            update_cycle,
            apply_basis,
            share_type,
            application_scene,
            responsible_dept_id,
            apply_target_dept_id,
            data_source,
            demand_info,
            area_code,
            create_user,
            create_dept,
            update_user
        ) values (
            #{demandName},
            #{demandType},
            #{contactPerson},
            #{contactPhone},
            #{contactEmail},
            #{demandStatus},
            #{updateCycle},
            #{applyBasis},
            #{shareType},
            #{applicationScene},
            #{responsibleDeptId},
            #{applyTargetDeptId},
            #{dataSource},
            #{demandInfo},
            #{areaCode},
            #{createUser},
            #{createDept},
            #{updateUser}
        )
    </insert>
    <update id="updateGdSupplyDemand">
        update ja_gd_supply_demand
        <set>
            <if test="demandName != null">
                demand_name = #{demandName},
            </if>
            <if test="demandType != null">
                demand_type = #{demandType},
            </if>
            <if test="contactPerson != null">
                contact_person = #{contactPerson},
            </if>
            <if test="contactPhone != null">
                contact_phone = #{contactPhone},
            </if>
            <if test="contactEmail != null">
                contact_email = #{contactEmail},
            </if>
            <if test="demandStatus != null">
                demand_status = #{demandStatus},
            </if>
            <if test="updateCycle != null">
                update_cycle = #{updateCycle},
            </if>
            <if test="applyBasis != null">
                apply_basis = #{applyBasis},
            </if>
            <if test="shareType != null">
                share_type = #{shareType},
            </if>
            <if test="applicationScene != null">
                application_scene = #{applicationScene},
            </if>
            <if test="responsibleDeptId != null">
                responsible_dept_id = #{responsibleDeptId},
            </if>
            <if test="applyTargetDeptId != null">
                apply_target_dept_id = #{applyTargetDeptId},
            </if>
            <if test="dataSource != null">
                data_source = #{dataSource},
            </if>
            <if test="demandInfo != null">
                demand_info = #{demandInfo},
            </if>
            <if test="areaCode != null">
                area_code = #{areaCode},
            </if>
            <if test="updateUser != null">
                update_user = #{updateUser},
            </if>
            <if test="status != null">
                status = #{status},
            </if>
        </set>
        where id = #{id}
    </update>
    <select id="exportGdSupplyDemand" resultType="org.sxkj.gd.orderdata.excel.GdSupplyDemandExcel">
        SELECT * FROM ja_gd_supply_demand ${ew.customSqlSegment}