2023-08-10 21:09:49 +08:00
|
|
|
<?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.yanzhu.jh.project.mapper.SurProjectInsuranceMapper">
|
|
|
|
|
|
|
|
<resultMap type="SurProjectInsurance" id="SurProjectInsuranceResult">
|
2023-08-16 20:40:54 +08:00
|
|
|
<result property="id" column="id" />
|
2023-08-10 21:09:49 +08:00
|
|
|
<result property="projectId" column="project_id" />
|
2023-08-16 20:40:54 +08:00
|
|
|
<result property="deptId" column="dept_id" />
|
|
|
|
<result property="insuranceType" column="insurance_type" />
|
|
|
|
<result property="insuranceNumber" column="insurance_number" />
|
|
|
|
<result property="insuranceFile" column="insurance_file" />
|
|
|
|
<result property="insuranceState" column="insurance_state" />
|
|
|
|
<result property="beginDate" column="begin_date" />
|
|
|
|
<result property="endDate" column="end_date" />
|
|
|
|
<result property="companyName" column="company_name" />
|
|
|
|
<result property="isDel" column="is_del" />
|
|
|
|
<result property="createBy" column="create_by" />
|
|
|
|
<result property="createTime" column="create_time" />
|
|
|
|
<result property="updateBy" column="update_by" />
|
|
|
|
<result property="updateTime" column="update_time" />
|
|
|
|
<result property="remark" column="remark" />
|
|
|
|
<result property="insuranceTypeName" column="insurance_type_name" />
|
2023-08-10 21:09:49 +08:00
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
<sql id="selectSurProjectInsuranceVo">
|
2023-08-16 20:40:54 +08:00
|
|
|
select id, project_id, dept_id, insurance_type, insurance_number, insurance_file, insurance_state, begin_date, end_date, company_name, is_del, create_by, create_time, update_by, update_time, remark from sur_project_insurance
|
2023-08-10 21:09:49 +08:00
|
|
|
</sql>
|
|
|
|
|
|
|
|
<select id="selectSurProjectInsuranceList" parameterType="SurProjectInsurance" resultMap="SurProjectInsuranceResult">
|
|
|
|
<include refid="selectSurProjectInsuranceVo"/>
|
2023-08-16 20:40:54 +08:00
|
|
|
<where>
|
|
|
|
<if test="projectId != null "> and project_id = #{projectId}</if>
|
|
|
|
<if test="deptId != null "> and dept_id = #{deptId}</if>
|
|
|
|
<if test="insuranceType != null and insuranceType != ''"> and insurance_type = #{insuranceType}</if>
|
|
|
|
<if test="insuranceNumber != null and insuranceNumber != ''"> and insurance_number like concat('%', #{insuranceNumber}, '%')</if>
|
|
|
|
<if test="insuranceFile != null and insuranceFile != ''"> and insurance_file = #{insuranceFile}</if>
|
|
|
|
<if test="insuranceState != null and insuranceState != ''"> and insurance_state = #{insuranceState}</if>
|
|
|
|
<if test="companyName != null and companyName != ''"> and company_name like concat('%', #{companyName}, '%')</if>
|
|
|
|
<if test="isDel != null and isDel != ''"> and is_del = #{isDel}</if>
|
2023-08-10 21:09:49 +08:00
|
|
|
</where>
|
|
|
|
</select>
|
2023-08-16 20:40:54 +08:00
|
|
|
|
|
|
|
<select id="selectSurProjectInsuranceListv2" parameterType="SurProjectInsurance" resultMap="SurProjectInsuranceResult">
|
|
|
|
SELECT
|
|
|
|
spi.id,
|
|
|
|
spi.project_id,
|
|
|
|
sp.projectName,
|
|
|
|
sdd.dict_value,
|
|
|
|
sdd.dict_label as insurance_type_name,
|
|
|
|
spi.insurance_number,
|
|
|
|
spi.insurance_file,
|
|
|
|
CASE WHEN spi.insurance_state IS NULL THEN 0 ELSE 1 END AS insurance_state,
|
|
|
|
spi.begin_date,
|
|
|
|
spi.end_date,
|
|
|
|
spi.company_name,
|
|
|
|
spi.is_del,
|
|
|
|
spi.create_by,
|
|
|
|
spi.create_time,
|
|
|
|
spi.update_by,
|
|
|
|
spi.update_time,
|
|
|
|
spi.remark
|
|
|
|
FROM
|
|
|
|
sur_project sp
|
|
|
|
RIGHT JOIN sys_dict_data sdd ON sdd.dict_type = 'sur_project_insurance_type'
|
|
|
|
LEFT JOIN sur_project_insurance spi ON spi.project_id = sp.id
|
|
|
|
AND spi.insurance_type = sdd.dict_value
|
|
|
|
AND spi.dept_id = #{deptId}
|
|
|
|
AND spi.is_del = 0
|
|
|
|
<where>
|
|
|
|
and sdd.dict_type = 'sur_project_insurance_type'
|
|
|
|
<if test="projectId != null "> and sp.id = #{projectId}</if>
|
|
|
|
</where>
|
|
|
|
ORDER BY
|
|
|
|
sp.projectSort,
|
|
|
|
sdd.dict_sort
|
|
|
|
</select>
|
2023-08-17 15:51:00 +08:00
|
|
|
|
|
|
|
<!--查询项目保险统计列表-->
|
|
|
|
<select id="selectBgscreenInsuranceList" parameterType="SurProjectInsurance" resultType="map">
|
|
|
|
SELECT
|
|
|
|
sp.id,
|
|
|
|
sp.projectName,
|
|
|
|
CASE
|
|
|
|
WHEN azx.insurance_state IS NULL THEN
|
|
|
|
'未办理'
|
|
|
|
ELSE
|
|
|
|
'已办理'
|
|
|
|
END AS azxstate,
|
|
|
|
CASE
|
|
|
|
WHEN yqx.insurance_state IS NULL THEN
|
|
|
|
'未办理'
|
|
|
|
ELSE
|
|
|
|
'已办理'
|
|
|
|
END AS yqxstate
|
|
|
|
FROM
|
|
|
|
sur_project sp
|
|
|
|
LEFT JOIN sur_project_insurance azx ON azx.project_id = sp.id
|
|
|
|
AND azx.insurance_type = 1
|
|
|
|
LEFT JOIN sur_project_insurance yqx ON yqx.project_id = sp.id
|
|
|
|
AND yqx.insurance_type = 2
|
|
|
|
where sp.isDel=0
|
|
|
|
<if test="nowDept != null and nowDept != ''"> and sp.deptId = #{nowDept}</if>
|
|
|
|
<if test="projectId != null "> and sp.id = #{projectId}</if>
|
|
|
|
ORDER BY sp.projectSort ASC
|
|
|
|
</select>
|
2023-08-10 21:09:49 +08:00
|
|
|
|
2023-08-16 20:40:54 +08:00
|
|
|
<select id="selectSurProjectInsuranceById" parameterType="Long" resultMap="SurProjectInsuranceResult">
|
2023-08-10 21:09:49 +08:00
|
|
|
<include refid="selectSurProjectInsuranceVo"/>
|
2023-08-16 20:40:54 +08:00
|
|
|
where id = #{id}
|
2023-08-10 21:09:49 +08:00
|
|
|
</select>
|
|
|
|
|
2023-08-16 20:40:54 +08:00
|
|
|
<insert id="insertSurProjectInsurance" parameterType="SurProjectInsurance" useGeneratedKeys="true" keyProperty="id">
|
2023-08-10 21:09:49 +08:00
|
|
|
insert into sur_project_insurance
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
2023-08-16 20:40:54 +08:00
|
|
|
<if test="projectId != null">project_id,</if>
|
|
|
|
<if test="deptId != null">dept_id,</if>
|
|
|
|
<if test="insuranceType != null">insurance_type,</if>
|
|
|
|
<if test="insuranceNumber != null">insurance_number,</if>
|
|
|
|
<if test="insuranceFile != null">insurance_file,</if>
|
|
|
|
<if test="insuranceState != null">insurance_state,</if>
|
|
|
|
<if test="beginDate != null">begin_date,</if>
|
|
|
|
<if test="endDate != null">end_date,</if>
|
|
|
|
<if test="companyName != null">company_name,</if>
|
|
|
|
<if test="isDel != null">is_del,</if>
|
|
|
|
<if test="createBy != null">create_by,</if>
|
|
|
|
<if test="createTime != null">create_time,</if>
|
|
|
|
<if test="updateBy != null">update_by,</if>
|
|
|
|
<if test="updateTime != null">update_time,</if>
|
|
|
|
<if test="remark != null">remark,</if>
|
2023-08-10 21:09:49 +08:00
|
|
|
</trim>
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
2023-08-16 20:40:54 +08:00
|
|
|
<if test="projectId != null">#{projectId},</if>
|
|
|
|
<if test="deptId != null">#{deptId},</if>
|
|
|
|
<if test="insuranceType != null">#{insuranceType},</if>
|
|
|
|
<if test="insuranceNumber != null">#{insuranceNumber},</if>
|
|
|
|
<if test="insuranceFile != null">#{insuranceFile},</if>
|
|
|
|
<if test="insuranceState != null">#{insuranceState},</if>
|
|
|
|
<if test="beginDate != null">#{beginDate},</if>
|
|
|
|
<if test="endDate != null">#{endDate},</if>
|
|
|
|
<if test="companyName != null">#{companyName},</if>
|
|
|
|
<if test="isDel != null">#{isDel},</if>
|
|
|
|
<if test="createBy != null">#{createBy},</if>
|
|
|
|
<if test="createTime != null">#{createTime},</if>
|
|
|
|
<if test="updateBy != null">#{updateBy},</if>
|
|
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
|
|
<if test="remark != null">#{remark},</if>
|
2023-08-10 21:09:49 +08:00
|
|
|
</trim>
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
<update id="updateSurProjectInsurance" parameterType="SurProjectInsurance">
|
|
|
|
update sur_project_insurance
|
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
2023-08-16 20:40:54 +08:00
|
|
|
<if test="projectId != null">project_id = #{projectId},</if>
|
|
|
|
<if test="deptId != null">dept_id = #{deptId},</if>
|
|
|
|
<if test="insuranceType != null">insurance_type = #{insuranceType},</if>
|
|
|
|
<if test="insuranceNumber != null">insurance_number = #{insuranceNumber},</if>
|
|
|
|
<if test="insuranceFile != null">insurance_file = #{insuranceFile},</if>
|
|
|
|
<if test="insuranceState != null">insurance_state = #{insuranceState},</if>
|
|
|
|
<if test="beginDate != null">begin_date = #{beginDate},</if>
|
|
|
|
<if test="endDate != null">end_date = #{endDate},</if>
|
|
|
|
<if test="companyName != null">company_name = #{companyName},</if>
|
|
|
|
<if test="isDel != null">is_del = #{isDel},</if>
|
|
|
|
<if test="createBy != null">create_by = #{createBy},</if>
|
|
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
|
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
|
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
|
|
<if test="remark != null">remark = #{remark},</if>
|
2023-08-10 21:09:49 +08:00
|
|
|
</trim>
|
2023-08-16 20:40:54 +08:00
|
|
|
where id = #{id}
|
2023-08-10 21:09:49 +08:00
|
|
|
</update>
|
|
|
|
|
2023-08-16 20:40:54 +08:00
|
|
|
<delete id="deleteSurProjectInsuranceById" parameterType="Long">
|
|
|
|
delete from sur_project_insurance where id = #{id}
|
2023-08-10 21:09:49 +08:00
|
|
|
</delete>
|
|
|
|
|
2023-08-16 20:40:54 +08:00
|
|
|
<delete id="deleteSurProjectInsuranceByIds" parameterType="String">
|
|
|
|
delete from sur_project_insurance where id in
|
|
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
|
#{id}
|
2023-08-10 21:09:49 +08:00
|
|
|
</foreach>
|
|
|
|
</delete>
|
|
|
|
</mapper>
|