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

253 lines
9.3 KiB
XML
Raw Normal View History

2024-03-05 16:53:10 +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.sgzb.material.mapper.WorkSiteDirectManageMapper">
2024-03-11 18:45:55 +08:00
<insert id="saveDirectApplyInfo" parameterType="com.bonus.sgzb.base.api.domain.DirectApplyInfo" keyColumn="id" keyProperty="id" useGeneratedKeys="true">
2024-03-05 16:53:10 +08:00
insert into direct_apply_info
(
<if test="code != null and code != ''">
code,
</if>
<if test="backAgreementId != null">
back_agreement_id,
</if>
<if test="backMan != null and backMan != ''">
back_man,
</if>
<if test="backPhone != null and backPhone != ''">
back_phone,
</if>
<if test="backRemark != null and backRemark != ''">
back_remark,
</if>
<if test="leaseAgreementId != null">
lease_agreement_id,
</if>
<if test="leaseMan != null and leaseMan != ''">
lease_man,
</if>
<if test="leasePhone != null and leasePhone != ''">
lease_phone,
</if>
<if test="dirUrl != null and dirUrl != ''">
dir_url,
</if>
<if test="status != null and status != ''">
status,
</if>
<if test="auditor != null and auditor != ''">
auditor,
</if>
<if test="auditTime != null and auditTime != ''">
audit_time,
</if>
<if test="auditRemark != null and auditRemark != ''">
audit_remark,
</if>
create_time
) values (
<if test="code != null and code != ''">
#{code},
</if>
<if test="backAgreementId != null">
#{backAgreementId},
</if>
<if test="backMan != null and backMan != ''">
#{backMan},
</if>
<if test="backPhone != null and backPhone != ''">
#{backPhone},
</if>
<if test="backRemark != null and backRemark != ''">
#{backRemark},
</if>
<if test="leaseAgreementId != null">
#{leaseAgreementId},
</if>
<if test="leaseMan != null and leaseMan != ''">
#{leaseMan},
</if>
<if test="leasePhone != null and leasePhone != ''">
#{leasePhone},
</if>
<if test="dirUrl != null and dirUrl != ''">
#{dirUrl},
</if>
<if test="status != null and status != ''">
#{status},
</if>
<if test="auditor != null and auditor != ''">
#{auditor},
</if>
<if test="auditTime != null and auditTime != ''">
#{auditTime},
</if>
<if test="auditRemark != null and auditRemark != ''">
#{auditRemark},
</if>
NOW()
)
</insert>
<insert id="saveDirectApplyDetails" parameterType="com.bonus.sgzb.base.api.domain.DirectApplyDetails">
insert into direct_apply_info(direct_id,type_id,ma_id,direct_num)
values (#{directId},#{typeId},#{maId}, #{directNum})
</insert>
2024-03-12 13:52:31 +08:00
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.bonus.sgzb.material.domain.LeaseApplyInfo" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into lease_apply_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="code != null">
code,
</if>
<if test="taskId != null">
task_id,
</if>
<if test="leasePerson != null and leasePerson != ''">
lease_person,
</if>
<if test="phone != null and phone != ''">
phone,
</if>
<if test="type != null and type != ''">
`type`,
</if>
<if test="companyAuditBy != null">
company_audit_by,
</if>
<if test="companyAuditTime != null and companyAuditTime != ''">
company_audit_time,
</if>
<if test="companyAuditRemark != null and companyAuditRemark != ''">
company_audit_remark,
</if>
<if test="deptAuditBy != null">
dept_audit_by,
</if>
<if test="deptAuditTime != null and deptAuditTime != ''">
dept_audit_time,
</if>
<if test="deptAuditRemark != null and deptAuditRemark != ''">
dept_audit_remark,
</if>
<if test="createBy != null and createBy != ''">
create_by,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateBy != null and updateBy != ''">
update_by,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="remark != null and remark != ''">
remark,
</if>
<if test="companyId != null">
company_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="code != null">
#{code,jdbcType=VARCHAR},
</if>
<if test="taskId != null">
#{taskId,jdbcType=INTEGER},
</if>
<if test="leasePerson != null and leasePerson != ''">
#{leasePerson,jdbcType=VARCHAR},
</if>
<if test="phone != null and phone != ''">
#{phone,jdbcType=VARCHAR},
</if>
<if test="type != null and type != ''">
#{type,jdbcType=VARCHAR},
</if>
<if test="companyAuditBy != null">
#{companyAuditBy,jdbcType=INTEGER},
</if>
<if test="companyAuditTime != null and companyAuditTime != ''">
#{companyAuditTime,jdbcType=VARCHAR},
</if>
<if test="companyAuditRemark != null and companyAuditRemark != ''">
#{companyAuditRemark,jdbcType=VARCHAR},
</if>
<if test="deptAuditBy != null">
#{deptAuditBy,jdbcType=INTEGER},
</if>
<if test="deptAuditTime != null and deptAuditTime != ''">
#{deptAuditTime,jdbcType=VARCHAR},
</if>
<if test="deptAuditRemark != null and deptAuditRemark != ''">
#{deptAuditRemark,jdbcType=VARCHAR},
</if>
<if test="createBy != null and createBy != ''">
#{createBy,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateBy != null and updateBy != ''">
#{updateBy,jdbcType=VARCHAR},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="remark != null and remark != ''">
#{remark,jdbcType=VARCHAR},
</if>
<if test="companyId != null">
#{companyId,jdbcType=INTEGER},
</if>
</trim>
</insert>
<insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into lease_apply_details
(parennt_id, type_id, pre_num, al_num, `status`, create_by, create_time, update_by,
update_time, remark, company_id)
values
<foreach collection="list" item="item" separator=",">
(#{item.parenntId,jdbcType=INTEGER}, #{item.typeId,jdbcType=INTEGER}, #{item.preNum,jdbcType=FLOAT},
#{item.alNum,jdbcType=FLOAT}, #{item.status,jdbcType=VARCHAR}, #{item.createBy,jdbcType=VARCHAR},
NOW(), #{item.updateBy,jdbcType=VARCHAR}, NOW(),
#{item.remark,jdbcType=VARCHAR}, #{item.companyId,jdbcType=INTEGER})
</foreach>
</insert>
2024-03-05 16:53:10 +08:00
<update id="refuseDirectApplyInfo">
update direct_apply_info set status = #{status} where id = #{id}
</update>
2024-03-12 13:52:31 +08:00
<delete id="batchDel">
delete
from lease_user_book
where id in
<foreach close=")" collection="ids" item="id" open="(" separator=", ">
#{id}
</foreach>
</delete>
2024-03-05 16:53:10 +08:00
<select id="getUseringData" resultType="com.bonus.sgzb.base.api.domain.SltAgreementInfo">
2024-03-11 18:45:55 +08:00
SELECT
sai.*,
mt.type_name AS typeModelName,
mt2.type_name AS typeName,
mm.ma_code AS maCode,
sum(sai.num) AS useNum
FROM
slt_agreement_info sai
LEFT JOIN ma_type mt on sai.type_id = mt.type_id
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
LEFT JOIN ma_machine mm on sai.ma_id = mm.ma_id
where sai.agreement_id = #{agreementId} and sai.status = '0'
GROUP BY
sai.type_id,sai.ma_id
2024-03-06 15:29:22 +08:00
</select>
<select id="getList" resultType="com.bonus.sgzb.base.api.domain.DirectApplyInfo">
select * from direct_apply_info
2024-03-05 16:53:10 +08:00
</select>
2024-03-12 13:52:31 +08:00
<select id="getDirectApplyInfoById" resultType="com.bonus.sgzb.base.api.domain.DirectApplyInfo">
select * from direct_apply_info where id = #{id}
</select>
2024-03-05 16:53:10 +08:00
</mapper>