地质所 沉降监测网建设项目
zmk
2024-05-15 ee09a54de9dada5461e3df972df5cdb1cdd6bd16
javaweb-plus/javaweb-cms/src/main/resources/mapper/geo/ProjectMapper.xml
@@ -11,8 +11,8 @@
        <result property="code"    column="code"    />
        <result property="companyId"    column="company_id"    />
        <result property="companyName"    column="company_name"    />
        <result property="createTime"    column="create_time"    />
         <result property="endTime"    column="end_time"    />
        <result property="startTime"    column="start_time"    />
        <result property="endTime"    column="end_time"    />
        <result property="district"    column="district"    />
        <result property="fullName"    column="full_name"    />
        <result property="laborUnit"    column="labor_unit"    />
@@ -27,121 +27,37 @@
        <result property="statusChangeUser"    column="status_change_user"    />
        <result property="statusChangeReason"    column="status_change_reason"    />
        <result property="dataSource"    column="data_source"    />
        <result property="lng"    column="lng"    />
        <result property="lat"    column="lat"    />
        <result property="rate"    column="rate"    />
        <result property="createTime"    column="create_time"    />
    </resultMap>
    <sql id="selectProjectVo">
        select ids, address, city, code, company_id, create_time,end_time, district, full_name, labor_unit, leader, owner, province, serial_number, 'describe', status, is_deleted, status_change_user, status_change_reason, data_source from js_project
        select ids, address, city, code, company_id,start_time,end_time, district, full_name, labor_unit, leader, owner, province, serial_number, 'describe', status, is_deleted, status_change_user, status_change_reason, data_source,lng,lat,rate,create_time from js_project
    </sql>
    <select id="selectProjectList" parameterType="Project" resultMap="ProjectResult">
        <!-- <include refid="selectProjectVo"/>-->
        select
        p.ids,
        p.address,
        p.city,
        p.code,
        p.company_id,
        c.full_name AS company_name,
        p.create_time,
        p.end_time,
        p.district,
        p.full_name,
        p.labor_unit,
        p.leader,
        u.real_name AS leader_name,
        p.owner,
        p.province,
        p.serial_number,
        'p.describe',
        p.status,
        p.is_deleted,
        p.status_change_user,
        p.status_change_reason,
        p.data_source
        FROM
        js_project p
        LEFT JOIN js_company_user u ON p.leader = u.ids
        LEFT JOIN js_company c ON p.company_id = c.ids
       <include refid="selectProjectVo"/>
        <where>
            p.is_deleted='0'
            <if test="address != null  and address != ''"> and p.address = #{address}</if>
            <if test="city != null "> and p.city = #{city}</if>
            <if test="code != null  and code != ''"> and p.code = #{code}</if>
            <if test="companyId != null "> and p.company_id = #{companyId}</if>
            <if test="district != null  and district != ''"> and p.district = #{district}</if>
            <if test="fullName != null  and fullName != ''"> and p.full_name like concat('%', #{fullName}, '%')</if>
            <if test="laborUnit != null  and laborUnit != ''"> and p.labor_unit = #{laborUnit}</if>
            <if test="leader != null  and leader != ''"> and p.leader = #{leader}</if>
            <if test="owner != null  and owner != ''"> and p.owner = #{owner}</if>
            <if test="province != null  and province != ''"> and p.province = #{province}</if>
            <if test="serialNumber != null  and serialNumber != ''"> and p.serial_number = #{serialNumber}</if>
            <if test="describe != null  and describe != ''"> and p.describe = #{describe}</if>
            <if test="status != null  and status != ''"> and p.status = #{status}</if>
            <if test="isDeleted != null  and isDeleted != ''"> and p.is_deleted = #{isDeleted}</if>
            ORDER BY p.create_time DESC
            <if test="address != null  and address != ''"> and address = #{address}</if>
            <if test="city != null "> and city = #{city}</if>
            <if test="code != null  and code != ''"> and code = #{code}</if>
            <if test="district != null  and district != ''"> and district = #{district}</if>
            <if test="fullName != null  and fullName != ''"> and full_name like concat('%', #{fullName}, '%')</if>
            <if test="laborUnit != null  and laborUnit != ''"> and labor_unit = #{laborUnit}</if>
            <if test="leader != null  and leader != ''"> and leader = #{leader}</if>
            <if test="owner != null  and owner != ''"> and owner = #{owner}</if>
            <if test="province != null  and province != ''"> and province = #{province}</if>
            <if test="serialNumber != null  and serialNumber != ''"> and serial_number = #{serialNumber}</if>
            <if test="status != null  and status != ''"> and status = #{status}</if>
            <if test="isDeleted != null  and isDeleted != ''"> and is_deleted = #{isDeleted}</if>
        </where>
    </select>
    
    <select id="selectProjectById" parameterType="String" resultMap="ProjectResult">
        select
        p.ids,
        p.address,
        p.city,
        p.code,
        p.company_id,
        c.full_name AS company_name,
        p.create_time,
        p.end_time,
        p.district,
        p.full_name,
        p.labor_unit,
        p.leader,
        u.real_name AS leader_name,
        p.owner,
        p.province,
        p.serial_number,
        'p.describe',
        p.status,
        p.is_deleted,
        p.status_change_user,
        p.status_change_reason,
        p.data_source
        FROM
        js_project p
        LEFT JOIN js_company_user u ON p.leader = u.ids
        LEFT JOIN js_company c ON p.company_id = c.ids
        WHERE  p.is_deleted='0' and  p.ids = #{ids}
    </select>
    <select id="selectProjectBySerialNumber" resultMap="ProjectResult">
       <include refid="selectProjectVo"/>
        where  serial_number = #{serialNumber} and is_deleted='0'
    </select>
    <select id="selectAllProjectNum" resultType="java.lang.Long">
        SELECT count(ids) FROM js_project WHERE is_deleted = '0'
    </select>
    <select id="selectProjectNum" resultType="java.lang.Long">
        SELECT count(ids) FROM js_project WHERE `status` = '0' AND is_deleted = '0'
    </select>
    <select id="proExceptionList" resultMap="ProjectResult">
        SELECT
             p.ids,
             p.full_name,
             c.full_name as company_name,
             u.real_name as leader_name
        FROM
            js_project p,
            js_company_user u,
            js_company c
        WHERE
            p.leader = u.ids
            AND p.company_id = c.ids
            AND p.is_deleted = '0'
          AND p.ids = ANY ( SELECT project_id FROM js_handle_exception WHERE is_delete = '0' GROUP BY project_id )
        <include refid="selectProjectVo"/>
        WHERE ids = #{ids}
    </select>
    <insert id="insertProject" parameterType="Project">
@@ -152,7 +68,8 @@
            <if test="city != null ">city,</if>
            <if test="code != null  and code != ''">code,</if>
            <if test="companyId != null ">company_id,</if>
            <if test="createTime != null ">create_time,</if>
            <if test="startTime != null ">start_time,</if>
            <if test="endTime != null ">end_time,</if>
            <if test="district != null  and district != ''">district,</if>
            <if test="fullName != null  and fullName != ''">full_name,</if>
            <if test="laborUnit != null  and laborUnit != ''">labor_unit,</if>
@@ -166,6 +83,10 @@
            <if test="statusChangeUser != null  and statusChangeUser != ''">status_change_user,</if>
            <if test="statusChangeReason != null  and statusChangeReason != ''">status_change_reason,</if>
            <if test="dataSource != null  and dataSource != ''">data_source,</if>
            <if test="lng != null">lng,</if>
            <if test="lat != null">lat,</if>
            <if test="rate != null  and rate != ''">rate,</if>
            <if test="createTime != null ">create_time,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="ids != null  and ids != ''">#{ids},</if>
@@ -173,7 +94,9 @@
            <if test="city != null ">#{city},</if>
            <if test="code != null  and code != ''">#{code},</if>
            <if test="companyId != null ">#{companyId},</if>
            <if test="createTime != null ">#{createTime},</if>
            <if test="startTime != null ">#{startTime},</if>
            <if test="endTime != null ">#{endTime},</if>
            <if test="district != null  and district != ''">#{district},</if>
            <if test="fullName != null  and fullName != ''">#{fullName},</if>
            <if test="laborUnit != null  and laborUnit != ''">#{laborUnit},</if>
@@ -187,6 +110,10 @@
            <if test="statusChangeUser != null  and statusChangeUser != ''">#{statusChangeUser},</if>
            <if test="statusChangeReason != null  and isDeleted != ''">#{statusChangeReason},</if>
            <if test="dataSource != null  and dataSource != ''">#{dataSource},</if>
            <if test="lng != null">#{lng},</if>
            <if test="lat != null">#{lat},</if>
            <if test="rate != null  and rate != ''">#{rate},</if>
            <if test="createTime != null ">#{createTime},</if>
         </trim>
    </insert>
@@ -197,7 +124,8 @@
            <if test="city != null ">city = #{city},</if>
            <if test="code != null  and code != ''">code = #{code},</if>
            <if test="companyId != null ">company_id = #{companyId},</if>
            <if test="createTime != null ">create_time = #{createTime},</if>
            <if test="startTime != null ">start_time = #{startTime},</if>
            <if test="endTime != null ">end_time = #{endTime},</if>
            <if test="district != null  and district != ''">district = #{district},</if>
            <if test="fullName != null  and fullName != ''">full_name = #{fullName},</if>
            <if test="laborUnit != null  and laborUnit != ''">labor_unit = #{laborUnit},</if>
@@ -211,6 +139,10 @@
            <if test="statusChangeUser != null  and statusChangeUser != ''">status_change_user = #{statusChangeUser},</if>
            <if test="statusChangeReason != null  and statusChangeReason != ''">status_change_reason = #{statusChangeReason},</if>
            <if test="dataSource != null  and dataSource != ''">data_source = #{dataSource},</if>
            <if test="lng != null">lng = #{lng},</if>
            <if test="lat != null">lat = #{lat},</if>
            <if test="rate != null  and rate != ''">rate = #{rate},</if>
            <if test="createTime != null ">create_time = #{createTime},</if>
        </trim>
        where ids = #{ids}
    </update>