devicesmgt/sgzb-modules/sgzb-material/src/main/resources/mapper/material/AgreementInfoMapper.xml

141 lines
6.9 KiB
XML
Raw Normal View History

<?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">
2023-12-16 20:52:13 +08:00
<mapper namespace="com.bonus.sgzb.material.mapper.AgreementInfoMapper">
2023-12-16 20:52:13 +08:00
<resultMap type="com.bonus.sgzb.material.domain.AgreementInfo" 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="unitName" column="unit_name"/>
<result property="projectId" column="project_id"/>
<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"/>
</resultMap>
<insert id="add">
insert into bm_agreement_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="agreementCode != null">agreement_code,</if>
<if test="signTime != null and signTime != ''">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>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="agreementCode != null">#{agreementCode},</if>
<if test="signTime != null and signTime != ''">#{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>
</trim>
</insert>
<update id="update">
update bm_agreement_info
<trim prefix="SET" suffixOverrides=",">
<if test="signTime != null and signTime != ''">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>
</trim>
where agreement_id = #{agreementId}
</update>
<update id="deleteByIds">
2023-12-19 09:44:55 +08:00
UPDATE bm_agreement_info SET status = '0' WHERE agreement_id = #{agreementId}
</update>
2023-12-16 20:52:13 +08:00
<select id="getAgreementInfoAll" resultType="com.bonus.sgzb.material.domain.AgreementInfo">
SELECT bai.agreement_id, bai.agreement_code , contract_code,file_url ,file_name,sign_time,
bui.unit_id,bui.unit_name , bp.lot_id as projectId , bp.lot_name as projectName,
plan_start_time,lease_day,auth_person,phone,bai.remark
FROM bm_agreement_info bai
LEFT JOIN bm_project_lot bp ON bp.lot_id = bai.project_id
LEFT JOIN bm_unit_info bui ON bui.unit_id = bai.unit_id
2023-12-19 09:44:55 +08:00
where bai.status = '1'
<if test="keyWord != null and keyWord != ''">
and bai.contract_code like concat('%', #{keyWord}, '%')
</if>
2023-12-19 09:44:55 +08:00
<if test="agreementCode != null and agreementCode != ''">
and bai.agreement_code like concat('%', #{agreementCode}, '%')
</if>
<if test="unitId != null and unitId != ''">
and bui.unit_id = #{unitId}
</if>
<if test="projectId != null and projectId != ''">
and bp.lot_id = #{projectId}
</if>
</select>
2023-12-16 20:52:13 +08:00
<select id="getUnitList" resultType="com.bonus.sgzb.material.domain.AgreementInfo">
SELECT unit_id , unit_name FROM bm_unit_info
WHERE del_flag = '0' and status = '0'
</select>
2023-12-16 20:52:13 +08:00
<select id="getProjectList" resultType="com.bonus.sgzb.material.domain.AgreementInfo">
SELECT lot_id as projectId,lot_name as projectName FROM `bm_project_lot`
WHERE del_flag = '0' and status = '0'
</select>
<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>
<select id="getAgreementInfoId" resultType="com.bonus.sgzb.material.domain.AgreementInfo">
SELECT * FROM bm_agreement_info
WHERE agreement_id = #{agreementId}
</select>
</mapper>