提交 4fbc758a 作者: xiaowang

删除

上级 8cfdb013
...@@ -346,7 +346,9 @@ public enum ResultEnum implements BaseErrorInfoInterface { ...@@ -346,7 +346,9 @@ public enum ResultEnum implements BaseErrorInfoInterface {
GOODS_NOT_EXIST_OR_ALREADY_DOWN_SHELF("30913", "商品不存在或已下架"), GOODS_NOT_EXIST_OR_ALREADY_DOWN_SHELF("30913", "商品不存在或已下架"),
GOODS_NAME_IS_NOT_NULL("30914", "商品名称不能为空或名字长度不能大于60"), GOODS_NAME_IS_NOT_NULL("30914", "商品名称不能为空或名字长度不能大于60"),
GOODS_DELETE_FAIL("30915", "批量删除商品失败,商品已被其他商品绑定"), GOODS_DELETE_FAIL("30915", "批量删除商品失败,商品已被其他商品绑定"),
BRAND_DELETE_FAIL("30916", "删除失败,产品管理中有产品绑定该品牌名称"), BRAND_DELETE_FAIL("30916", "删除失败,有产品绑定该品牌"),
TYPE_DELETE_FAIL("30917", "删除失败,有产品绑定该类型"),
DEVICE_MODE_DELETE_FAIL("30918", "删除失败,有产品绑定该型号"),
// 返祖 // 返祖
RETURN_SHARE_ORDER_ERROR("40000", "设备返祖订单相关信息找不到,请重新输入订单号"), RETURN_SHARE_ORDER_ERROR("40000", "设备返祖订单相关信息找不到,请重新输入订单号"),
RETURN_SHARE_ORDER_NOT_FINISH_ERROR("40001", "此设备的订单未完成,请添加其他设备"), RETURN_SHARE_ORDER_NOT_FINISH_ERROR("40001", "此设备的订单未完成,请添加其他设备"),
......
...@@ -36,7 +36,7 @@ public class BrandManageController { ...@@ -36,7 +36,7 @@ public class BrandManageController {
return ResultBody.success(brandManageService.listBrandInfo(pageNo, pageSize)); return ResultBody.success(brandManageService.listBrandInfo(pageNo, pageSize));
} }
@ApiOperation(value = "删除品牌---待与运营沟通") @ApiOperation(value = "删除品牌")
@GetMapping("deleteBrandInfo") @GetMapping("deleteBrandInfo")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody deleteBrandInfo(Integer id) { public ResultBody deleteBrandInfo(Integer id) {
...@@ -71,5 +71,10 @@ public class BrandManageController { ...@@ -71,5 +71,10 @@ public class BrandManageController {
return brandManageService.editMode(param); return brandManageService.editMode(param);
} }
@ApiOperation(value = "删除型号")
@GetMapping("deleteMode")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody deleteMode(Integer id) {
return brandManageService.deleteMode(id);
}
} }
...@@ -77,6 +77,8 @@ public interface BrandManageDao { ...@@ -77,6 +77,8 @@ public interface BrandManageDao {
int countModeInfoByName(ModeInfoVO param); int countModeInfoByName(ModeInfoVO param);
int countLeaseGoodsByDeviceModeId(Integer id);
void insertModeInfo(DeviceModeDO modeInfoDO); void insertModeInfo(DeviceModeDO modeInfoDO);
int countModeInfo(ModeInfoQO param); int countModeInfo(ModeInfoQO param);
...@@ -86,4 +88,6 @@ public interface BrandManageDao { ...@@ -86,4 +88,6 @@ public interface BrandManageDao {
void updateModeInfo(DeviceModeDO modeInfoDO); void updateModeInfo(DeviceModeDO modeInfoDO);
List<DeviceModeDO> listDeviceModeByBrandId(List<Integer> ids); List<DeviceModeDO> listDeviceModeByBrandId(List<Integer> ids);
void removeModeInfoById(Integer id);
} }
...@@ -76,8 +76,6 @@ public interface ProductDao { ...@@ -76,8 +76,6 @@ public interface ProductDao {
void batchUpdateMallProdSpec(List<Integer> delProductSpecId); void batchUpdateMallProdSpec(List<Integer> delProductSpecId);
int countProductSpecByBrandId(Integer id);
void removeProductSku(Integer id); void removeProductSku(Integer id);
void removeProductSpec(Integer id); void removeProductSpec(Integer id);
...@@ -123,4 +121,6 @@ public interface ProductDao { ...@@ -123,4 +121,6 @@ public interface ProductDao {
int countSpecByProdSkuId(Integer id); int countSpecByProdSkuId(Integer id);
BigDecimal getMarketplacePrice(PriceAcquisition priceAcquisition); BigDecimal getMarketplacePrice(PriceAcquisition priceAcquisition);
int countLeaseGoodsByBrandId(Integer id);
} }
...@@ -30,4 +30,5 @@ public interface ProductAttributeDao { ...@@ -30,4 +30,5 @@ public interface ProductAttributeDao {
int updateProductAttribute(Integer id, Date createTime); int updateProductAttribute(Integer id, Date createTime);
int countLeaseGoodsByTypeId(Integer id);
} }
...@@ -54,4 +54,6 @@ public interface BrandManageService { ...@@ -54,4 +54,6 @@ public interface BrandManageService {
PageResult modeList(ModeInfoQO param); PageResult modeList(ModeInfoQO param);
ResultBody editMode(ModeInfoVO param); ResultBody editMode(ModeInfoVO param);
ResultBody deleteMode(Integer id);
} }
...@@ -47,6 +47,11 @@ public class ProductAttributeServiceImpl implements ProductAttributeService { ...@@ -47,6 +47,11 @@ public class ProductAttributeServiceImpl implements ProductAttributeService {
@Override @Override
public ResultBody removeType(Integer id) { public ResultBody removeType(Integer id) {
// 判断该类型是否绑定产品信息
int count = productAttributeDao.countLeaseGoodsByTypeId(id);
if (count > 0) {
return ResultBody.error(ResultEnum.TYPE_DELETE_FAIL);
}
productAttributeDao.removeType(id); productAttributeDao.removeType(id);
return ResultBody.success(); return ResultBody.success();
} }
......
...@@ -86,7 +86,7 @@ public class BrandManageServiceImpl implements BrandManageService { ...@@ -86,7 +86,7 @@ public class BrandManageServiceImpl implements BrandManageService {
@Override @Override
public ResultBody deleteBrandInfo(Integer id) { public ResultBody deleteBrandInfo(Integer id) {
// 判断该品牌是否绑定产品信息 // 判断该品牌是否绑定产品信息
int count = productDao.countProductSpecByBrandId(id); int count = productDao.countLeaseGoodsByBrandId(id);
if (count > 0) { if (count > 0) {
return ResultBody.error(ResultEnum.BRAND_DELETE_FAIL); return ResultBody.error(ResultEnum.BRAND_DELETE_FAIL);
} }
...@@ -142,5 +142,14 @@ public class BrandManageServiceImpl implements BrandManageService { ...@@ -142,5 +142,14 @@ public class BrandManageServiceImpl implements BrandManageService {
return ResultBody.success(); return ResultBody.success();
} }
@Override
public ResultBody deleteMode(Integer id) {
// 判断该品牌是否绑定产品信息
int count = brandManageDao.countLeaseGoodsByDeviceModeId(id);
if (count > 0) {
return ResultBody.error(ResultEnum.DEVICE_MODE_DELETE_FAIL);
}
brandManageDao.removeModeInfoById(id);
return ResultBody.success();
}
} }
...@@ -34,6 +34,11 @@ ...@@ -34,6 +34,11 @@
tag = #{tag} tag = #{tag}
where id = #{id} where id = #{id}
</update> </update>
<delete id="removeModeInfoById">
delete
from device_mode
where id = #{id}
</delete>
<select id="countBrandInfoByName" resultType="java.lang.Integer"> <select id="countBrandInfoByName" resultType="java.lang.Integer">
select count(*) select count(*)
...@@ -114,4 +119,10 @@ ...@@ -114,4 +119,10 @@
#{item} #{item}
</foreach>) </foreach>)
</select> </select>
<select id="countLeaseGoodsByDeviceModeId" resultType="java.lang.Integer">
select count(*)
from lease_goods
where device_mode_id = #{id}
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
<mapper namespace="com.mmc.pms.dao.ProductDao"> <mapper namespace="com.mmc.pms.dao.ProductDao">
<insert id="insertProductSku" parameterType="com.mmc.pms.entity.ProductDO" <insert id="insertProductSku" parameterType="com.mmc.pms.entity.ProductDO"
useGeneratedKeys="true" keyProperty="id"> useGeneratedKeys="true" keyProperty="id">
insert into product (product_name, model, brand_info_id, customize,`type`) insert into product (product_name, model, brand_info_id, customize, `type`)
values (#{productName}, #{model}, #{brandInfoId}, #{customize},#{type}) values (#{productName}, #{model}, #{brandInfoId}, #{customize}, #{type})
</insert> </insert>
<insert id="insertProductSpec" keyProperty="id" useGeneratedKeys="true" <insert id="insertProductSpec" keyProperty="id" useGeneratedKeys="true"
parameterType="com.mmc.pms.entity.ProductSpecDO"> parameterType="com.mmc.pms.entity.ProductSpecDO">
...@@ -198,9 +198,8 @@ ...@@ -198,9 +198,8 @@
create_time createTime, create_time createTime,
lease_term lease_term
from product_spec_price from product_spec_price
where where product_spec_id = #{productSpecId}
product_spec_id = #{productSpecId} and `type` = #{type}
and `type` =#{type}
</select> </select>
<select id="listProductSpec" resultType="com.mmc.pms.entity.ProductSpecDO"> <select id="listProductSpec" resultType="com.mmc.pms.entity.ProductSpecDO">
select id, select id,
...@@ -263,12 +262,6 @@ ...@@ -263,12 +262,6 @@
#{item} #{item}
</foreach> </foreach>
</select> </select>
<select id="countProductSpecByBrandId" resultType="java.lang.Integer">
select count(*)
from product
where brand_info_id = #{id}
and is_deleted = 0
</select>
<select id="countSpecByproductId" resultType="java.lang.Integer"> <select id="countSpecByproductId" resultType="java.lang.Integer">
select count(*) select count(*)
from product_spec from product_spec
...@@ -532,9 +525,15 @@ ...@@ -532,9 +525,15 @@
product_spec_id = #{specsId} product_spec_id = #{specsId}
and `type` = 1 and `type` = 1
and lease_term = #{day} and lease_term = #{day}
<foreach collection="channelLevelId" index="index" separator="," open="and cooperation_tag in(" close=")" item="d"> <foreach collection="channelLevelId" index="index" separator="," open="and cooperation_tag in(" close=")"
item="d">
#{d} #{d}
</foreach> </foreach>
</where> </where>
</select> </select>
<select id="countLeaseGoodsByBrandId" resultType="java.lang.Integer">
select count(*)
from lease_goods
where brand_info_id = #{id}
</select>
</mapper> </mapper>
...@@ -53,4 +53,9 @@ ...@@ -53,4 +53,9 @@
order by create_time desc order by create_time desc
limit #{pageNo}, #{pageSize} limit #{pageNo}, #{pageSize}
</select> </select>
<select id="countLeaseGoodsByTypeId" resultType="java.lang.Integer">
select count(*)
from lease_goods
where product_type_id = #{id}
</select>
</mapper> </mapper>
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论