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/purchase/SupCertDao.xml

158 lines
5.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.api.admin.dao.purchase.SupCertDao">
<select id="filterCompanyCert" parameterType="com.glxp.api.admin.req.purchase.FilterSupCertRequest"
resultType="com.glxp.api.admin.entity.purchase.SupCertEntity">
select * from sup_cert
<where>
<if test="customerId != '' and customerId!=null">
and customerId = #{customerId}
</if>
<if test="manufacturerIdFk != '' and manufacturerIdFk!=null">
and manufacturerIdFk = #{manufacturerIdFk}
</if>
<if test="productIdFk != '' and productIdFk!=null">
and productIdFk = #{productIdFk}
</if>
<if test="type != '' and type!=null">
and `type` = #{type}
</if>
<if test="auditStatus != null and auditStatus !=20 and auditStatus !=24 and auditStatus !=25" >
and auditStatus = #{auditStatus}
</if>
<if test="auditStatus ==20">
and (auditStatus = 1 or auditStatus=4)
</if>
<if test="auditStatus ==24">
and (auditStatus = 2 or auditStatus=3 or auditStatus=5 or auditStatus=6)
</if>
<if test="auditStatus ==25">
and (auditStatus !=0)
</if>
</where>
ORDER BY id DESC
</select>
<select id="findCompanyCertByName" parameterType="java.lang.String"
resultType="com.glxp.api.admin.entity.purchase.SupCertEntity">
SELECT *
FROM sup_cert
where name = #{name}
</select>
<select id="getCompanyCert" parameterType="com.glxp.api.admin.req.purchase.FilterSupCertRequest"
resultType="com.glxp.api.admin.entity.purchase.SupCertEntity">
SELECT * FROM sup_cert
<where>
<if test="customerId != null and customerId != ''">
and customerId = #{customerId}
</if>
<if test="name != null and name != ''">
and name like concat('%',#{name},'%')
</if>
<if test="manufacturerIdFk != null and manufacturerIdFk != ''">
and manufacturerIdFk = #{manufacturerIdFk}
</if>
</where>
</select>
<update id="updateCompanyCert" parameterType="com.glxp.api.admin.entity.purchase.SupCertEntity">
UPDATE sup_cert
<trim prefix="set" suffixOverrides=",">
<if test="name != null">name=#{name},</if>
<if test="customerId != null">customerId=#{customerId},</if>
<if test="filePath != null">filePath=#{filePath},</if>
<if test="remark != null">remark=#{remark},</if>
<if test="createTime != null">createTime=#{createTime},</if>
<if test="updateTime != null">updateTime=#{updateTime},</if>
vailDate=#{vailDate},
expireDate=#{expireDate},
<if test="type != null">`type`=#{type},</if>
<if test="manufacturerIdFk != null">`manufacturerIdFk`=#{manufacturerIdFk},</if>
<if test="productIdFk != null">`productIdFk`=#{productIdFk},</if>
<if test="code != null">`code`=#{code},</if>
<if test="auditStatus != null">`auditStatus`=#{auditStatus},</if>
<if test="auditComment != null">`auditComment`=#{auditComment},</if>
<if test="status != null">`status`=#{status},</if>
</trim>
WHERE id = #{id}
</update>
<update id="updateCustomerId" parameterType="Map">
UPDATE sup_cert
set customerId = #{newId}
<if test="auditStatus != '' and auditStatus!=null">
,auditStatus = #{auditStatus}
</if>
WHERE customerId = #{oldId}
</update>
<update id="updateManufacturerId" parameterType="Map">
UPDATE sup_cert
set customerId = #{newCustomerId}
, manufacturerIdFk = #{newManufacturerIdFk}
WHERE customerId = #{oldCustomerId}
and manufacturerIdFk = #{oldManufacturerIdFk}
</update>
<update id="updateProductId" parameterType="Map">
UPDATE sup_cert
set customerId = #{newCustomerId}
, manufacturerIdFk = #{newManufacturerIdFk}
, productIdFk = #{newProductIdFk}
WHERE customerId = #{oldCustomerId}
and manufacturerIdFk = #{oldManufacturerIdFk}
and productIdFk = #{oldProductIdFk}
</update>
<insert id="insertCompanyCert" parameterType="com.glxp.api.admin.entity.purchase.SupCertEntity">
INSERT INTO sup_cert( `name`, customerId, filePath, remark, createTime, updateTime
, vailDate, expireDate, `type`, manufacturerIdFk, productIdFk, code, auditStatus
, auditComment, status)
values (#{name},
#{customerId},
#{filePath},
#{remark},
#{createTime},
#{updateTime},
#{vailDate},
#{expireDate},
#{type}, #{manufacturerIdFk}, #{productIdFk}, #{code}, #{auditStatus}, #{auditComment}, #{status})
</insert>
<delete id="deleteById" parameterType="Map">
DELETE
FROM sup_cert
WHERE id = #{id}
</delete>
<delete id="deleteCert" parameterType="com.glxp.api.admin.req.purchase.FilterSupCertRequest">
DELETE
FROM sup_cert
<where>
<if test="customerId != '' and customerId!=null">
and customerId = #{customerId}
</if>
<if test="manufacturerIdFk != '' and manufacturerIdFk!=null">
and manufacturerIdFk = #{manufacturerIdFk}
</if>
<if test="productIdFk != '' and productIdFk!=null">
and productIdFk = #{productIdFk}
</if>
</where>
</delete>
</mapper>