|
@@ -2,11 +2,11 @@
|
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
<mapper namespace="com.caimei.mapper.cmMapper.AuthProductMapper">
|
|
|
<insert id="insertProduct" keyColumn="id" keyProperty="productId" useGeneratedKeys="true" parameterType="com.caimei.model.po.ProductPo">
|
|
|
- insert into cm_brand_auth_product(`authId`, `brandId`, `productTypeId`, `snCode`, `image`,`pcImage`,`appletsImage`,
|
|
|
+ insert into cm_brand_auth_product(`authId`, `brandId`, `productTypeId`, `snCode`,
|
|
|
`originalCertificateImage`,`certificateImage`,`pcCertificateImage`,
|
|
|
`appletsCertificateImage`, `addQrCodeFlag`,`addTemplateType`, `status`,
|
|
|
`auditStatus`,`createTime`, `createBy`)
|
|
|
- values (#{authId}, #{brandId}, #{productTypeId}, #{snCode}, #{productImage}, #{pcImage}, #{appletsImage},
|
|
|
+ values (#{authId}, #{brandId}, #{productTypeId}, #{snCode},
|
|
|
#{originalCertificateImage}, #{certificateImage}, #{pcCertificateImage},
|
|
|
#{appletsCertificateImage}, #{addQrCodeFlag}, #{addTemplateType}, #{status},
|
|
|
#{auditStatus}, #{createTime},#{createBy})
|
|
@@ -16,8 +16,9 @@
|
|
|
values (#{productId}, #{paramName}, #{paramContent})
|
|
|
</insert>
|
|
|
<insert id="insertProductType">
|
|
|
- insert into cm_brand_product_type (authUserId, name, image, status, auditStatus, createBy, createTime)
|
|
|
- values (#{authUserId}, #{name}, #{image}, #{status}, #{auditStatus}, #{createBy}, #{createTime}) </insert>
|
|
|
+ insert into cm_brand_product_type (authUserId, name, image, pcImage, appletsImage, status, auditStatus, createBy, createTime, delFlag)
|
|
|
+ values (#{authUserId}, #{name}, #{image}, #{pcImage}, #{appletsImage}, #{status}, #{auditStatus}, #{createBy}, #{createTime}, 0)
|
|
|
+ </insert>
|
|
|
|
|
|
<update id="updateProductStatusByProductId">
|
|
|
update cm_brand_auth_product
|
|
@@ -30,16 +31,9 @@
|
|
|
`brandId` = #{brandId},
|
|
|
`productTypeId` = #{productTypeId},
|
|
|
`snCode` = #{snCode},
|
|
|
- `image` = #{productImage},
|
|
|
`certificateImage` = #{certificateImage},
|
|
|
`addQrCodeFlag` = #{addQrCodeFlag},
|
|
|
`addTemplateType` = #{addTemplateType},
|
|
|
- <if test="pcImage != null and pcImage != ''">
|
|
|
- `pcImage` = #{pcImage},
|
|
|
- </if>
|
|
|
- <if test="appletsImage != null and appletsImage != ''">
|
|
|
- `appletsImage` = #{appletsImage},
|
|
|
- </if>
|
|
|
<if test="originalCertificateImage != null and originalCertificateImage != ''">
|
|
|
`originalCertificateImage` = #{originalCertificateImage},
|
|
|
</if>
|
|
@@ -81,6 +75,12 @@
|
|
|
<update id="updateProductType">
|
|
|
update cm_brand_product_type
|
|
|
set name = #{name},
|
|
|
+ <if test="pcImage != null and pcImage != ''">
|
|
|
+ pcImage = #{pcImage},
|
|
|
+ </if>
|
|
|
+ <if test="appletsImage != null and appletsImage != ''">
|
|
|
+ appletsImage = #{appletsImage},
|
|
|
+ </if>
|
|
|
image = #{image}
|
|
|
where id = #{productTypeId}
|
|
|
</update>
|
|
@@ -104,14 +104,14 @@
|
|
|
<delete id="deleteParamsByProductId">
|
|
|
delete from cm_brand_product_param where productId = #{productId}
|
|
|
</delete>
|
|
|
- <delete id="deleteProductType">
|
|
|
- delete from cm_brand_product_type where id = #{productTypeId}
|
|
|
- </delete>
|
|
|
+ <update id="deleteProductType">
|
|
|
+ update cm_brand_product_type set delFlag = 1 where id = #{productTypeId}
|
|
|
+ </update>
|
|
|
<select id="getProductList" resultType="com.caimei.model.vo.ProductListVo">
|
|
|
select p.id as productId,t.name as productName,snCode,p.status,p.auditStatus,p.createTime,cu.name as createBy,
|
|
|
au.name as auditBy,p.auditTime,p.invalidReason
|
|
|
from cm_brand_auth_product p
|
|
|
- left join cm_brand_product_type t on p.productTypeId = t.id
|
|
|
+ left join cm_brand_product_type t on p.productTypeId = t.id and t.delFlag = 0
|
|
|
left join cm_brand_auth_user cu on p.createBy = cu.authUserId
|
|
|
left join cm_brand_auth_user au on p.auditBy = au.authUserId
|
|
|
where authId = #{authId}
|
|
@@ -140,19 +140,20 @@
|
|
|
select id from cm_brand_auth_product where snCode = #{snCode} limit 1
|
|
|
</select>
|
|
|
<select id="getProductFormByProductId" resultType="com.caimei.model.vo.ProductFormVo">
|
|
|
- select `id` as productId,
|
|
|
+ select p.`id` as productId,
|
|
|
`authId`,
|
|
|
`brandId`,
|
|
|
- `name` as productName,
|
|
|
+ t.name as productName,
|
|
|
`snCode`,
|
|
|
- `image` as productImage,
|
|
|
+ t.`image` as productImage,
|
|
|
`certificateImage`,
|
|
|
`originalCertificateImage`,
|
|
|
addQrCodeFlag,
|
|
|
addTemplateType,
|
|
|
- `status`
|
|
|
- from cm_brand_auth_product
|
|
|
- where id = #{productId}
|
|
|
+ p.`status`
|
|
|
+ from cm_brand_auth_product p
|
|
|
+ left join cm_brand_product_type t on p.productTypeId = t.id and t.delFlag = 0
|
|
|
+ where p.id = #{productId}
|
|
|
</select>
|
|
|
<select id="getParamsByProductId" resultType="com.caimei.model.po.ProductParamPo">
|
|
|
select `name` as paramName, `content` as paramContent
|
|
@@ -163,9 +164,9 @@
|
|
|
select id from cm_brand_auth_product where authId = #{authId}
|
|
|
</select>
|
|
|
<select id="getImageByProductId" resultType="com.caimei.model.po.ProductPo">
|
|
|
- select image as productImage,
|
|
|
- pcImage,
|
|
|
- appletsImage,
|
|
|
+ select t.image as productImage,
|
|
|
+ t.pcImage,
|
|
|
+ t.appletsImage,
|
|
|
addQrCodeFlag,
|
|
|
originalCertificateImage,
|
|
|
certificateImage,
|
|
@@ -173,8 +174,9 @@
|
|
|
appletsCertificateImage,
|
|
|
addQrCodeFlag,
|
|
|
addTemplateType
|
|
|
- from cm_brand_auth_product
|
|
|
- where id = #{productId}
|
|
|
+ from cm_brand_auth_product p
|
|
|
+ left join cm_brand_product_type t on p.productTypeId = t.id and t.delFlag = 0
|
|
|
+ where p.id = #{productId}
|
|
|
</select>
|
|
|
<select id="getAllImage" resultType="com.caimei.model.po.ProductPo">
|
|
|
select id as productId,
|
|
@@ -187,9 +189,9 @@
|
|
|
from cm_brand_auth_product
|
|
|
</select>
|
|
|
<select id="getWxProductList" resultType="com.caimei.model.vo.WxProductListVo">
|
|
|
- select p.id as productId,p.authId, t.name as productName,p.snCode,p.image as productImage,a.authParty as clubName
|
|
|
+ select p.id as productId,p.authId, t.name as productName,p.snCode,t.image as productImage,a.authParty as clubName
|
|
|
from cm_brand_auth_product p
|
|
|
- left join cm_brand_product_type t on p.productTypeId = t.id
|
|
|
+ left join cm_brand_product_type t on p.productTypeId = t.id and t.delFlag = 0
|
|
|
left join cm_brand_auth a on p.authId = a.id
|
|
|
left join cm_brand_auth_user au on a.authUserId = au.authUserId
|
|
|
where p.productTypeId = #{productTypeId}
|
|
@@ -207,9 +209,9 @@
|
|
|
select id from cm_brand where name = #{brand}
|
|
|
</select>
|
|
|
<select id="getAuthProductList" resultType="com.caimei.model.vo.ProductFormVo">
|
|
|
- select p.id as productId,t.name as productName,snCode,cb.name as brandName,image as productImage,certificateImage
|
|
|
+ select p.id as productId,t.name as productName,snCode,cb.name as brandName,t.image as productImage,certificateImage
|
|
|
from cm_brand_auth_product p
|
|
|
- left join cm_brand_product_type t on p.productTypeId = t.id
|
|
|
+ left join cm_brand_product_type t on p.productTypeId = t.id and t.delFlag = 0
|
|
|
left join cm_brand cb on p.brandId = cb.id
|
|
|
where authId = #{authId}
|
|
|
order by createTime desc
|
|
@@ -217,8 +219,8 @@
|
|
|
<select id="getAuthProductByProductId" resultType="com.caimei.module.base.entity.vo.AuthProductVo">
|
|
|
select t.name as productName,
|
|
|
p.snCode,
|
|
|
- p.pcImage,
|
|
|
- p.appletsImage,
|
|
|
+ t.pcImage,
|
|
|
+ t.appletsImage,
|
|
|
p.pcCertificateImage,
|
|
|
p.appletsCertificateImage,
|
|
|
p.brandId,
|
|
@@ -237,7 +239,7 @@
|
|
|
i.statementLink,
|
|
|
i.statementImage
|
|
|
from cm_brand_auth_product p
|
|
|
- left join cm_brand_product_type t on p.productTypeId = t.id
|
|
|
+ left join cm_brand_product_type t on p.productTypeId = t.id and t.delFlag = 0
|
|
|
left join cm_brand_auth a on p.authId = a.id
|
|
|
left join cm_brand_auth_user u on a.authUserId = u.authUserId
|
|
|
left join cm_brand_auth_shop_info i on u.authUserId = i.authUserId and p.brandId = i.brandId
|
|
@@ -265,7 +267,7 @@
|
|
|
<select id="getClubProductList" resultType="com.caimei.model.vo.WxProductListVo">
|
|
|
select p.id as productId, t.name as productName, p.snCode
|
|
|
from cm_brand_auth_product p
|
|
|
- left join cm_brand_product_type t on p.productTypeId = t.id
|
|
|
+ left join cm_brand_product_type t on p.productTypeId = t.id and t.delFlag = 0
|
|
|
where p.authId = #{authId}
|
|
|
and p.status = 1
|
|
|
and p.auditStatus = 1
|
|
@@ -277,7 +279,7 @@
|
|
|
from cm_brand_product_type t
|
|
|
left join cm_brand_auth_user cu on t.createBy = cu.authUserId
|
|
|
left join cm_brand_auth_user au on t.auditBy = au.authUserId
|
|
|
- where t.authUserId = #{authUserId}
|
|
|
+ where t.authUserId = #{authUserId} and t.delFlag = 0
|
|
|
<if test="name != null and name != ''">
|
|
|
and t.name like CONCAT('%',#{name},'%')
|
|
|
</if>
|
|
@@ -300,10 +302,15 @@
|
|
|
select t.id as productTypeId,t.name,t.image
|
|
|
from cm_brand_product_type t
|
|
|
left join cm_brand_auth_user u on t.authUserId = u.authUserId
|
|
|
- where u.appId = #{appId}
|
|
|
+ where u.appId = #{appId} and t.delFlag = 0
|
|
|
<if test="name != null and name != ''">
|
|
|
and t.name like concat('%',#{name},'%')
|
|
|
</if>
|
|
|
order by t.id desc
|
|
|
</select>
|
|
|
+ <select id="getProductType" resultType="com.caimei.model.po.ProductTypePo">
|
|
|
+ select id as productTypeId, name, image, pcImage, appletsImage
|
|
|
+ from cm_brand_product_type
|
|
|
+ where id = #{productTypeId};
|
|
|
+ </select>
|
|
|
</mapper>
|