提交 2fad5f90 作者: xiaowang

新增:型号 品牌

上级 87a879ae
package com.mmc.pms.controller; package com.mmc.pms.controller;
import com.mmc.pms.common.ResultBody; import com.mmc.pms.common.ResultBody;
import com.mmc.pms.model.category.qo.ModeInfoQO;
import com.mmc.pms.model.category.vo.ModeInfoVO;
import com.mmc.pms.model.sale.dto.BrandInfoDTO; import com.mmc.pms.model.sale.dto.BrandInfoDTO;
import com.mmc.pms.service.BrandManageService; import com.mmc.pms.service.BrandManageService;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/** /**
* @Author LW * @Author LW
...@@ -17,8 +16,8 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -17,8 +16,8 @@ import org.springframework.web.bind.annotation.RestController;
*/ */
@RestController @RestController
@RequestMapping("/brand") @RequestMapping("/brand")
@Api(tags = {"后台-品牌管理-相关接口"}) @Api(tags = {"V1.0.3-品牌管理-相关接口"})
public class BackstageBrandManageController { public class BrandManageController {
@Autowired @Autowired
private BrandManageService brandManageService; private BrandManageService brandManageService;
...@@ -33,11 +32,11 @@ public class BackstageBrandManageController { ...@@ -33,11 +32,11 @@ public class BackstageBrandManageController {
@ApiOperation(value = "品牌列表") @ApiOperation(value = "品牌列表")
@GetMapping("listBrandInfo") @GetMapping("listBrandInfo")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = BrandInfoDTO.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = BrandInfoDTO.class)})
public ResultBody listBrandInfo(@RequestParam Integer pageNo, @RequestParam Integer pageSize) { public ResultBody<BrandInfoDTO> listBrandInfo(@RequestParam Integer pageNo, @RequestParam Integer pageSize) {
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) {
...@@ -51,4 +50,26 @@ public class BackstageBrandManageController { ...@@ -51,4 +50,26 @@ public class BackstageBrandManageController {
return brandManageService.editBrandInfo(id, brandName); return brandManageService.editBrandInfo(id, brandName);
} }
@ApiOperation(value = "新增型号")
@PostMapping("addMode")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody addMode(@RequestBody ModeInfoVO param) {
return brandManageService.addMode(param);
}
@ApiOperation(value = "型号列表")
@PostMapping("modeList")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ModeInfoVO.class)})
public ResultBody modeList(@RequestBody ModeInfoQO param) {
return ResultBody.success(brandManageService.modeList(param));
}
@ApiOperation(value = "编辑型号")
@PostMapping("editMode")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
public ResultBody editMode(@RequestBody ModeInfoVO param) {
return brandManageService.editMode(param);
}
} }
...@@ -5,10 +5,7 @@ import com.mmc.pms.model.category.vo.ProductTypeVO; ...@@ -5,10 +5,7 @@ import com.mmc.pms.model.category.vo.ProductTypeVO;
import com.mmc.pms.model.group.Create; import com.mmc.pms.model.group.Create;
import com.mmc.pms.model.group.Update; import com.mmc.pms.model.group.Update;
import com.mmc.pms.service.category.ProductAttributeService; import com.mmc.pms.service.category.ProductAttributeService;
import io.swagger.annotations.Api; import io.swagger.annotations.*;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -60,4 +57,12 @@ public class ProductAttributeController { ...@@ -60,4 +57,12 @@ public class ProductAttributeController {
public ResultBody<ProductTypeVO> typeList(@RequestParam Integer pageNo, @RequestParam Integer pageSize) { public ResultBody<ProductTypeVO> typeList(@RequestParam Integer pageNo, @RequestParam Integer pageSize) {
return ResultBody.success(productAttributeService.typeList(pageNo, pageSize)); return ResultBody.success(productAttributeService.typeList(pageNo, pageSize));
} }
@ApiOperation(value = "商品列表-排序")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@GetMapping("exchange")
public ResultBody exchange(@ApiParam(value = "第一个id", required = true) @RequestParam(value = "firstId") Integer firstId,
@ApiParam(value = "第二个id", required = true) @RequestParam(value = "secondId") Integer secondId) {
return productAttributeService.exchange(firstId, secondId);
}
} }
...@@ -2,6 +2,9 @@ package com.mmc.pms.dao; ...@@ -2,6 +2,9 @@ package com.mmc.pms.dao;
import com.mmc.pms.entity.BrandInfoDO; import com.mmc.pms.entity.BrandInfoDO;
import com.mmc.pms.entity.category.DeviceModeDO;
import com.mmc.pms.model.category.qo.ModeInfoQO;
import com.mmc.pms.model.category.vo.ModeInfoVO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -71,4 +74,16 @@ public interface BrandManageDao { ...@@ -71,4 +74,16 @@ public interface BrandManageDao {
* @param brandInfoDO 品牌信息做 * @param brandInfoDO 品牌信息做
*/ */
void updateBrandInfo(BrandInfoDO brandInfoDO); void updateBrandInfo(BrandInfoDO brandInfoDO);
int countModeInfoByName(ModeInfoVO param);
void insertModeInfo(DeviceModeDO modeInfoDO);
int countModeInfo(ModeInfoQO param);
List<DeviceModeDO> listDeviceMode(ModeInfoQO param);
void updateModeInfo(DeviceModeDO modeInfoDO);
List<DeviceModeDO> listDeviceModeByBrandId(List<Integer> ids);
} }
...@@ -4,6 +4,7 @@ import com.mmc.pms.entity.category.ProductTypeDO; ...@@ -4,6 +4,7 @@ import com.mmc.pms.entity.category.ProductTypeDO;
import com.mmc.pms.model.category.vo.ProductTypeVO; import com.mmc.pms.model.category.vo.ProductTypeVO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
...@@ -26,4 +27,7 @@ public interface ProductAttributeDao { ...@@ -26,4 +27,7 @@ public interface ProductAttributeDao {
int countType(); int countType();
List<ProductTypeDO> listType(Integer pageNo, Integer pageSize); List<ProductTypeDO> listType(Integer pageNo, Integer pageSize);
int updateProductAttribute(Integer id, Date createTime);
} }
package com.mmc.pms.entity.category;
import com.mmc.pms.model.category.vo.ModeInfoVO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.Date;
/**
* (DeviceModeDO)实体类
*
* @author makejava
* @since 2023-08-10 11:26:00
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class DeviceModeDO implements Serializable {
private static final long serialVersionUID = -76818224092139310L;
private Integer id;
private Integer brandInfoId;
private Integer productTypeId;
private String modelName;
private String tag;
private Date createTime;
private Date updateTime;
public DeviceModeDO(ModeInfoVO param) {
this.id = param.getId();
this.brandInfoId = param.getBrandInfoId();
this.productTypeId = param.getProductTypeId();
this.modelName = param.getModeName();
this.tag = param.getTag();
}
public ModeInfoVO buildModeInfoVO() {
return ModeInfoVO.builder().id(id).productTypeId(productTypeId)
.brandInfoId(brandInfoId).modeName(modelName).tag(tag).build();
}
}
package com.mmc.pms.model.category.qo;
import com.mmc.pms.common.Page;
import com.mmc.pms.model.group.Freeze;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* @Author LW
* @date 2023/8/10 11:20
* 概要:
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ModeInfoQO implements Serializable {
private static final long serialVersionUID = -4803514505953618319L;
@ApiModelProperty(value = "品牌id", example = "1")
private Integer brandInfoId;
@ApiModelProperty(value = "类型id", example = "1")
private Integer productTypeId;
@ApiModelProperty(value = "当前页", required = true, example = "1")
@NotNull(message = "当前页不能为空", groups = {Page.class, Freeze.class})
@Min(value = 1, groups = Page.class)
private Integer pageNo;
@ApiModelProperty(value = "页大小", required = true, example = "10")
@NotNull(message = "页大小不能为空", groups = {Page.class, Freeze.class})
@Min(value = 1, groups = Page.class)
private Integer pageSize;
public void buildCurrentPage() {
this.pageNo = (pageNo - 1) * pageSize;
}
}
package com.mmc.pms.model.category.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @Author LW
* @date 2023/8/10 11:20
* 概要:
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class ModeInfoVO implements Serializable {
private static final long serialVersionUID = -4803514505953618319L;
@ApiModelProperty(value = "id", example = "1")
private Integer id;
@ApiModelProperty(value = "型号名称", example = "型号名称")
private String modeName;
@ApiModelProperty(value = "品牌id", example = "1")
private Integer brandInfoId;
@ApiModelProperty(value = "类型id", example = "1")
private Integer productTypeId;
@ApiModelProperty(value = "标签", example = "标签")
private String tag;
}
package com.mmc.pms.model.sale.dto; package com.mmc.pms.model.sale.dto;
import com.mmc.pms.model.category.vo.ModeInfoVO;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
...@@ -7,6 +8,7 @@ import lombok.NoArgsConstructor; ...@@ -7,6 +8,7 @@ import lombok.NoArgsConstructor;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
...@@ -22,6 +24,6 @@ public class BrandInfoDTO implements Serializable { ...@@ -22,6 +24,6 @@ public class BrandInfoDTO implements Serializable {
private static final long serialVersionUID = 2845503394350034900L; private static final long serialVersionUID = 2845503394350034900L;
private Integer id; private Integer id;
private String brandName; private String brandName;
private List<ModeInfoVO> modeInfoList;
private Date createTime; private Date createTime;
} }
...@@ -2,6 +2,8 @@ package com.mmc.pms.service; ...@@ -2,6 +2,8 @@ package com.mmc.pms.service;
import com.mmc.pms.common.ResultBody; import com.mmc.pms.common.ResultBody;
import com.mmc.pms.model.category.qo.ModeInfoQO;
import com.mmc.pms.model.category.vo.ModeInfoVO;
import com.mmc.pms.page.PageResult; import com.mmc.pms.page.PageResult;
/** /**
...@@ -46,4 +48,10 @@ public interface BrandManageService { ...@@ -46,4 +48,10 @@ public interface BrandManageService {
ResultBody editBrandInfo(Integer id, String name); ResultBody editBrandInfo(Integer id, String name);
ResultBody deleteBrandInfo(Integer id); ResultBody deleteBrandInfo(Integer id);
ResultBody addMode(ModeInfoVO param);
PageResult modeList(ModeInfoQO param);
ResultBody editMode(ModeInfoVO param);
} }
...@@ -43,4 +43,6 @@ public interface ProductAttributeService { ...@@ -43,4 +43,6 @@ public interface ProductAttributeService {
ResultBody<ProductTypeVO> typeDetails(Integer id); ResultBody<ProductTypeVO> typeDetails(Integer id);
PageResult typeList(Integer pageNo, Integer pageSize); PageResult typeList(Integer pageNo, Integer pageSize);
ResultBody exchange(Integer firstId, Integer secondId);
} }
...@@ -8,6 +8,8 @@ import com.mmc.pms.model.category.vo.ProductTypeVO; ...@@ -8,6 +8,8 @@ import com.mmc.pms.model.category.vo.ProductTypeVO;
import com.mmc.pms.page.PageResult; import com.mmc.pms.page.PageResult;
import com.mmc.pms.service.category.ProductAttributeService; import com.mmc.pms.service.category.ProductAttributeService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List; import java.util.List;
...@@ -64,4 +66,19 @@ public class ProductAttributeServiceImpl implements ProductAttributeService { ...@@ -64,4 +66,19 @@ public class ProductAttributeServiceImpl implements ProductAttributeService {
List<ProductTypeDO> productTypeList = productAttributeDao.listType((pageNo - 1) * pageSize, pageSize); List<ProductTypeDO> productTypeList = productAttributeDao.listType((pageNo - 1) * pageSize, pageSize);
return PageResult.buildPage(pageNo, pageSize, count, productTypeList.stream().map(ProductTypeDO::buildProductType).collect(Collectors.toList())); return PageResult.buildPage(pageNo, pageSize, count, productTypeList.stream().map(ProductTypeDO::buildProductType).collect(Collectors.toList()));
} }
@Override
@Transactional(rollbackFor = Exception.class)
public ResultBody exchange(Integer firstId, Integer secondId) {
ProductTypeDO firstType = productAttributeDao.getType(firstId);
ProductTypeDO secondType = productAttributeDao.getType(secondId);
int updateCount1 = productAttributeDao.updateProductAttribute(firstId, secondType.getCreateTime());
int updateCount2 = productAttributeDao.updateProductAttribute(secondId, firstType.getCreateTime());
if (updateCount1 == updateCount2) {
return ResultBody.success();
} else {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return ResultBody.error("排序失败");
}
}
} }
...@@ -5,6 +5,9 @@ import com.mmc.pms.common.ResultEnum; ...@@ -5,6 +5,9 @@ import com.mmc.pms.common.ResultEnum;
import com.mmc.pms.dao.BrandManageDao; import com.mmc.pms.dao.BrandManageDao;
import com.mmc.pms.dao.ProductDao; import com.mmc.pms.dao.ProductDao;
import com.mmc.pms.entity.BrandInfoDO; import com.mmc.pms.entity.BrandInfoDO;
import com.mmc.pms.entity.category.DeviceModeDO;
import com.mmc.pms.model.category.qo.ModeInfoQO;
import com.mmc.pms.model.category.vo.ModeInfoVO;
import com.mmc.pms.model.sale.dto.BrandInfoDTO; import com.mmc.pms.model.sale.dto.BrandInfoDTO;
import com.mmc.pms.page.PageResult; import com.mmc.pms.page.PageResult;
import com.mmc.pms.service.BrandManageService; import com.mmc.pms.service.BrandManageService;
...@@ -13,82 +16,128 @@ import org.springframework.stereotype.Service; ...@@ -13,82 +16,128 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
* @Author LW * @Author LW
*
* @date 2023/3/14 13:27 概要: * @date 2023/3/14 13:27 概要:
*/ */
@Service @Service
public class BrandManageServiceImpl implements BrandManageService { public class BrandManageServiceImpl implements BrandManageService {
@Autowired private BrandManageDao brandManageDao; @Autowired
@Resource private ProductDao productDao; private BrandManageDao brandManageDao;
@Resource
private ProductDao productDao;
/** /**
* 添加品牌信息 * 添加品牌信息
* *
* @param brandName 品牌名称 * @param brandName 品牌名称
* @return {@link ResultBody} * @return {@link ResultBody}
*/ */
@Override @Override
public ResultBody addBrandInfo(String brandName) { public ResultBody addBrandInfo(String brandName) {
// 根据品牌名称判断是否存在 // 根据品牌名称判断是否存在
int count = brandManageDao.countBrandInfoByName(null, brandName); int count = brandManageDao.countBrandInfoByName(null, brandName);
if (count > 0) { if (count > 0) {
return ResultBody.error(ResultEnum.GOODS_CATEGORY_NAME_EXIST_ERROR); return ResultBody.error(ResultEnum.GOODS_CATEGORY_NAME_EXIST_ERROR);
}
BrandInfoDO brandInfoDO = new BrandInfoDO(brandName);
brandManageDao.insertBrandInfo(brandInfoDO);
return ResultBody.success();
} }
BrandInfoDO brandInfoDO = new BrandInfoDO(brandName);
brandManageDao.insertBrandInfo(brandInfoDO);
return ResultBody.success();
}
/** /**
* 品牌列表信息 * 品牌列表信息
* *
* @return {@link ResultBody} * @return {@link ResultBody}
*/ */
@Override @Override
public PageResult listBrandInfo(Integer pageNo, Integer pageSize) { public PageResult listBrandInfo(Integer pageNo, Integer pageSize) {
int count = brandManageDao.countBrandInfo(); int count = brandManageDao.countBrandInfo();
if (count == 0) { if (count == 0) {
return PageResult.buildPage(pageNo, pageSize, 0); return PageResult.buildPage(pageNo, pageSize, count);
}
int itemIndex = (pageNo - 1) * pageSize;
List<BrandInfoDO> brandInfo = brandManageDao.listBrandInfo(itemIndex, pageSize);
List<Integer> ids = brandInfo.stream().map(BrandInfoDO::getId).collect(Collectors.toList());
List<DeviceModeDO> deviceModeDOList = brandManageDao.listDeviceModeByBrandId(ids);
Map<Integer, List<DeviceModeDO>> map = deviceModeDOList.stream().collect(Collectors.groupingBy(DeviceModeDO::getBrandInfoId));
List<BrandInfoDTO> brandInfoList =
brandInfo.stream().map(BrandInfoDO::buildBrandInfoDTO).collect(Collectors.toList());
brandInfoList = brandInfoList.stream().peek(d -> {
List<DeviceModeDO> deviceModeList = map.get(d.getId());
d.setModeInfoList(deviceModeList.stream().map(DeviceModeDO::buildModeInfoVO).collect(Collectors.toList()));
}).collect(Collectors.toList());
return PageResult.buildPage(pageNo, pageSize, count, brandInfoList);
} }
int itemIndex = (pageNo - 1) * pageSize;
List<BrandInfoDO> brandInfo = brandManageDao.listBrandInfo(itemIndex, pageSize);
List<BrandInfoDTO> brandInfoList =
brandInfo.stream().map(BrandInfoDO::buildBrandInfoDTO).collect(Collectors.toList());
return PageResult.buildPage(pageNo, pageSize, count, brandInfoList);
}
/** /**
* 删除品牌信息 * 删除品牌信息
* *
* @param id id * @param id id
* @return {@link ResultBody} * @return {@link ResultBody}
*/ */
@Override @Override
public ResultBody deleteBrandInfo(Integer id) { public ResultBody deleteBrandInfo(Integer id) {
// 判断该品牌是否绑定产品信息 // 判断该品牌是否绑定产品信息
int count = productDao.countProductSpecByBrandId(id); int count = productDao.countProductSpecByBrandId(id);
if (count > 0) { if (count > 0) {
return ResultBody.error(ResultEnum.BRAND_DELETE_FAIL); return ResultBody.error(ResultEnum.BRAND_DELETE_FAIL);
}
brandManageDao.removeBrandInfoById(id);
return ResultBody.success();
} }
brandManageDao.removeBrandInfoById(id);
return ResultBody.success();
}
@Override @Override
public ResultBody editBrandInfo(Integer id, String brandName) { public ResultBody editBrandInfo(Integer id, String brandName) {
// 根据品牌名称判断是否存在 // 根据品牌名称判断是否存在
int count = brandManageDao.countBrandInfoByName(id, brandName); int count = brandManageDao.countBrandInfoByName(id, brandName);
if (count > 0) { if (count > 0) {
return ResultBody.error(ResultEnum.GOODS_CATEGORY_NAME_EXIST_ERROR); return ResultBody.error(ResultEnum.GOODS_CATEGORY_NAME_EXIST_ERROR);
}
BrandInfoDO brandInfoDO = new BrandInfoDO(brandName);
brandInfoDO.setId(id);
brandManageDao.updateBrandInfo(brandInfoDO);
return ResultBody.success();
} }
BrandInfoDO brandInfoDO = new BrandInfoDO(brandName);
brandInfoDO.setId(id); @Override
brandManageDao.updateBrandInfo(brandInfoDO); public ResultBody addMode(ModeInfoVO param) {
return ResultBody.success(); int count = brandManageDao.countModeInfoByName(param);
} if (count > 0) {
return ResultBody.error(ResultEnum.GOODS_CATEGORY_NAME_EXIST_ERROR);
}
DeviceModeDO modeInfoDO = new DeviceModeDO(param);
brandManageDao.insertModeInfo(modeInfoDO);
return ResultBody.success();
}
@Override
public PageResult modeList(ModeInfoQO param) {
int count = brandManageDao.countModeInfo(param);
if (count == 0) {
return PageResult.buildPage(param.getPageNo(), param.getPageSize(), count);
}
Integer pageNo = param.getPageNo();
param.buildCurrentPage();
List<DeviceModeDO> deviceModeDOList = brandManageDao.listDeviceMode(param);
List<ModeInfoVO> list = deviceModeDOList.stream().map(DeviceModeDO::buildModeInfoVO).collect(Collectors.toList());
return PageResult.buildPage(pageNo, param.getPageSize(), count, list);
}
@Override
public ResultBody editMode(ModeInfoVO param) {
int count = brandManageDao.countModeInfoByName(param);
if (count > 0) {
return ResultBody.error(ResultEnum.GOODS_CATEGORY_NAME_EXIST_ERROR);
}
DeviceModeDO modeInfoDO = new DeviceModeDO(param);
brandManageDao.updateModeInfo(modeInfoDO);
return ResultBody.success();
}
} }
...@@ -8,6 +8,14 @@ ...@@ -8,6 +8,14 @@
values (#{brandName}); values (#{brandName});
</insert> </insert>
<insert id="insertModeInfo">
insert into device_mode (brand_info_id,
product_type_id,
model_name,
tag)
values (#{brandInfoId}, #{productTypeId}, #{modelName}, #{tag})
</insert>
<update id="removeBrandInfoById"> <update id="removeBrandInfoById">
update brand_info update brand_info
set is_delete = 1 set is_delete = 1
...@@ -18,6 +26,14 @@ ...@@ -18,6 +26,14 @@
set brand_name = #{brandName} set brand_name = #{brandName}
where id = #{id} where id = #{id}
</update> </update>
<update id="updateModeInfo">
update device_mode
set brand_info_id = #{brandInfoId},
product_type_id = #{productTypeId},
model_name = #{modelName},
tag = #{tag}
where id = #{id}
</update>
<select id="countBrandInfoByName" resultType="java.lang.Integer"> <select id="countBrandInfoByName" resultType="java.lang.Integer">
select count(*) select count(*)
...@@ -48,4 +64,54 @@ ...@@ -48,4 +64,54 @@
from brand_info from brand_info
where is_delete = 0 where is_delete = 0
</select> </select>
<select id="countModeInfoByName" resultType="java.lang.Integer">
select count(*)
from device_mode
where model_name = #{modeName}
<if test="id!=null and id!=''">
and id <![CDATA[<>]]> #{id}
</if>
</select>
<select id="countModeInfo" resultType="java.lang.Integer">
select count(*)
from device_mode
<where>
<if test="brandInfoId != null">
brand_info_id = #{brandInfoId}
</if>
<if test="productTypeId != null">
and product_type_id = #{productTypeId}
</if>
</where>
</select>
<select id="listDeviceMode" resultType="com.mmc.pms.entity.category.DeviceModeDO">
select id,
brand_info_id,
product_type_id,
model_name,
tag
from device_mode
<where>
<if test="brandInfoId != null">
brand_info_id = #{brandInfoId}
</if>
<if test="productTypeId != null">
and product_type_id = #{productTypeId}
</if>
</where>
order by create_time desc
limit #{pageNo},#{pageSize}
</select>
<select id="listDeviceModeByBrandId" resultType="com.mmc.pms.entity.category.DeviceModeDO">
select id,
brand_info_id,
product_type_id,
model_name,
tag
from device_mode
where brand_info_id in
(<foreach collection="list" separator="," index="index" item="item">
#{item}
</foreach>)
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -19,6 +19,11 @@ ...@@ -19,6 +19,11 @@
</set> </set>
where id = #{id} where id = #{id}
</update> </update>
<update id="updateProductAttribute">
update product_type
set create_time = #{createTime}
where id = #{id}
</update>
<delete id="removeType"> <delete id="removeType">
delete delete
from product_type from product_type
...@@ -34,7 +39,7 @@ ...@@ -34,7 +39,7 @@
</if> </if>
</select> </select>
<select id="getType" resultType="com.mmc.pms.entity.category.ProductTypeDO"> <select id="getType" resultType="com.mmc.pms.entity.category.ProductTypeDO">
select id, `name`, url select id, `name`, url, create_time
from product_type from product_type
where id = #{id} where id = #{id}
</select> </select>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论