2024-03-01 17:57:05 +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.SecondaryWarehouseMapper">
|
|
|
|
|
<insert id="addOperate">
|
2024-03-26 18:06:37 +08:00
|
|
|
insert into team_lease_info (agreement_id,type_id,team_name,lease_man,phone,num,create_by,create_time,type)
|
|
|
|
|
values (#{agreementId},#{typeId},#{teamName},#{leaseMan},#{phone},#{num},#{createBy},now(),#{type});
|
2024-03-01 17:57:05 +08:00
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<select id="getList" resultType="com.bonus.sgzb.material.domain.SecondaryWarehouse">
|
|
|
|
|
SELECT
|
2024-03-26 18:06:37 +08:00
|
|
|
bui.unit_id AS unitId,
|
2024-07-24 18:50:46 +08:00
|
|
|
lod.id as id,
|
2024-07-24 11:27:54 +08:00
|
|
|
tta.agreement_id AS agreementId,
|
2024-03-26 18:06:37 +08:00
|
|
|
bui.unit_name AS unitName,
|
|
|
|
|
bp.lot_name AS proName,
|
|
|
|
|
mt1.type_name AS typeName,
|
|
|
|
|
mt.type_name AS modelName,
|
|
|
|
|
mt.unit_name AS nuitName,
|
2024-07-24 11:27:54 +08:00
|
|
|
lod.type_id AS typeId,
|
2024-07-24 18:50:46 +08:00
|
|
|
IFNULL(SUM( lod.out_num ),0) AS Num
|
|
|
|
|
|
2024-07-24 11:27:54 +08:00
|
|
|
from lease_out_details lod
|
|
|
|
|
left join lease_apply_info lai on lod.parent_id=lai.id
|
|
|
|
|
left join tm_task_agreement tta on lai.task_id=tta.task_id
|
|
|
|
|
LEFT JOIN bm_agreement_info bai ON tta.agreement_id = bai.agreement_id
|
2024-03-26 18:06:37 +08:00
|
|
|
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
|
2024-07-24 11:27:54 +08:00
|
|
|
LEFT JOIN ma_type mt ON lod.type_id = mt.type_id
|
2024-03-26 18:06:37 +08:00
|
|
|
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
|
|
|
|
|
WHERE 1=1
|
2024-03-01 17:57:05 +08:00
|
|
|
<if test="unitId != null and unitId != ''">
|
|
|
|
|
and bui.unit_id = #{unitId}
|
|
|
|
|
</if>
|
2024-03-26 18:06:37 +08:00
|
|
|
<if test="proId != null and proId != ''">
|
|
|
|
|
and bp.lot_id = #{proId}
|
|
|
|
|
</if>
|
2024-03-01 17:57:05 +08:00
|
|
|
<if test="typeId != null and typeId != ''">
|
|
|
|
|
and mt1.type_id = #{typeId}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="modelId != null and modelId != ''">
|
|
|
|
|
and mt.type_id = #{modelId}
|
|
|
|
|
</if>
|
2024-07-24 11:27:54 +08:00
|
|
|
<if test="leaseType != null and leaseType != ''">
|
|
|
|
|
and lai.lease_type = #{leaseType}
|
|
|
|
|
</if>
|
2024-03-01 17:57:05 +08:00
|
|
|
<if test="keyword != null and keyword != ''">
|
|
|
|
|
and (bui.unit_name like concat('%', #{keyword}, '%') or
|
2024-03-26 18:06:37 +08:00
|
|
|
bp.lot_name like concat('%', #{keyword}, '%') or
|
2024-03-01 17:57:05 +08:00
|
|
|
mt1.type_name like concat('%', #{keyword}, '%') or
|
|
|
|
|
mt.type_name like concat('%', #{keyword}, '%')
|
|
|
|
|
)
|
|
|
|
|
</if>
|
|
|
|
|
GROUP BY
|
2024-07-24 11:27:54 +08:00
|
|
|
tta.agreement_id,
|
|
|
|
|
lod.type_id
|
2024-03-01 17:57:05 +08:00
|
|
|
</select>
|
|
|
|
|
<select id="getOperateList" resultType="com.bonus.sgzb.material.domain.TeamLeaseInfo">
|
2024-03-26 18:06:37 +08:00
|
|
|
SELECT
|
|
|
|
|
bui.unit_name AS unitName,
|
|
|
|
|
bp.lot_name AS proName,
|
|
|
|
|
mt1.type_name AS typeName,
|
|
|
|
|
mt.type_name AS modelName,
|
|
|
|
|
tli.num,
|
|
|
|
|
tli.lease_man AS leaseMan,
|
|
|
|
|
su.nick_name AS createBy,
|
|
|
|
|
tli.create_time AS createTime
|
|
|
|
|
FROM
|
|
|
|
|
team_lease_info tli
|
|
|
|
|
LEFT JOIN bm_agreement_info bai ON tli.agreement_id = bai.agreement_id
|
|
|
|
|
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
|
2024-03-01 17:57:05 +08:00
|
|
|
LEFT JOIN ma_type mt ON tli.type_id = mt.type_id
|
|
|
|
|
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
|
2024-03-26 18:06:37 +08:00
|
|
|
LEFT JOIN sys_user su ON su.user_id = tli.create_by
|
2024-03-01 17:57:05 +08:00
|
|
|
where tli.type = #{type}
|
|
|
|
|
<if test="unitId != null and unitId != ''">
|
|
|
|
|
and bui.unit_id = #{unitId}
|
|
|
|
|
</if>
|
2024-03-26 18:06:37 +08:00
|
|
|
<if test="proId != null and proId != ''">
|
|
|
|
|
and bp.lot_id = #{proId}
|
|
|
|
|
</if>
|
2024-03-01 17:57:05 +08:00
|
|
|
<if test="typeId != null and typeId != ''">
|
|
|
|
|
and mt1.type_id = #{typeId}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="modelId != null and modelId != ''">
|
|
|
|
|
and mt.type_id = #{modelId}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="keyword != null and keyword != ''">
|
|
|
|
|
and (bui.unit_name like concat('%', #{keyword}, '%') or
|
2024-03-26 18:06:37 +08:00
|
|
|
bp.lot_name like concat('%', #{keyword}, '%') or
|
2024-03-01 17:57:05 +08:00
|
|
|
mt1.type_name like concat('%', #{keyword}, '%') or
|
|
|
|
|
mt.type_name like concat('%', #{keyword}, '%') or
|
|
|
|
|
tli.lease_man like concat('%', #{keyword}, '%') or
|
|
|
|
|
su.nick_name like concat('%', #{keyword}, '%')
|
|
|
|
|
)
|
|
|
|
|
</if>
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getRecordsOne" resultType="com.bonus.sgzb.material.domain.TeamLeaseInfo">
|
|
|
|
|
SELECT
|
|
|
|
|
mt1.type_name AS typeName,
|
|
|
|
|
mt.type_name AS modelName,
|
|
|
|
|
mt.unit_name as nuitName,
|
|
|
|
|
sai.num AS num,
|
|
|
|
|
sai.start_time as startTime
|
|
|
|
|
FROM
|
|
|
|
|
slt_agreement_info sai
|
|
|
|
|
LEFT JOIN ma_type mt ON sai.type_id = mt.type_id
|
|
|
|
|
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
|
2024-03-26 18:06:37 +08:00
|
|
|
where mt.type_id = #{typeId} and sai.agreement_id=#{agreementId}
|
2024-03-01 17:57:05 +08:00
|
|
|
<if test="startTime != null and startTime != ''">
|
|
|
|
|
and DATE(sai.start_time) = #{startTime}
|
|
|
|
|
</if>
|
|
|
|
|
order by sai.start_time desc
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getRecordsTwo" resultType="com.bonus.sgzb.material.domain.TeamLeaseInfo">
|
|
|
|
|
SELECT
|
|
|
|
|
mt1.type_name AS typeName,
|
|
|
|
|
mt.type_name AS modelName,
|
|
|
|
|
mt.unit_name as nuitName,
|
|
|
|
|
sai.num AS num,
|
|
|
|
|
sai.end_time as startTime
|
|
|
|
|
FROM
|
|
|
|
|
slt_agreement_info sai
|
|
|
|
|
LEFT JOIN ma_type mt ON sai.type_id = mt.type_id
|
|
|
|
|
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
|
2024-03-26 18:06:37 +08:00
|
|
|
where sai.agreement_id=#{agreementId} and mt.type_id = #{typeId} and sai.status = '1'
|
2024-03-01 17:57:05 +08:00
|
|
|
<if test="startTime != null and startTime != ''">
|
|
|
|
|
and DATE(sai.end_time) = #{startTime}
|
|
|
|
|
</if>
|
|
|
|
|
order by sai.end_time desc
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getRecordsThree" resultType="com.bonus.sgzb.material.domain.TeamLeaseInfo">
|
|
|
|
|
SELECT
|
|
|
|
|
mt1.type_name AS typeName,
|
|
|
|
|
mt.type_name AS modelName,
|
|
|
|
|
mt.unit_name as nuitName,
|
|
|
|
|
sai.num AS num,
|
|
|
|
|
sai.start_time as startTime
|
|
|
|
|
FROM
|
|
|
|
|
slt_agreement_info sai
|
|
|
|
|
LEFT JOIN ma_type mt ON sai.type_id = mt.type_id
|
|
|
|
|
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
|
2024-03-26 18:06:37 +08:00
|
|
|
where sai.agreement_id=#{agreementId} and mt.type_id = #{typeId} and sai.status = '0'
|
2024-03-01 17:57:05 +08:00
|
|
|
<if test="startTime != null and startTime != ''">
|
|
|
|
|
and DATE(sai.start_time) = #{startTime}
|
|
|
|
|
</if>
|
|
|
|
|
order by sai.start_time desc
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getRecordsFour" resultType="com.bonus.sgzb.material.domain.TeamLeaseInfo">
|
2024-03-15 18:00:23 +08:00
|
|
|
select tli.team_name as teamName,
|
2024-03-01 17:57:05 +08:00
|
|
|
mt1.type_name AS typeName,
|
|
|
|
|
mt.type_name AS modelName,
|
|
|
|
|
tli.num,
|
|
|
|
|
su.nick_name as createBy,
|
|
|
|
|
tli.create_time as startTime
|
|
|
|
|
from team_lease_info tli
|
|
|
|
|
LEFT JOIN ma_type mt ON tli.type_id = mt.type_id
|
|
|
|
|
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
|
|
|
|
|
left join sys_user su on su.user_id = tli.create_by
|
2024-03-26 18:06:37 +08:00
|
|
|
where tli.agreement_id=#{agreementId} and mt.type_id = #{typeId} and tli.type = '1'
|
|
|
|
|
<if test="startTime != null and startTime != ''">
|
|
|
|
|
and DATE(tli.create_time) = #{startTime}
|
|
|
|
|
</if>
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getRecordsFive" resultType="com.bonus.sgzb.material.domain.TeamLeaseInfo">
|
|
|
|
|
select tli.team_name as teamName,
|
|
|
|
|
mt1.type_name AS typeName,
|
|
|
|
|
mt.type_name AS modelName,
|
|
|
|
|
tli.num,
|
|
|
|
|
su.nick_name as createBy,
|
|
|
|
|
tli.create_time as startTime
|
|
|
|
|
from team_lease_info tli
|
|
|
|
|
LEFT JOIN ma_type mt ON tli.type_id = mt.type_id
|
|
|
|
|
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
|
|
|
|
|
left join sys_user su on su.user_id = tli.create_by
|
|
|
|
|
where tli.agreement_id=#{agreementId} and mt.type_id = #{typeId} and tli.type = '2'
|
2024-03-01 17:57:05 +08:00
|
|
|
<if test="startTime != null and startTime != ''">
|
|
|
|
|
and DATE(tli.create_time) = #{startTime}
|
|
|
|
|
</if>
|
|
|
|
|
</select>
|
2024-07-24 18:50:46 +08:00
|
|
|
<select id="selectStockNum" resultType="java.lang.Integer">
|
|
|
|
|
SELECT
|
|
|
|
|
(
|
|
|
|
|
SUM(
|
|
|
|
|
IF
|
|
|
|
|
( rd.type = 1, rd.out_num, 0 )) - SUM(
|
|
|
|
|
IF
|
|
|
|
|
( rd.type = 2, rd.out_num, 0 ))) AS receiveNum
|
|
|
|
|
FROM
|
|
|
|
|
receive_detail rd
|
|
|
|
|
WHERE
|
|
|
|
|
parent_id = #{id}
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getNewRecords" resultType="com.bonus.sgzb.material.domain.TeamLeaseInfo">
|
|
|
|
|
select mt.type_name modelName,
|
|
|
|
|
mt2.type_name typeName,
|
|
|
|
|
su.nick_name nickName,
|
|
|
|
|
rd.out_num outNum,
|
|
|
|
|
rd.pick_name pickName,
|
|
|
|
|
rd.out_time outTime
|
|
|
|
|
from receive_detail rd
|
|
|
|
|
left join ma_type mt on rd.type_id = mt.type_id
|
|
|
|
|
left join ma_type mt2 on mt.parent_id = mt2.type_id
|
|
|
|
|
left join sys_user su on rd.out_name = su.user_id
|
2024-07-25 15:56:07 +08:00
|
|
|
where rd.type = 1
|
2024-07-24 18:50:46 +08:00
|
|
|
<if test="typeId != null and typeId != ''">
|
|
|
|
|
and mt2.type_id = #{typeId}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="modelId != null and modelId != ''">
|
|
|
|
|
and mt.type_id = #{modelId}
|
|
|
|
|
</if>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<insert id="addNewOperate">
|
|
|
|
|
insert into receive_detail (parent_id,type_id,out_num,out_time,type,out_name)
|
|
|
|
|
values (#{id},#{typeId},#{outNum},now(),#{type},#{createBy});
|
|
|
|
|
</insert>
|
|
|
|
|
</mapper>
|