2024-09-27 15:31:39 +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.ma.mapper.MachineMapper">
|
|
|
|
|
<resultMap type="com.bonus.material.ma.domain.Machine" id="MachineResult">
|
|
|
|
|
<result property="maId" column="ma_id" />
|
|
|
|
|
<result property="typeId" column="type_id" />
|
|
|
|
|
<result property="maCode" column="ma_code" />
|
|
|
|
|
<result property="preCode" column="pre_code" />
|
|
|
|
|
<result property="maStatus" column="ma_status" />
|
|
|
|
|
<result property="qrCode" column="qr_code" />
|
|
|
|
|
<result property="buyPrice" column="buy_price" />
|
|
|
|
|
<result property="maVender" column="ma_vender" />
|
|
|
|
|
<result property="outFacTime" column="out_fac_time" />
|
|
|
|
|
<result property="outFacCode" column="out_fac_code" />
|
|
|
|
|
<result property="assetsCode" column="assets_code" />
|
|
|
|
|
<result property="checkMan" column="check_man" />
|
|
|
|
|
<result property="thisCheckTime" column="this_check_time" />
|
|
|
|
|
<result property="nextCheckTime" column="next_check_time" />
|
|
|
|
|
<result property="gpsCode" column="gps_code" />
|
|
|
|
|
<result property="rfidCode" column="rfid_code" />
|
|
|
|
|
<result property="erpCode" column="erp_code" />
|
|
|
|
|
<result property="transferCode" column="transfer_code" />
|
|
|
|
|
<result property="inOutNum" column="in_out_num" />
|
|
|
|
|
<result property="buyTask" column="buy_task" />
|
|
|
|
|
<result property="ownHouse" column="own_house" />
|
|
|
|
|
<result property="companyId" column="company_id" />
|
|
|
|
|
<result property="createTime" column="create_time" />
|
|
|
|
|
<result property="updateTime" column="update_time" />
|
|
|
|
|
<result property="inspectMan" column="inspect_man" />
|
|
|
|
|
<result property="inspectStatus" column="inspect_status" />
|
|
|
|
|
<result property="phone" column="phone" />
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<sql id="selectMachineVo">
|
|
|
|
|
select ma_id, type_id, ma_code, pre_code, ma_status, qr_code, buy_price, ma_vender, out_fac_time, out_fac_code, assets_code, check_man, this_check_time, next_check_time, gps_code, rfid_code, erp_code, transfer_code, in_out_num, buy_task, own_house, company_id, create_time, update_time, inspect_man, inspect_status, phone from ma_machine
|
|
|
|
|
</sql>
|
|
|
|
|
|
2024-10-17 16:05:21 +08:00
|
|
|
<select id="selectMachineList" resultType="com.bonus.material.ma.vo.MachineVo">
|
|
|
|
|
SELECT
|
|
|
|
|
ma.ma_id as maId,
|
|
|
|
|
ma.type_id as typeId,
|
|
|
|
|
mt4.type_name as itemType,
|
|
|
|
|
mt3.type_name as materialType,
|
|
|
|
|
mt2.type_name as materialName,
|
|
|
|
|
mt.type_name as materialModel,
|
|
|
|
|
ma.ma_code as maCode,
|
|
|
|
|
ma.pre_code as preCode,
|
|
|
|
|
ma.ma_status as maStatus,
|
|
|
|
|
ma.qr_code as qrCode,
|
|
|
|
|
ma.buy_price as buyPrice,
|
2024-10-29 16:11:23 +08:00
|
|
|
msi.supplier as maVender,
|
2024-10-17 16:05:21 +08:00
|
|
|
ma.out_fac_time as outFacTime,
|
|
|
|
|
ma.out_fac_code as outFacCode,
|
|
|
|
|
ma.assets_code as assetsCode,
|
|
|
|
|
ma.check_man as checkMan,
|
|
|
|
|
ma.this_check_time as thisCheckTime,
|
|
|
|
|
ma.next_check_time as nextCheckTime,
|
|
|
|
|
ma.gps_code as gpsCode,
|
|
|
|
|
ma.rfid_code as rfidCode,
|
|
|
|
|
ma.erp_code as erpCode,
|
|
|
|
|
ma.transfer_code as transferCode,
|
|
|
|
|
ma.in_out_num as inOutNum,
|
|
|
|
|
ma.buy_task as buyTask,
|
|
|
|
|
ma.own_house as ownHouse,
|
|
|
|
|
ma.company_id as companyId,
|
|
|
|
|
ma.create_time as createTime,
|
|
|
|
|
ma.update_time as updateTime,
|
|
|
|
|
ma.inspect_man as inspectMan,
|
|
|
|
|
ma.inspect_status as inspectStatus,
|
|
|
|
|
ma.phone as phone
|
|
|
|
|
FROM
|
|
|
|
|
ma_machine ma
|
|
|
|
|
LEFT JOIN ma_type mt ON ma.type_id = mt.type_id
|
|
|
|
|
and mt.`level` = '4' and mt.del_flag = '0'
|
|
|
|
|
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
|
|
|
|
|
and mt2.`level` = '3' and mt2.del_flag = '0'
|
|
|
|
|
LEFT JOIN ma_type mt3 ON mt2.parent_id = mt3.type_id
|
|
|
|
|
and mt3.`level` = '2' and mt3.del_flag = '0'
|
|
|
|
|
LEFT JOIN ma_type mt4 ON mt3.parent_id = mt4.type_id
|
|
|
|
|
and mt4.`level` = '1' and mt4.del_flag = '0'
|
2024-10-29 16:11:23 +08:00
|
|
|
LEFT JOIN ma_supplier_info msi ON msi.supplier_id = ma.ma_vender
|
2024-10-17 16:05:21 +08:00
|
|
|
where
|
|
|
|
|
1 = 1
|
|
|
|
|
<if test="keyWord != null and keyWord != ''">
|
|
|
|
|
and (
|
|
|
|
|
ma.ma_code like concat('%', #{keyWord}, '%')
|
|
|
|
|
or ma.assets_code like concat('%', #{keyWord}, '%')
|
|
|
|
|
or ma.pre_code like concat('%', #{keyWord}, '%')
|
|
|
|
|
or ma.buy_task like concat('%', #{keyWord}, '%')
|
|
|
|
|
or ma.own_house like concat('%', #{keyWord}, '%')
|
|
|
|
|
)
|
|
|
|
|
</if>
|
|
|
|
|
<if test="materialType != null and materialType != ''">
|
|
|
|
|
and mt3.type_name like concat('%', #{materialType}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="materialName != null and materialName != ''">
|
|
|
|
|
and mt2.type_name like concat('%', #{materialName}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="materialModel != null and materialModel != ''">
|
|
|
|
|
and mt.type_name like concat('%', #{materialModel}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="isAssets != null">
|
|
|
|
|
<if test="isAssets == 0">
|
|
|
|
|
AND ma.assets_code IS NOT NULL
|
|
|
|
|
AND ma.assets_code != ''
|
|
|
|
|
</if>
|
|
|
|
|
<if test="isAssets == 1">
|
|
|
|
|
AND (ma.assets_code IS NULL OR ma.assets_code = '')
|
|
|
|
|
</if>
|
|
|
|
|
</if>
|
|
|
|
|
order by ma.create_time desc
|
2024-09-27 15:31:39 +08:00
|
|
|
</select>
|
2024-10-17 16:05:21 +08:00
|
|
|
|
|
|
|
|
<select id="selectMachineByMaId" resultType="com.bonus.material.ma.vo.MachineVo">
|
|
|
|
|
SELECT
|
|
|
|
|
ma.ma_id as maId,
|
|
|
|
|
ma.type_id as typeId,
|
|
|
|
|
mt4.type_name as itemType,
|
|
|
|
|
mt3.type_name as materialType,
|
|
|
|
|
mt2.type_name as materialName,
|
|
|
|
|
mt.type_name as materialModel,
|
|
|
|
|
ma.ma_code as maCode,
|
|
|
|
|
ma.pre_code as preCode,
|
|
|
|
|
ma.ma_status as maStatus,
|
|
|
|
|
ma.qr_code as qrCode,
|
|
|
|
|
ma.buy_price as buyPrice,
|
|
|
|
|
ma.ma_vender as maVender,
|
|
|
|
|
ma.out_fac_time as outFacTime,
|
|
|
|
|
ma.out_fac_code as outFacCode,
|
|
|
|
|
ma.assets_code as assetsCode,
|
|
|
|
|
ma.check_man as checkMan,
|
|
|
|
|
ma.this_check_time as thisCheckTime,
|
|
|
|
|
ma.next_check_time as nextCheckTime,
|
|
|
|
|
ma.gps_code as gpsCode,
|
|
|
|
|
ma.rfid_code as rfidCode,
|
|
|
|
|
ma.erp_code as erpCode,
|
|
|
|
|
ma.transfer_code as transferCode,
|
|
|
|
|
ma.in_out_num as inOutNum,
|
|
|
|
|
ma.buy_task as buyTask,
|
|
|
|
|
ma.own_house as ownHouse,
|
|
|
|
|
ma.company_id as companyId,
|
|
|
|
|
ma.create_time as createTime,
|
|
|
|
|
ma.update_time as updateTime,
|
|
|
|
|
ma.inspect_man as inspectMan,
|
|
|
|
|
ma.inspect_status as inspectStatus,
|
2024-10-18 13:26:45 +08:00
|
|
|
ma.phone as phone,
|
|
|
|
|
mtk.user_id as keeperId,
|
|
|
|
|
mtr.user_id as repairId,
|
|
|
|
|
baa.asset_name as assetName,
|
|
|
|
|
ma.remark as remark
|
2024-10-17 16:05:21 +08:00
|
|
|
FROM
|
|
|
|
|
ma_machine ma
|
|
|
|
|
LEFT JOIN ma_type mt ON ma.type_id = mt.type_id
|
|
|
|
|
and mt.`level` = '4' and mt.del_flag = '0'
|
|
|
|
|
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
|
|
|
|
|
and mt2.`level` = '3' and mt2.del_flag = '0'
|
|
|
|
|
LEFT JOIN ma_type mt3 ON mt2.parent_id = mt3.type_id
|
|
|
|
|
and mt3.`level` = '2' and mt3.del_flag = '0'
|
|
|
|
|
LEFT JOIN ma_type mt4 ON mt3.parent_id = mt4.type_id
|
|
|
|
|
and mt4.`level` = '1' and mt4.del_flag = '0'
|
2024-10-18 13:26:45 +08:00
|
|
|
LEFT JOIN ma_type_keeper mtk on ma.type_id = mtk.type_id
|
|
|
|
|
LEFT JOIN ma_type_repair mtr on ma.type_id = mtr.type_id
|
|
|
|
|
LEFT JOIN bm_asset_attributes baa on ma.assets_id = baa.id
|
2024-10-17 16:05:21 +08:00
|
|
|
where ma.ma_id = #{maId}
|
2024-09-27 15:31:39 +08:00
|
|
|
</select>
|
2024-10-17 16:05:21 +08:00
|
|
|
|
2024-10-17 17:51:42 +08:00
|
|
|
<select id="selectByTypeList" resultType="com.bonus.material.ma.domain.Type">
|
|
|
|
|
SELECT
|
|
|
|
|
type_id as typeId,
|
|
|
|
|
type_name as typeName,
|
|
|
|
|
parent_id as parentId,
|
|
|
|
|
storage_num as storageNum,
|
|
|
|
|
type_code as typeCode,
|
|
|
|
|
level as level
|
|
|
|
|
FROM
|
|
|
|
|
ma_type
|
|
|
|
|
WHERE del_flag = '0'
|
|
|
|
|
<if test="level != null and level != ''">
|
|
|
|
|
and level = #{level}
|
|
|
|
|
</if>
|
|
|
|
|
</select>
|
|
|
|
|
|
2024-09-27 15:31:39 +08:00
|
|
|
<insert id="insertMachine" parameterType="com.bonus.material.ma.domain.Machine" useGeneratedKeys="true" keyProperty="maId">
|
|
|
|
|
insert into ma_machine
|
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="typeId != null">type_id,</if>
|
|
|
|
|
<if test="maCode != null">ma_code,</if>
|
|
|
|
|
<if test="preCode != null">pre_code,</if>
|
|
|
|
|
<if test="maStatus != null">ma_status,</if>
|
|
|
|
|
<if test="qrCode != null">qr_code,</if>
|
|
|
|
|
<if test="buyPrice != null">buy_price,</if>
|
|
|
|
|
<if test="maVender != null">ma_vender,</if>
|
|
|
|
|
<if test="outFacTime != null">out_fac_time,</if>
|
|
|
|
|
<if test="outFacCode != null">out_fac_code,</if>
|
|
|
|
|
<if test="assetsCode != null">assets_code,</if>
|
|
|
|
|
<if test="checkMan != null">check_man,</if>
|
|
|
|
|
<if test="thisCheckTime != null">this_check_time,</if>
|
|
|
|
|
<if test="nextCheckTime != null">next_check_time,</if>
|
|
|
|
|
<if test="gpsCode != null">gps_code,</if>
|
|
|
|
|
<if test="rfidCode != null">rfid_code,</if>
|
|
|
|
|
<if test="erpCode != null">erp_code,</if>
|
|
|
|
|
<if test="transferCode != null">transfer_code,</if>
|
|
|
|
|
<if test="inOutNum != null">in_out_num,</if>
|
|
|
|
|
<if test="buyTask != null">buy_task,</if>
|
|
|
|
|
<if test="ownHouse != null">own_house,</if>
|
|
|
|
|
<if test="companyId != null">company_id,</if>
|
|
|
|
|
<if test="createTime != null">create_time,</if>
|
|
|
|
|
<if test="updateTime != null">update_time,</if>
|
|
|
|
|
<if test="inspectMan != null">inspect_man,</if>
|
|
|
|
|
<if test="inspectStatus != null">inspect_status,</if>
|
|
|
|
|
<if test="phone != null">phone,</if>
|
|
|
|
|
</trim>
|
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="typeId != null">#{typeId},</if>
|
|
|
|
|
<if test="maCode != null">#{maCode},</if>
|
|
|
|
|
<if test="preCode != null">#{preCode},</if>
|
|
|
|
|
<if test="maStatus != null">#{maStatus},</if>
|
|
|
|
|
<if test="qrCode != null">#{qrCode},</if>
|
|
|
|
|
<if test="buyPrice != null">#{buyPrice},</if>
|
|
|
|
|
<if test="maVender != null">#{maVender},</if>
|
|
|
|
|
<if test="outFacTime != null">#{outFacTime},</if>
|
|
|
|
|
<if test="outFacCode != null">#{outFacCode},</if>
|
|
|
|
|
<if test="assetsCode != null">#{assetsCode},</if>
|
|
|
|
|
<if test="checkMan != null">#{checkMan},</if>
|
|
|
|
|
<if test="thisCheckTime != null">#{thisCheckTime},</if>
|
|
|
|
|
<if test="nextCheckTime != null">#{nextCheckTime},</if>
|
|
|
|
|
<if test="gpsCode != null">#{gpsCode},</if>
|
|
|
|
|
<if test="rfidCode != null">#{rfidCode},</if>
|
|
|
|
|
<if test="erpCode != null">#{erpCode},</if>
|
|
|
|
|
<if test="transferCode != null">#{transferCode},</if>
|
|
|
|
|
<if test="inOutNum != null">#{inOutNum},</if>
|
|
|
|
|
<if test="buyTask != null">#{buyTask},</if>
|
|
|
|
|
<if test="ownHouse != null">#{ownHouse},</if>
|
|
|
|
|
<if test="companyId != null">#{companyId},</if>
|
|
|
|
|
<if test="createTime != null">#{createTime},</if>
|
|
|
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
|
|
|
<if test="inspectMan != null">#{inspectMan},</if>
|
|
|
|
|
<if test="inspectStatus != null">#{inspectStatus},</if>
|
|
|
|
|
<if test="phone != null">#{phone},</if>
|
|
|
|
|
</trim>
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<update id="updateMachine" parameterType="com.bonus.material.ma.domain.Machine">
|
|
|
|
|
update ma_machine
|
|
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
|
|
<if test="typeId != null">type_id = #{typeId},</if>
|
|
|
|
|
<if test="maCode != null">ma_code = #{maCode},</if>
|
|
|
|
|
<if test="preCode != null">pre_code = #{preCode},</if>
|
|
|
|
|
<if test="maStatus != null">ma_status = #{maStatus},</if>
|
|
|
|
|
<if test="qrCode != null">qr_code = #{qrCode},</if>
|
|
|
|
|
<if test="buyPrice != null">buy_price = #{buyPrice},</if>
|
|
|
|
|
<if test="maVender != null">ma_vender = #{maVender},</if>
|
|
|
|
|
<if test="outFacTime != null">out_fac_time = #{outFacTime},</if>
|
|
|
|
|
<if test="outFacCode != null">out_fac_code = #{outFacCode},</if>
|
|
|
|
|
<if test="assetsCode != null">assets_code = #{assetsCode},</if>
|
|
|
|
|
<if test="checkMan != null">check_man = #{checkMan},</if>
|
|
|
|
|
<if test="thisCheckTime != null">this_check_time = #{thisCheckTime},</if>
|
|
|
|
|
<if test="nextCheckTime != null">next_check_time = #{nextCheckTime},</if>
|
|
|
|
|
<if test="gpsCode != null">gps_code = #{gpsCode},</if>
|
|
|
|
|
<if test="rfidCode != null">rfid_code = #{rfidCode},</if>
|
|
|
|
|
<if test="erpCode != null">erp_code = #{erpCode},</if>
|
|
|
|
|
<if test="transferCode != null">transfer_code = #{transferCode},</if>
|
|
|
|
|
<if test="inOutNum != null">in_out_num = #{inOutNum},</if>
|
|
|
|
|
<if test="buyTask != null">buy_task = #{buyTask},</if>
|
|
|
|
|
<if test="ownHouse != null">own_house = #{ownHouse},</if>
|
|
|
|
|
<if test="companyId != null">company_id = #{companyId},</if>
|
|
|
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
|
|
|
<if test="inspectMan != null">inspect_man = #{inspectMan},</if>
|
|
|
|
|
<if test="inspectStatus != null">inspect_status = #{inspectStatus},</if>
|
|
|
|
|
<if test="phone != null">phone = #{phone},</if>
|
2024-10-29 16:42:40 +08:00
|
|
|
<if test="assetsId != null">assets_id = #{assetsId},</if>
|
|
|
|
|
<if test="remark != null">remark = #{remark},</if>
|
2024-09-27 15:31:39 +08:00
|
|
|
</trim>
|
|
|
|
|
where ma_id = #{maId}
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<delete id="deleteMachineByMaId" parameterType="Long">
|
|
|
|
|
delete from ma_machine where ma_id = #{maId}
|
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
<delete id="deleteMachineByMaIds" parameterType="String">
|
|
|
|
|
delete from ma_machine where ma_id in
|
|
|
|
|
<foreach item="maId" collection="array" open="(" separator="," close=")">
|
|
|
|
|
#{maId}
|
|
|
|
|
</foreach>
|
|
|
|
|
</delete>
|
|
|
|
|
</mapper>
|