jhprjv2/yanzhu-jh/src/main/resources/mapper/project/SurProjectInsuranceMapper.xml

61 lines
2.7 KiB
XML
Raw Normal View History

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">
<result property="projectId" column="project_id" />
<result property="azxInsurance" column="azx_insurance" />
<result property="yqxInsurance" column="yqx_insurance" />
</resultMap>
<sql id="selectSurProjectInsuranceVo">
select project_id, azx_insurance, yqx_insurance from sur_project_insurance
</sql>
<select id="selectSurProjectInsuranceList" parameterType="SurProjectInsurance" resultMap="SurProjectInsuranceResult">
<include refid="selectSurProjectInsuranceVo"/>
<where>
<if test="azxInsurance != null and azxInsurance != ''"> and azx_insurance = #{azxInsurance}</if>
<if test="yqxInsurance != null and yqxInsurance != ''"> and yqx_insurance = #{yqxInsurance}</if>
</where>
</select>
<select id="selectSurProjectInsuranceByProjectId" parameterType="Long" resultMap="SurProjectInsuranceResult">
<include refid="selectSurProjectInsuranceVo"/>
where project_id = #{projectId}
</select>
<insert id="insertSurProjectInsurance" parameterType="SurProjectInsurance" useGeneratedKeys="true" keyProperty="projectId">
insert into sur_project_insurance
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="azxInsurance != null">azx_insurance,</if>
<if test="yqxInsurance != null">yqx_insurance,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="azxInsurance != null">#{azxInsurance},</if>
<if test="yqxInsurance != null">#{yqxInsurance},</if>
</trim>
</insert>
<update id="updateSurProjectInsurance" parameterType="SurProjectInsurance">
update sur_project_insurance
<trim prefix="SET" suffixOverrides=",">
<if test="azxInsurance != null">azx_insurance = #{azxInsurance},</if>
<if test="yqxInsurance != null">yqx_insurance = #{yqxInsurance},</if>
</trim>
where project_id = #{projectId}
</update>
<delete id="deleteSurProjectInsuranceByProjectId" parameterType="Long">
delete from sur_project_insurance where project_id = #{projectId}
</delete>
<delete id="deleteSurProjectInsuranceByProjectIds" parameterType="String">
delete from sur_project_insurance where project_id in
<foreach item="projectId" collection="array" open="(" separator="," close=")">
#{projectId}
</foreach>
</delete>
</mapper>