devicesmgt/sgzb-modules/sgzb-base/src/main/resources/mapper/base/MaMachineMapper.xml

231 lines
13 KiB
XML
Raw Normal View History

2023-11-28 20:33:38 +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">
2023-12-08 09:51:56 +08:00
<mapper namespace="com.bonus.sgzb.base.mapper.MaMachineMapper">
2023-11-28 20:33:38 +08:00
2023-12-15 15:29:41 +08:00
<resultMap type="com.bonus.sgzb.base.api.domain.MaMachine" id="MaMachineResult">
2023-11-30 20:15:53 +08:00
<id 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="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" />
</resultMap>
<sql id="selectMaMachine">
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
from ma_machine
2023-11-28 20:33:38 +08:00
</sql>
2023-12-15 15:29:41 +08:00
<select id="getMaMachine" parameterType="com.bonus.sgzb.base.api.domain.MaMachine" resultMap="MaMachineResult">
2023-12-18 15:39:15 +08:00
select m.ma_id, m.type_id, m.ma_code, m.pre_code, m.ma_status, dic.name maStatusName, m.qr_code, m.buy_price, m.ma_vender, m.out_fac_time, m.out_fac_code,
m.assets_code, m.check_man, m.this_check_time, m.next_check_time, m.gps_code, m.rfid_code, m.erp_code, m.transfer_code,
2023-12-20 20:28:42 +08:00
m.in_out_num, m.buy_task, m.own_house ,m.company_id ,mt.type_name specificationType,mt1.type_name deviceType, mt2.type_name itemType,
mmb.label_code labelCode
2023-12-18 15:39:15 +08:00
from ma_machine m
left join (select id,p_id,name from sys_dic where p_id in (select id from sys_dic where value = 'ma_status')) dic on m.ma_status = dic.id
left join ma_type mt on m.type_id = mt.type_id
left join ma_type mt1 on mt.parent_id = mt1.type_id
left join ma_type mt2 on mt1.parent_id = mt2.type_id
2023-12-20 20:28:42 +08:00
left join ma_label_bind mmb on m.ma_id = mmb.ma_id and m.type_id = mmb.type_id
2023-11-30 20:15:53 +08:00
<where>
<if test="maId != null and maId != ''">
AND ma_id = #{maId}
</if>
<if test="typeId != null and typeId != ''">
AND type_id = #{typeId}
</if>
</where>
2023-12-23 11:45:38 +08:00
order by m.ma_id desc
2023-11-28 20:33:38 +08:00
</select>
2023-11-30 20:15:53 +08:00
<select id="getMaMachineList" parameterType="com.bonus.sgzb.base.api.domain.MaMachine" resultMap="MaMachineResult">
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
from ma_machine
<where>
<if test="maId != null and maId != ''">
AND ma_id = #{maId}
</if>
<if test="typeId != null and typeId != ''">
AND type_id = #{typeId}
</if>
<if test="maCode != null and maCode != ''">
AND ma_code = #{maCode}
</if>
<if test="preCode != null and preCode != ''">
AND pre_code = #{preCode}
</if>
<if test="maStatus != null and maStatus != ''">
and ma_status = #{maStatus}
</if>
<if test="qrCode != null and qrCode != ''">
and qr_code = #{qrCode}
</if>
<if test="buyPrice != null and buyPrice != ''">
and buy_price = #{buyPrice}
</if>
<if test="maVender != null and maVender != ''">
and ma_vender = #{maVender}
</if>
<if test="outFacTime != null and outFacTime != ''">
and out_fac_time = #{outFacTime}
</if>
<if test="outFacCode != null and outFacCode != ''">
and out_fac_code = #{outFacCode}
</if>
<if test="assetsCode != null and assetsCode != ''">
and assets_code = #{assetsCode}
</if>
<if test="remark != null and remark != ''">
and check_man = #{remark}
</if>
<if test="thisCheckTime != null and thisCheckTime != ''">
and this_check_time = #{thisCheckTime}
</if>
<if test="nextCheckTime != null and nextCheckTime != ''">
and next_check_time = #{nextCheckTime}
</if>
<if test="gpsCode != null and gpsCode != ''">
and gps_code = #{gpsCode}
</if>
<if test="rfidCode != null and rfidCode != ''">
and rfid_code = #{rfidCode}
</if>
<if test="erpCode != null and erpCode != ''">
and erp_code = #{erpCode}
</if>
<if test="transferCode != null and transferCode != ''">
and transfer_code = #{transferCode}
</if>
<if test="inOutNum != null and inOutNum != ''">
and in_out_num = #{inOutNum}
</if>
<if test="buyTask != null and buyTask != ''">
and buy_task = #{buyTask}
</if>
<if test="ownHouse != null and ownHouse != ''">
and own_house = #{ownHouse}
</if>
<if test="companyId != null and companyId != ''">
and company_id = #{companyId}
</if>
</where>
</select>
2023-12-15 15:29:41 +08:00
<insert id="maMachineAdd" parameterType="com.bonus.sgzb.base.api.domain.MaMachine">
2023-11-30 20:15:53 +08:00
insert into ma_machine (
<if test="typeId != null and typeId != '' ">type_id,</if>
<if test="maCode != null and maCode != '' ">ma_code,</if>
<if test="preCode != null and preCode != '' ">pre_code,</if>
<if test="maStatus != null and maStatus != '' ">ma_status,</if>
<if test="qrCode != null and qrCode != ''">qr_code,</if>
<if test="buyPrice != null and buyPrice != ''">buy_price,</if>
<if test="maVender != null and maVender != ''">ma_vender,</if>
<if test="outFacTime != null and outFacTime != ''">out_fac_time,</if>
<if test="outFacCode != null and outFacCode != ''">out_fac_code,</if>
<if test="assetsCode != null and assetsCode != ''">assets_code,</if>
<if test="checkMan != null and checkMan != ''">check_man,</if>
<if test="thisCheckTime != null and thisCheckTime != ''">this_check_time,</if>
<if test="nextCheckTime != null and nextCheckTime != ''">next_check_time,</if>
<if test="gpsCode != null and gpsCode != ''">gps_code,</if>
<if test="rfidCode != null and rfidCode != ''">rfid_code,</if>
<if test="erpCode != null and erpCode != ''">erp_code,</if>
2023-12-10 17:35:50 +08:00
<if test="transferCode != null and transferCode != ''">transfer_code,</if>
2023-11-30 20:15:53 +08:00
<if test="inOutNum != null and inOutNum != ''">in_out_num,</if>
<if test="buyTask != null and buyTask != ''">buy_task,</if>
<if test="ownHouse != null and ownHouse != ''">own_house,</if>
<if test="companyId != null and companyId != ''">company_id</if>
)values(
<if test="typeId != null and typeId != ''">#{typeId},</if>
<if test="maCode != null and maCode != ''">#{maCode},</if>
<if test="preCode != null and preCode != ''">#{preCode},</if>
<if test="maStatus != null and maStatus != ''">#{maStatus},</if>
2023-12-10 17:35:50 +08:00
<if test="qrCode != null and qrCode != ''">#{qrCode},</if>
2023-11-30 20:15:53 +08:00
<if test="buyPrice != null and buyPrice != ''">#{buyPrice},</if>
<if test="maVender != null and maVender != ''">#{maVender},</if>
<if test="outFacTime != null and outFacTime != ''">#{outFacTime},</if>
<if test="outFacCode != null and outFacCode != ''">#{outFacCode},</if>
<if test="assetsCode != null and assetsCode != ''">#{assetsCode},</if>
<if test="checkMan != null and checkMan != ''">#{checkMan},</if>
<if test="thisCheckTime != null and thisCheckTime != ''">#{thisCheckTime},</if>
<if test="nextCheckTime != null and nextCheckTime != ''">#{nextCheckTime},</if>
<if test="gpsCode != null and gpsCode != ''">#{gpsCode},</if>
<if test="rfidCode != null and rfidCode != ''">#{rfidCode},</if>
<if test="erpCode != null and erpCode != ''">#{erpCode},</if>
<if test="transferCode != null and transferCode != ''">#{transferCode},</if>
<if test="inOutNum != null and inOutNum != ''">#{inOutNum},</if>
<if test="buyTask != null and buyTask != ''">#{buyTask},</if>
<if test="ownHouse != null and ownHouse != ''">#{ownHouse},</if>
<if test="companyId != null and companyId != ''">#{companyId}</if>
)
</insert>
2023-12-15 15:29:41 +08:00
<update id="updateMaMachine" parameterType="com.bonus.sgzb.base.api.domain.MaMachine">
2023-11-30 20:15:53 +08:00
update ma_machine
<set>
<if test="typeId != null and typeId != ''">type_id = #{typeId},</if>
<if test="maCode != null and maCode != ''">ma_code = #{maCode},</if>
<if test="preCode != null and preCode != ''">pre_code = #{preCode},</if>
<if test="maStatus != null and maStatus != ''">ma_status = #{maStatus},</if>
<if test="qrCode != null and qrCode != ''">qr_code = #{qrCode},</if>
<if test="buyPrice != null and buyPrice != ''">buy_price = #{buyPrice},</if>
<if test="maVender != null and maVender != ''">ma_vender = #{maVender},</if>
<if test="outFacTime != null and outFacTime != ''">out_fac_time =#{outFacTime},</if>
<if test="outFacCode != null and outFacCode != ''">out_fac_code = #{outFacCode},</if>
<if test="assetsCode != null and assetsCode != ''">assets_code =#{assetsCode},</if>
<if test="checkMan != null and checkMan != ''">check_man = #{checkMan},</if>
<if test="thisCheckTime != null and thisCheckTime != ''">this_check_time = #{thisCheckTime},</if>
<if test="nextCheckTime != null and nextCheckTime != ''">next_check_time = #{nextCheckTime},</if>
<if test="gpsCode != null and gpsCode != ''">gps_code = #{gpsCode},</if>
<if test="rfidCode != null and rfidCode != ''">rfid_code = #{rfidCode},</if>
<if test="erpCode != null and erpCode != ''">erp_code = #{erpCode},</if>
<if test="transferCode != null and transferCode != ''">transfer_code = #{transferCode},</if>
<if test="inOutNum != null and inOutNum != ''">in_out_num = #{inOutNum},</if>
<if test="buyTask != null and buyTask != ''">buy_task = #{buyTask},</if>
<if test="ownHouse != null and ownHouse != ''">own_house = #{ownHouse},</if>
<if test="companyId != null and companyId != ''">company_id = #{companyId},</if>
</set>
where ma_id = #{maId}
</update>
<delete id="remove" parameterType="Long">
delete from ma_machine where ma_id in
<foreach item="maId" collection="array" open="(" separator="," close=")">
#{maId}
</foreach>
</delete>
2023-12-10 17:35:50 +08:00
<select id="selectMaMachineByMaId" parameterType="Long" resultMap="MaMachineResult">
2023-12-18 15:39:15 +08:00
select m.ma_id, m.type_id, m.ma_code, m.pre_code, m.ma_status, m.qr_code, m.buy_price, m.ma_vender, m.out_fac_time, m.out_fac_code,
m.assets_code, m.check_man, m.this_check_time, m.next_check_time, m.gps_code, m.rfid_code, m.erp_code, m.transfer_code,
m.in_out_num, m.buy_task, m.own_house ,m.company_id ,mt.type_name specificationType,mt1.type_name deviceType, mt2.type_name itemType
from ma_machine m
left join ma_type mt on m.type_id = mt.type_id
left join ma_type mt1 on mt.parent_id = mt1.type_id
left join ma_type mt2 on mt1.parent_id = mt2.type_id
2023-12-10 17:35:50 +08:00
where ma_id = #{maId}
</select>
2023-11-28 20:33:38 +08:00
</mapper>