You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
udiwms-java/api-admin/src/main/resources/mybatis/mapper/inventory/InvMaintenanceOrderDetailDa...

293 lines
12 KiB
XML

<?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.glxp.api.admin.dao.inventory.InvMaintenanceOrderDetailDao">
<resultMap id="BaseResultMap" type="com.glxp.api.admin.entity.inventory.InvMaintenanceOrderDetailEntity">
<id column="id" jdbcType="INTEGER" property="id"/>
<result column="orderIdFk" jdbcType="VARCHAR" property="orderIdFk"/>
<result column="code" jdbcType="VARCHAR" property="code"/>
<result column="productId" jdbcType="VARCHAR" property="productId"/>
<result column="nameCode" jdbcType="VARCHAR" property="nameCode"/>
<result column="batchNo" jdbcType="VARCHAR" property="batchNo"/>
<result column="produceDate" jdbcType="VARCHAR" property="produceDate"/>
<result column="expireDate" jdbcType="VARCHAR" property="expireDate"/>
<result column="count" jdbcType="INTEGER" property="count"/>
<result column="maintenanceStatus" jdbcType="INTEGER" property="maintenanceStatus"/>
<result column="deviceStatus" jdbcType="INTEGER" property="deviceStatus"/>
<result column="remark" jdbcType="VARCHAR" property="remark"/>
<result column="createTime" jdbcType="VARCHAR" property="createTime"/>
<result column="updateTime" jdbcType="VARCHAR" property="updateTime"/>
</resultMap>
<sql id="Base_Column_List">
id,
orderIdFk,
code,
productId,
nameCode,
batchNo,
produceDate,
expireDate,
`count`,
maintenanceStatus,
deviceStatus,
remark,
createTime,
updateTime
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from inv_maintenance_order_detail
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete
from inv_maintenance_order_detail
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" keyColumn="id" keyProperty="id"
parameterType="com.glxp.api.admin.entity.inventory.InvMaintenanceOrderDetailEntity" useGeneratedKeys="true">
insert into inv_maintenance_order_detail (orderIdFk, code, productId,
nameCode, batchNo, produceDate,
expireDate, `count`, maintenanceStatus,
deviceStatus, remark, createTime, updateTime)
values (#{orderIdFk,jdbcType=VARCHAR}, #{code,jdbcType=VARCHAR}, #{productId,jdbcType=VARCHAR},
#{nameCode,jdbcType=VARCHAR}, #{batchNo,jdbcType=VARCHAR}, #{produceDate,jdbcType=VARCHAR},
#{expireDate,jdbcType=VARCHAR}, #{count,jdbcType=INTEGER}, #{maintenanceStatus,jdbcType=INTEGER},
#{deviceStatus,jdbcType=INTEGER}, #{remark,jdbcType=VARCHAR}, #{createTime,jdbcType=VARCHAR},
#{updateTime,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id"
parameterType="com.glxp.api.admin.entity.inventory.InvMaintenanceOrderDetailEntity" useGeneratedKeys="true">
insert into inv_maintenance_order_detail
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="orderIdFk != null">
orderIdFk,
</if>
<if test="code != null">
code,
</if>
<if test="productId != null">
productId,
</if>
<if test="nameCode != null">
nameCode,
</if>
<if test="batchNo != null">
batchNo,
</if>
<if test="produceDate != null">
produceDate,
</if>
<if test="expireDate != null">
expireDate,
</if>
<if test="count != null">
`count`,
</if>
<if test="maintenanceStatus != null">
maintenanceStatus,
</if>
<if test="deviceStatus != null">
deviceStatus,
</if>
<if test="remark != null">
remark,
</if>
<if test="createTime != null">
createTime,
</if>
<if test="updateTime != null">
updateTime,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="orderIdFk != null">
#{orderIdFk,jdbcType=VARCHAR},
</if>
<if test="code != null">
#{code,jdbcType=VARCHAR},
</if>
<if test="productId != null">
#{productId,jdbcType=VARCHAR},
</if>
<if test="nameCode != null">
#{nameCode,jdbcType=VARCHAR},
</if>
<if test="batchNo != null">
#{batchNo,jdbcType=VARCHAR},
</if>
<if test="produceDate != null">
#{produceDate,jdbcType=VARCHAR},
</if>
<if test="expireDate != null">
#{expireDate,jdbcType=VARCHAR},
</if>
<if test="count != null">
#{count,jdbcType=INTEGER},
</if>
<if test="maintenanceStatus != null">
#{maintenanceStatus,jdbcType=INTEGER},
</if>
<if test="deviceStatus != null">
#{deviceStatus,jdbcType=INTEGER},
</if>
<if test="remark != null">
#{remark,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=VARCHAR},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective"
parameterType="com.glxp.api.admin.entity.inventory.InvMaintenanceOrderDetailEntity">
update inv_maintenance_order_detail
<set>
<if test="orderIdFk != null">
orderIdFk = #{orderIdFk,jdbcType=VARCHAR},
</if>
<if test="code != null">
code = #{code,jdbcType=VARCHAR},
</if>
<if test="productId != null">
productId = #{productId,jdbcType=VARCHAR},
</if>
<if test="nameCode != null">
nameCode = #{nameCode,jdbcType=VARCHAR},
</if>
<if test="batchNo != null">
batchNo = #{batchNo,jdbcType=VARCHAR},
</if>
<if test="produceDate != null">
produceDate = #{produceDate,jdbcType=VARCHAR},
</if>
<if test="expireDate != null">
expireDate = #{expireDate,jdbcType=VARCHAR},
</if>
<if test="count != null">
`count` = #{count,jdbcType=INTEGER},
</if>
<if test="maintenanceStatus != null">
maintenanceStatus = #{maintenanceStatus,jdbcType=INTEGER},
</if>
<if test="deviceStatus != null">
deviceStatus = #{deviceStatus,jdbcType=INTEGER},
</if>
<if test="remark != null">
remark = #{remark,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
createTime = #{createTime,jdbcType=VARCHAR},
</if>
<if test="updateTime != null">
updateTime = #{updateTime,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.glxp.api.admin.entity.inventory.InvMaintenanceOrderDetailEntity">
update inv_maintenance_order_detail
set orderIdFk = #{orderIdFk,jdbcType=VARCHAR},
code = #{code,jdbcType=VARCHAR},
productId = #{productId,jdbcType=VARCHAR},
nameCode = #{nameCode,jdbcType=VARCHAR},
batchNo = #{batchNo,jdbcType=VARCHAR},
produceDate = #{produceDate,jdbcType=VARCHAR},
expireDate = #{expireDate,jdbcType=VARCHAR},
`count` = #{count,jdbcType=INTEGER},
maintenanceStatus = #{maintenanceStatus,jdbcType=INTEGER},
deviceStatus = #{deviceStatus,jdbcType=INTEGER},
remark = #{remark,jdbcType=VARCHAR},
createTime = #{createTime,jdbcType=VARCHAR},
updateTime = #{updateTime,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
<delete id="deleteByOrderId">
delete
from inv_maintenance_order_detail
where orderIdFk = #{orderId}
</delete>
<select id="countByOrderId" resultType="java.lang.Long">
select count(*)
from inv_maintenance_order_detail
where orderIdFk = #{orderId}
</select>
<select id="filterList" resultType="com.glxp.api.admin.res.inventory.InvMAOrderDetailResponse">
SELECT mad.id,
mad.orderIdFk,
mad.CODE,
mad.productId,
mad.nameCode,
mad.batchNo,
mad.produceDate,
mad.expireDate,
mad.count,
mad.maintenanceStatus,
mad.deviceStatus,
mad.remark,
mad.createTime,
mad.updateTime,
basic_products.cpmctymc productName,
ip.ggxh,
basic_products.zczbhhzbapzbh,
basic_products.ylqxzcrbarmc
FROM inv_maintenance_order_detail mad
left join inv_maintenance_order ma on mad.orderIdFk = ma.orderId
LEFT JOIN basic_udirel ON mad.productId = basic_udirel.id
LEFT JOIN basic_products ON basic_products.uuid = basic_udirel.uuid
left join inv_product_detail ipd on ipd.productIdFk = mad.productId
and ipd.invWarehouseCode = ma.invWarehouseCode and ipd.invSpaceCode = ma.invSpaceCode
left join inv_product ip on ipd.productIdFk = ip.relIdFk and ip.batchNo = ipd.batchNo
<where>
<if test="orderIdFk != null and orderIdFk != ''">
AND mad.orderIdFk = #{orderIdFk}
</if>
</where>
group by mad.code
</select>
<select id="selectByOrderIdAndCode" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from inv_maintenance_order_detail
where orderIdFk = #{orderIdFk}
and code = #{code}
</select>
<select id="selectByOrderId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from inv_maintenance_order_detail
WHERE orderIdFk = #{orderId}
</select>
<update id="updateTime">
update inv_maintenance_order_detail
<set>
<if test="createTime != null and createTime != ''">
createTime = #{createTime,jdbcType=VARCHAR},
</if>
<if test="updateTime != null and updateTime != ''">
updateTime = #{updateTime,jdbcType=VARCHAR},
</if>
</set>
where id = #{id}
</update>
<select id="selectDetailIds" resultType="java.lang.Integer">
select id from inv_maintenance_order_detail where orderIdFk = #{orderId}
</select>
</mapper>