|
@@ -19,8 +19,8 @@
|
|
|
values (#{productId}, #{paramName}, #{paramContent})
|
|
|
</insert>
|
|
|
<insert id="insertProductType" keyColumn="id" keyProperty="productTypeId" useGeneratedKeys="true" parameterType="com.caimei.model.po.ProductTypePo">
|
|
|
- insert into cm_brand_product_type (authUserId, infoId, name, image, pcImage, appletsImage, status, auditStatus, auditBy, auditTime, createBy, createSource, createTime, delFlag)
|
|
|
- values (#{authUserId}, #{infoId}, #{name}, #{image}, #{pcImage}, #{appletsImage}, #{status}, #{auditStatus}, #{auditBy}, #{auditTime}, #{createBy}, #{createSource}, #{createTime}, 0)
|
|
|
+ insert into cm_brand_product_type (authUserId, infoId, name, image, pcImage, appletsImage, status, auditStatus, auditBy, auditTime, createBy, createSource, createTime, checkFlag, delFlag)
|
|
|
+ values (#{authUserId}, #{infoId}, #{name}, #{image}, #{pcImage}, #{appletsImage}, #{status}, #{auditStatus}, #{auditBy}, #{auditTime}, #{createBy}, #{createSource}, #{createTime}, #{checkFlag}, 0)
|
|
|
</insert>
|
|
|
<insert id="insertProductTypeParam">
|
|
|
insert into cm_brand_product_type_param (productTypeId, name, content)
|
|
@@ -113,7 +113,8 @@
|
|
|
</if>
|
|
|
image = #{image},
|
|
|
status = #{status},
|
|
|
- auditStatus = #{auditStatus}
|
|
|
+ auditStatus = #{auditStatus},
|
|
|
+ checkFlag = #{checkFlag}
|
|
|
where id = #{productTypeId}
|
|
|
</update>
|
|
|
<update id="updateProductTypeStatus">
|
|
@@ -171,20 +172,22 @@
|
|
|
update cm_brand_product_type set checkFlag = 1 where id = #{productTypeId}
|
|
|
</update>
|
|
|
<select id="getProductList" resultType="com.caimei.model.vo.ProductListVo">
|
|
|
- select r.id as relationId,p.id as productId,a.authUserId, if(p.productTypeId is null,p.name,t.name) as productName,
|
|
|
- snCode,p.status,p.auditStatus,p.shopAuditStatus, p.createTime,
|
|
|
- if(p.createSource = 1,cu.name,cbcu.mobile) as createBy,
|
|
|
- au.name as auditBy,p.auditTime,p.invalidReason,ifnull(p.shopInvalidReason,p.invalidReason) as shopInvalidReason,
|
|
|
- ifnull(au1.name,au1.mobile) as shopAuditBy, p.shopAuditTime, p.checkFlag, p.scanCount
|
|
|
+ select r.id as relationId,p.id as productId,a.authUserId, if(p.productTypeId is null,p.name,t.name) as
|
|
|
+ productName,
|
|
|
+ snCode,p.status,p.auditStatus,p.shopAuditStatus, p.createTime,
|
|
|
+ if(p.createSource = 1,ifnull(cu.loginAccount, cu.name),cbcu.mobile) as createBy,
|
|
|
+ ifnull(au.loginAccount,au.name) as
|
|
|
+ auditBy,p.auditTime,p.invalidReason,ifnull(p.shopInvalidReason,p.invalidReason) as shopInvalidReason,
|
|
|
+ ifnull(au1.loginAccount,au1.name) as shopAuditBy, p.shopAuditTime, p.checkFlag, p.scanCount
|
|
|
from cm_brand_auth_product p
|
|
|
left join cm_brand_product_relation r on p.id = r.productId
|
|
|
- left join cm_brand_auth a on r.authId = a.id
|
|
|
+ left join cm_brand_auth a on r.authId = a.id and a.delFlag = 0
|
|
|
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
|
|
|
left join cm_brand_auth_user au1 on p.shopAuditBy = au1.authUserId
|
|
|
left join cm_brand_club_user cbcu on p.createBy = cbcu.id and cbcu.delFlag = 0
|
|
|
- where r.authId = #{authId}
|
|
|
+ where a.id = #{authId}
|
|
|
<if test="productName != null and productName != ''">
|
|
|
and (t.name like CONCAT('%',#{productName},'%') or t.name like CONCAT('%',#{productName},'%'))
|
|
|
</if>
|
|
@@ -282,6 +285,7 @@
|
|
|
left join cm_brand_auth a on r.authId = a.id
|
|
|
left join cm_brand_auth_user au on a.authUserId = au.authUserId
|
|
|
<where>
|
|
|
+ a.delFlag = 0
|
|
|
<if test="listType == 1">
|
|
|
and p.productTypeId = #{productTypeId}
|
|
|
and au.status = 1
|
|
@@ -310,6 +314,7 @@
|
|
|
</if>
|
|
|
</if>
|
|
|
</where>
|
|
|
+ group by p.id
|
|
|
order by p.createTime desc
|
|
|
</select>
|
|
|
<select id="getAuthProductList" resultType="com.caimei.model.vo.ProductFormVo">
|
|
@@ -348,7 +353,7 @@
|
|
|
from cm_brand_auth_product p
|
|
|
left join cm_brand_product_relation r on p.id = r.productId
|
|
|
left join cm_brand_product_type t on p.productTypeId = t.id and t.delFlag = 0
|
|
|
- left join cm_brand_auth a on r.authId = a.id
|
|
|
+ left join cm_brand_auth a on r.authId = a.id and a.delFlag = 0
|
|
|
left join cm_brand_auth_user u on a.authUserId = u.authUserId
|
|
|
left join cm_brand_auth_shop_info i on t.infoId = i.id
|
|
|
where p.id = #{productId}
|
|
@@ -378,8 +383,8 @@
|
|
|
</select>
|
|
|
<select id="getProductTypeList" resultType="com.caimei.model.vo.ProductTypeListVo">
|
|
|
select t.id as productTypeId,t.name,t.image,t.status,t.auditStatus,t.createTime,
|
|
|
- if(t.createSource = 1,cu.name,cbcu.mobile) as createBy,
|
|
|
- au.name as auditBy,t.auditTime,t.invalidReason,t.checkFlag
|
|
|
+ if(t.createSource = 1,ifnull(cu.loginAccount, cu.name),cbcu.mobile) as createBy,
|
|
|
+ ifnull(au.loginAccount,au.name) as auditBy,t.auditTime,t.invalidReason,t.checkFlag
|
|
|
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
|
|
@@ -414,9 +419,10 @@
|
|
|
order by t.id desc
|
|
|
</select>
|
|
|
<select id="getProductType" resultType="com.caimei.model.po.ProductTypePo">
|
|
|
- select t.id as productTypeId, infoId, i.brandName, t.name, image, pcImage, appletsImage, t.authUserId, createBy
|
|
|
+ select t.id as productTypeId, infoId, i.brandName, t.name, image, pcImage, appletsImage, t.authUserId, t.auditStatus, createBy
|
|
|
from cm_brand_product_type t left join cm_brand_auth_shop_info i on t.infoId = i.id
|
|
|
<where>
|
|
|
+ t.delFlag = 0
|
|
|
<if test="productTypeId != null">
|
|
|
and t.id = #{productTypeId}
|
|
|
</if>
|
|
@@ -442,7 +448,7 @@
|
|
|
from cm_brand_auth_product p
|
|
|
left join cm_brand_product_relation r on p.id = r.productId
|
|
|
left join cm_brand_auth a on r.authId = a.id
|
|
|
- where p.id = #{productId}
|
|
|
+ where p.id = #{productId} and a.delFlag = 0
|
|
|
limit 1
|
|
|
</select>
|
|
|
<select id="getProductTypeParamList" resultType="com.caimei.model.po.ProductParamPo">
|
|
@@ -485,13 +491,13 @@
|
|
|
select DISTINCT snCode
|
|
|
from cm_brand_auth_product p
|
|
|
left join cm_brand_product_relation r on p.id = r.productId
|
|
|
- left join cm_brand_auth a on a.id = r.authId and a.delFlag = 0
|
|
|
- where a.authUserId = #{authUserId} and (r.authType = 2 or (r.authType = 1 and a.id != #{authId}) ) and p.auditStatus = 1
|
|
|
+ left join cm_brand_auth a on a.id = r.authId
|
|
|
+ where a.authUserId = #{authUserId} and a.delFlag = 0 and (r.authType = 2 or (r.authType = 1 and a.id != #{authId}) ) and p.auditStatus = 1
|
|
|
</select>
|
|
|
<select id="getProductClubList" resultType="com.caimei.model.vo.WxClubListVo">
|
|
|
select a.id as authId, a.authParty, a.logo
|
|
|
from cm_brand_auth a
|
|
|
left join cm_brand_product_relation r on a.id = r.authId
|
|
|
- where r.productId = #{productId}
|
|
|
+ where r.productId = #{productId} and a.delFlag = 0
|
|
|
</select>
|
|
|
</mapper>
|