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.

95 lines
4.9 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.udidl.admin.dao.udplat.UdplatGoodsMatchMapper">
<resultMap id="BaseResultMap" type="com.glxp.udidl.admin.entity.udplat.UdplatGoodsMatch">
<id column="id" jdbcType="INTEGER" property="id"/>
<result column="deviceRecordKey" jdbcType="VARCHAR" property="deviceRecordKey"/>
<result column="deliveryGoodsId" jdbcType="VARCHAR" property="deliveryGoodsId"/>
<result column="medicalCode" jdbcType="VARCHAR" property="medicalCode"/>
<result column="createTime" jdbcType="TIMESTAMP" property="createTime"/>
<result column="updateTime" jdbcType="TIMESTAMP" property="updateTime"/>
</resultMap>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete
from udplat_goods_match
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.glxp.udidl.admin.entity.udplat.UdplatGoodsMatch">
insert into udplat_goods_match (id, deviceRecordKey, deliveryGoodsId,
medicalCode, createTime)
values (#{id,jdbcType=INTEGER}, #{deviceRecordKey,jdbcType=VARCHAR}, #{deliveryGoodsId,jdbcType=VARCHAR},
#{medicalCode,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP})
</insert>
<update id="updateByPrimaryKey" parameterType="com.glxp.udidl.admin.entity.udplat.UdplatGoodsMatch">
update udplat_goods_match
set deviceRecordKey = #{deviceRecordKey,jdbcType=VARCHAR},
<if test="projectGoodsCode != null and projectGoodsCode !='' ">
projectGoodsCode = #{deliveryGoodsId,jdbcType=VARCHAR},
</if>
<if test="medicalCode != null and medicalCode !='' ">
medicalCode = #{medicalCode,jdbcType=VARCHAR},
</if>
updateTime = #{updateTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=INTEGER}
</update>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select id, deviceRecordKey, deliveryGoodsId, medicalCode, createTime, updateTime
from udplat_goods_match
where id = #{id,jdbcType=INTEGER}
</select>
<select id="selectAll" resultMap="BaseResultMap">
select id, deviceRecordKey, deliveryGoodsId, medicalCode, createTime, updateTime
from udplat_goods_match
</select>
<select id="selectByDeviceRecordKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select id, deviceRecordKey, deliveryGoodsId, medicalCode, createTime, updateTime
from udplat_goods_match
where deviceRecordKey = #{id}
</select>
<select id="getList" parameterType="com.glxp.udidl.admin.dto.udplat.UdplatGoodsMatchParam"
resultType="com.glxp.udidl.admin.dto.udplat.UdplatGoodsMatchListModel">
select p.uuid, p.nameCode,p.ylqxzcrbarmc,p.zczbhhzbapzbh,
p.cpmctymc,p.ggxh,p.cpms,p.deviceRecordKey,m.deliveryGoodsId,m.medicalCode from productinfo as p
left join udplat_goods_match as m on p.deviceRecordKey = m.deviceRecordKey where p.isNewest =1 and p.diType=1
<if test="name != null and name != ''">
and p.cpmctymc like concat('%',#{name},'%')
</if>
<if test="nameCode != null and nameCode != '' ">
and p.nameCode = #{nameCode}
</if>
<if test="ylqxzcrbarmc != null and ylqxzcrbarmc != '' ">
and p.ylqxzcrbarmc = #{ylqxzcrbarmc}
</if>
<if test="ggxh != null and ggxh != '' ">
and p.ggxh like concat('%',#{ggxh},'%')
</if>
<if test="zczbhhzbapzbh != null and zczbhhzbapzbh != '' ">
and p.zczbhhzbapzbh like concat('%',#{zczbhhzbapzbh},'%')
</if>
<if test="goodsMatchType == 1">
and m.deliveryGoodsId is not null and m.deliveryGoodsId != ''
</if>
<if test="goodsMatchType == 2">
and (m.deliveryGoodsId is null or m.deliveryGoodsId = '')
</if>
<if test="medicalMatchType == 1">
and m.medicalCode is not null and m.medicalCode != ''
</if>
<if test="medicalMatchType == 2">
and (m.medicalCode is null or m.medicalCode = '')
</if>
<if test="startDate != '' and startDate != null">
and p.updateTime >= #{startDate}
</if>
<if test="endDate != '' and endDate != null">
and p.updateTime &lt;= #{endDate}
</if>
</select>
<select id="getMatchList" parameterType="java.lang.String"
resultType="com.glxp.udidl.admin.dto.device.ProductGoodsMatchModel">
select p.*, m.deliveryGoodsId, m.medicalCode
from productinfo as p
left join udplat_goods_match as m on p.deviceRecordKey = m.deviceRecordKey
where p.uuid = #{uuid}
</select>
</mapper>