Bonus-Cloud-Material/bonus-modules/bonus-material/src/main/resources/mapper/material/basic/BmAgreementInfoMapper.xml

155 lines
8.5 KiB
XML
Raw Normal View History

2024-09-26 16:15:51 +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.bonus.material.basic.mapper.BmAgreementInfoMapper">
<resultMap type="com.bonus.material.basic.domain.BmAgreementInfo" id="BmAgreementInfoResult">
<result property="agreementId" column="agreement_id" />
<result property="agreementCode" column="agreement_code" />
<result property="signTime" column="sign_time" />
<result property="unitId" column="unit_id" />
<result property="projectId" column="project_id" />
2024-11-11 15:36:36 +08:00
<result property="projectName" column="project_name" />
2024-09-26 16:15:51 +08:00
<result property="createBy" column="create_by" />
<result property="leaseDay" column="lease_day" />
<result property="planStartTime" column="plan_start_time" />
<result property="contractCode" column="contract_code" />
<result property="authPerson" column="auth_person" />
<result property="phone" column="phone" />
<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="companyId" column="company_id" />
<result property="fileName" column="file_name" />
<result property="fileUrl" column="file_url" />
<result property="status" column="status" />
<result property="protocol" column="protocol" />
<result property="isSlt" column="is_slt" />
</resultMap>
<select id="selectBmAgreementInfoList" parameterType="com.bonus.material.basic.domain.BmAgreementInfo" resultMap="BmAgreementInfoResult">
2024-11-11 15:36:36 +08:00
SELECT bai.agreement_id, bai.agreement_code , contract_code,file_url ,file_name,sign_time,
bu.unit_id,bu.unit_name , bp.pro_id as projectId , bp.pro_name as projectName,
plan_start_time,lease_day,auth_person,phone,bai.remark,bai.protocol
FROM bm_agreement_info bai
LEFT JOIN bm_project bp ON bp.pro_id = bai.project_id
LEFT JOIN bm_unit bu ON bu.unit_id = bai.unit_id
where bai.status = '1'
<if test="keyWord != null and keyWord != ''">
and (bai.contract_code like concat('%', #{keyWord}, '%') or
auth_person like concat('%', #{keyWord}, '%') or
phone like concat('%', #{keyWord}, '%'))
</if>
<if test="agreementCode != null and agreementCode != ''">
and bai.agreement_code like concat('%', #{agreementCode}, '%')
</if>
<if test="unitId != null and unitId != ''">
and bu.unit_id = #{unitId}
</if>
<if test="projectId != null and projectId != ''">
and bp.pro_id = #{projectId}
</if>
ORDER BY bai.agreement_id DESC
2024-09-26 16:15:51 +08:00
</select>
<select id="selectBmAgreementInfoByAgreementId" parameterType="Long" resultMap="BmAgreementInfoResult">
2024-11-11 15:36:36 +08:00
SELECT bai.agreement_id, bai.agreement_code , contract_code,file_url ,file_name,sign_time,
bu.unit_id,bu.unit_name , bp.pro_id as projectId , bp.pro_name as projectName,
plan_start_time,lease_day,auth_person,phone,bai.remark,bai.protocol
FROM bm_agreement_info bai
LEFT JOIN bm_project bp ON bp.pro_id = bai.project_id
LEFT JOIN bm_unit bu ON bu.unit_id = bai.unit_id
where bai.status = '1' and agreement_id = #{agreementId}
2024-09-26 16:15:51 +08:00
</select>
<insert id="insertBmAgreementInfo" parameterType="com.bonus.material.basic.domain.BmAgreementInfo" useGeneratedKeys="true" keyProperty="agreementId">
insert into bm_agreement_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="agreementCode != null">agreement_code,</if>
<if test="signTime != null">sign_time,</if>
<if test="unitId != null">unit_id,</if>
<if test="projectId != null">project_id,</if>
<if test="createBy != null">create_by,</if>
<if test="leaseDay != null">lease_day,</if>
<if test="planStartTime != null">plan_start_time,</if>
<if test="contractCode != null">contract_code,</if>
<if test="authPerson != null">auth_person,</if>
<if test="phone != null">phone,</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>
<if test="companyId != null">company_id,</if>
<if test="fileName != null">file_name,</if>
<if test="fileUrl != null">file_url,</if>
<if test="status != null">status,</if>
<if test="protocol != null">protocol,</if>
<if test="isSlt != null">is_slt,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="agreementCode != null">#{agreementCode},</if>
<if test="signTime != null">#{signTime},</if>
<if test="unitId != null">#{unitId},</if>
<if test="projectId != null">#{projectId},</if>
<if test="createBy != null">#{createBy},</if>
<if test="leaseDay != null">#{leaseDay},</if>
<if test="planStartTime != null">#{planStartTime},</if>
<if test="contractCode != null">#{contractCode},</if>
<if test="authPerson != null">#{authPerson},</if>
<if test="phone != null">#{phone},</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>
<if test="companyId != null">#{companyId},</if>
<if test="fileName != null">#{fileName},</if>
<if test="fileUrl != null">#{fileUrl},</if>
2024-11-12 14:18:42 +08:00
'1',
2024-09-26 16:15:51 +08:00
<if test="protocol != null">#{protocol},</if>
<if test="isSlt != null">#{isSlt},</if>
</trim>
</insert>
<update id="updateBmAgreementInfo" parameterType="com.bonus.material.basic.domain.BmAgreementInfo">
update bm_agreement_info
<trim prefix="SET" suffixOverrides=",">
<if test="agreementCode != null">agreement_code = #{agreementCode},</if>
<if test="signTime != null">sign_time = #{signTime},</if>
<if test="unitId != null">unit_id = #{unitId},</if>
<if test="projectId != null">project_id = #{projectId},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="leaseDay != null">lease_day = #{leaseDay},</if>
<if test="planStartTime != null">plan_start_time = #{planStartTime},</if>
<if test="contractCode != null">contract_code = #{contractCode},</if>
<if test="authPerson != null">auth_person = #{authPerson},</if>
<if test="phone != null">phone = #{phone},</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>
<if test="companyId != null">company_id = #{companyId},</if>
<if test="fileName != null">file_name = #{fileName},</if>
<if test="fileUrl != null">file_url = #{fileUrl},</if>
<if test="status != null">status = #{status},</if>
<if test="protocol != null">protocol = #{protocol},</if>
<if test="isSlt != null">is_slt = #{isSlt},</if>
</trim>
where agreement_id = #{agreementId}
</update>
<delete id="deleteBmAgreementInfoByAgreementId" parameterType="Long">
delete from bm_agreement_info where agreement_id = #{agreementId}
</delete>
<delete id="deleteBmAgreementInfoByAgreementIds" parameterType="String">
delete from bm_agreement_info where agreement_id in
<foreach item="agreementId" collection="array" open="(" separator="," close=")">
#{agreementId}
</foreach>
</delete>
2024-11-11 15:22:32 +08:00
<select id="selectNumByMonth" resultType="java.lang.Integer">
select count(*) from bm_agreement_info where DATE_FORMAT(create_time,'%y%m') = DATE_FORMAT(#{date},'%y%m')
</select>
2024-09-26 16:15:51 +08:00
</mapper>