devicesmgt/sgzb-modules/sgzb-material/src/main/resources/mapper/material/InventoryAndWarehousingMapp...

214 lines
8.6 KiB
XML
Raw Normal View History

2024-03-28 09:29:57 +08:00
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
2024-04-02 13:19:59 +08:00
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
2024-03-28 09:29:57 +08:00
<mapper namespace="com.bonus.sgzb.material.mapper.InventoryAndWarehousingMapper">
2024-03-29 17:41:31 +08:00
<insert id="saveDetails" useGeneratedKeys="true" keyProperty="id">
INSERT INTO ma_type_put_in_storage_details (NUM,
<trim prefix="" suffixOverrides=",">
2024-04-02 13:19:59 +08:00
<if test="id != null and id != ''">
INFO,
</if>
<if test="typeId != null and typeId != ''">
TYPE,
</if>
2024-03-29 17:41:31 +08:00
<if test="maId != null and maId != ''">
MACHINE,
</if>
<if test="remarks != null and remarks != ''">
REMARKS,
</if>
<if test="maCode != null and maCode != ''">
2024-04-17 10:47:29 +08:00
MACODE,
2024-03-29 17:41:31 +08:00
</if>
</trim>
)
VALUES (1,
<trim prefix="" suffixOverrides=",">
2024-04-02 13:19:59 +08:00
<if test="id != null and id != ''">
#{id},
</if>
<if test="typeId != null and typeId != ''">
#{typeId},
</if>
2024-03-29 17:41:31 +08:00
<if test="maId != null and maId != ''">
#{maId},
</if>
<if test="remarks != null and remarks != ''">
#{remarks},
</if>
<if test="maCode != null and maCode != ''">
#{maCode},
</if>
</trim>
)
</insert>
2024-04-02 13:19:59 +08:00
<insert id="saveInfo" useGeneratedKeys="true" keyProperty="id">
2024-03-29 17:41:31 +08:00
INSERT INTO ma_type_put_in_storage_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="putInType != null and putInType != ''">PUT_IN_TYPE,</if>
2024-04-02 13:19:59 +08:00
<choose>
<when test="isCode and num != null and num != 0">
NUM,
</when>
<otherwise>
<if test="putInStoreNum != null and putInStoreNum != 0">
NUM,
</if>
</otherwise>
</choose>
2024-03-29 17:41:31 +08:00
<if test="creator != null and creator != ''">CREATOR,</if>
2024-04-07 14:29:02 +08:00
<if test="unitId != null and unitId != ''">UNIT_ID,</if>
<if test="proId != null and proId != ''">PROJECT_ID,</if>
2024-04-17 15:07:29 +08:00
<if test="code != null and code != ''">CODE,</if>
2024-03-29 17:41:31 +08:00
CREATE_DATE,
2024-04-02 13:19:59 +08:00
<choose>
<when test="isCode and remarks != null and remarks != ''">
REMARKS
</when>
<otherwise>
<if test="remark != null and remark != ''">
REMARKS
</if>
</otherwise>
</choose>
2024-03-29 17:41:31 +08:00
</trim>
VALUES
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="putInType != null and putInType != ''">#{putInType},</if>
2024-04-02 13:19:59 +08:00
<choose>
<when test="isCode and num != null and num != 0">
#{num},
</when>
<otherwise>
<if test="putInStoreNum != null and putInStoreNum != 0">
#{putInStoreNum},
</if>
</otherwise>
</choose>
2024-03-29 17:41:31 +08:00
<if test="creator != null and creator != ''">#{creator},</if>
2024-04-07 14:29:02 +08:00
<if test="unitId != null and unitId != ''">#{unitId},</if>
<if test="proId != null and proId != ''">#{proId},</if>
2024-04-17 15:07:29 +08:00
<if test="code != null and code != ''">#{code},</if>
2024-03-29 17:41:31 +08:00
sysdate(),
2024-04-02 13:19:59 +08:00
<choose>
<when test="isCode and remarks != null and remarks != ''">
#{remarks}
</when>
<otherwise>
<if test="remark != null and remark != ''">
#{remark}
</if>
</otherwise>
</choose>
2024-03-29 17:41:31 +08:00
</trim>
</insert>
<insert id="insertMachine" useGeneratedKeys="true" keyProperty="maId">
insert into ma_machine (
<if test="typeId != null and typeId != '' ">type_id,</if>
<if test="maCode != null and maCode != '' ">ma_code,</if>
ma_status,
<if test="code != null and code != ''">qr_code,</if>
<if test="buyPrice != null and buyPrice != ''">buy_price,</if>
<if test="maVender != null and maVender != ''">ma_vender,</if>
2024-04-02 13:19:59 +08:00
<if test="checkMan != null and checkMan != ''">check_man,</if>
2024-03-29 17:41:31 +08:00
<if test="outFacCode != null and outFacCode != ''">out_fac_code,</if>
<if test="thisCheckTime != null and thisCheckTime != ''">this_check_time,</if>
<if test="nextCheckTime != null and nextCheckTime != ''">next_check_time,</if>
create_time
)values(
<if test="typeId != null and typeId != ''">#{typeId},</if>
<if test="maCode != null and maCode != ''">#{maCode},</if>
15,
<if test="code != null and code != ''">#{code},</if>
<if test="buyPrice != null and buyPrice != ''">#{buyPrice},</if>
<if test="maVender != null and maVender != ''">#{maVender},</if>
2024-04-02 13:19:59 +08:00
<if test="checkMan != null and checkMan != ''">#{checkMan},</if>
2024-03-29 17:41:31 +08:00
<if test="outFacCode != null and outFacCode != ''">#{outFacCode},</if>
<if test="thisCheckTime != null and thisCheckTime != ''">#{thisCheckTime},</if>
<if test="nextCheckTime != null and nextCheckTime != ''">#{nextCheckTime},</if>
sysdate()
)
</insert>
<insert id="insertMachineLabel">
insert into ma_machine_label
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="code != null">label_code,</if>
<if test="maId != null">ma_id,</if>
is_bind,
label_type,
create_time
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="code != null">#{code},</if>
<if test="maId != null">#{maId},</if>
1,
9,
now()
</trim>
</insert>
<insert id="insertLabelBind">
insert into ma_label_bind
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="maId != null">ma_id,</if>
<if test="code != null">label_code,</if>
<if test="typeId != null">type_id,</if>
2024-04-17 15:07:29 +08:00
<if test="creator != null">binder,</if>
2024-03-29 17:41:31 +08:00
label_type,
bind_time,
status
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="maId != null">#{maId},</if>
<if test="code != null">#{code},</if>
<if test="typeId != null">#{typeId},</if>
2024-04-17 15:07:29 +08:00
<if test="creator != null">#{creator},</if>
2024-03-29 17:41:31 +08:00
9,
now(),
1
</trim>
</insert>
<update id="updateMaType">
UPDATE ma_type
2024-04-02 13:19:59 +08:00
SET num = num + #{num},
update_time = now()
2024-03-29 17:41:31 +08:00
<where>
2024-04-02 13:19:59 +08:00
<if test="typeId != null ">and type_id = #{typeId}</if>
2024-03-29 17:41:31 +08:00
</where>
</update>
2024-03-28 09:29:57 +08:00
<select id="getList" resultType="com.bonus.sgzb.material.domain.PutInStorageBean">
2024-04-02 13:19:59 +08:00
SELECT pisi.PUT_IN_TYPE as putInType,
lot.lot_name as projectName,
bui.unit_name as unitName,
2024-04-17 15:07:29 +08:00
pisi.`CODE` as kindName,
2024-04-02 13:19:59 +08:00
mt2.type_name as typeName,
2024-04-17 15:07:29 +08:00
su.user_name as modelName,
pisi.CREATE_DATE as createDate,
pisi.REMARKS as remark
2024-04-02 13:19:59 +08:00
FROM ma_type_put_in_storage_info pisi
LEFT JOIN ma_type_put_in_storage_details pisd on pisi.id = pisd.INFO
LEFT JOIN bm_project_lot lot on lot.lot_id = pisi.PROJECT_ID
LEFT JOIN bm_unit_info bui on bui.unit_id = pisi.UNIT_ID
LEFT JOIN ma_type mt on mt.type_id = pisd.TYPE
LEFT JOIN ma_type mt2 on mt2.type_id = mt.parent_id
LEFT JOIN sys_user su on su.user_id = pisi.CREATOR
2024-04-17 15:07:29 +08:00
where
1 = 1
<if test="keyWord != null and keyWord != ''">
2024-04-17 15:32:23 +08:00
and (
pisi.`CODE` like concat('%',#{keyWord},'%') or
pisi.PUT_IN_TYPE like concat('%',#{keyWord},'%') or
2024-04-17 15:07:29 +08:00
lot.lot_name like concat('%',#{keyWord},'%') or
bui.unit_name like concat('%',#{keyWord},'%') or
mt2.type_name like concat('%',#{keyWord},'%') or
su.user_name like concat('%',#{keyWord},'%') or
2024-04-17 15:32:23 +08:00
pisi.REMARKS like concat('%',#{keyWord},'%')
2024-04-17 15:07:29 +08:00
)
</if>
order by pisi.CREATE_DATE desc
2024-03-28 09:29:57 +08:00
</select>
2024-04-17 15:07:29 +08:00
<select id="selectTaskNumByMonth" resultType="java.lang.Integer">
select count(*) from ma_type_put_in_storage_info where DATE_FORMAT(CREATE_DATE,'%y%m') = DATE_FORMAT(#{date},'%y%m')
2024-04-02 13:19:59 +08:00
</select>
2024-03-28 09:29:57 +08:00
</mapper>