|
|
@@ -33,94 +33,93 @@ import java.util.Map;
|
|
|
@Transactional
|
|
|
public class GoodsBrandService extends BaseService<GoodsBrand> {
|
|
|
|
|
|
- @Override
|
|
|
- public BaseMapper<GoodsBrand> getRepository() {
|
|
|
- return goodsBrandMapper;
|
|
|
- }
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private GoodsBrandMapper goodsBrandMapper;
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private GoodsBrandConvert goodsBrandConvert;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private CommonService commonService;
|
|
|
-
|
|
|
- /**
|
|
|
- * @desc : 重写主键
|
|
|
- * @author : 于继渤
|
|
|
- * @date : 2024/2/29 20:29
|
|
|
- */
|
|
|
- @Override
|
|
|
- public String getPrimaryKey() {
|
|
|
- return "brand_id";
|
|
|
- }
|
|
|
- /**
|
|
|
- * @desc : 查询
|
|
|
- * @author : 于继渤
|
|
|
- * @date : 2023/1/5 9:39
|
|
|
- */
|
|
|
- @Pagination
|
|
|
- public ResponseResultVO<PageList<GoodsBrandResponse>> selectByCond(GoodsBrandQuery goodsBrandQuery) {
|
|
|
- return super.mergeListWithCount(goodsBrandQuery, goodsBrandMapper.selectByCond(goodsBrandQuery),
|
|
|
- goodsBrandMapper.countByCond(goodsBrandQuery));
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- /**
|
|
|
- * @desc : 新建
|
|
|
- * @author : 于继渤
|
|
|
- * @date : 2023/1/5 9:39
|
|
|
- */
|
|
|
- @Transactional(
|
|
|
- rollbackFor = {Exception.class}
|
|
|
- )
|
|
|
- public ResponseResultVO<?> insert(GoodsBrandVO goodsBrandVO) {
|
|
|
- //实体转换
|
|
|
- GoodsBrand goodsBrand = goodsBrandConvert.convertToPo(goodsBrandVO);
|
|
|
- goodsBrand.setShortName(goodsBrand.getBrandName());
|
|
|
- Integer displayNo = goodsBrandMapper.selectDisplayNo(new GoodsBrandQuery());
|
|
|
- if (displayNo != null) {
|
|
|
- //插入序号
|
|
|
- goodsBrand.setDisplayNo(displayNo);
|
|
|
- } else {
|
|
|
- goodsBrand.setDisplayNo(0);
|
|
|
- }
|
|
|
- //设置编码
|
|
|
- Map<String, Object> uniqueNoteCode = commonService.getUniqueNoteCode(Constant.docNameConstant.BRAND.getName(), true);
|
|
|
- goodsBrand.setBrandId(uniqueNoteCode.get("outId").toString());
|
|
|
- goodsBrand.setBrandCode(uniqueNoteCode.get("outNote").toString());
|
|
|
- //新建
|
|
|
- goodsBrandMapper.insert(goodsBrand);
|
|
|
-
|
|
|
- //保存供应商
|
|
|
- List<String> supplierIds = goodsBrandVO.getSupplierIds();
|
|
|
- for (String supplierId : supplierIds) {
|
|
|
- goodsBrandMapper.saveSupplierBrand(supplierId,goodsBrand.getBrandId());
|
|
|
- }
|
|
|
- return ResponseResultUtil.success();
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- /**
|
|
|
- * @desc : 编辑
|
|
|
- * @author : 于继渤
|
|
|
- * @date : 2023/1/5 9:39
|
|
|
- */
|
|
|
- @Transactional(
|
|
|
- rollbackFor = {Exception.class}
|
|
|
- )
|
|
|
- public ResponseResultVO<?> updateGoodsBrand(GoodsBrandVO goodsBrandVO) {
|
|
|
- GoodsBrand goodsBrand = goodsBrandConvert.convertToPo(goodsBrandVO);
|
|
|
- super.updateByUuid(goodsBrand);
|
|
|
- return ResponseResultUtil.success();
|
|
|
- }
|
|
|
-
|
|
|
+ @Override
|
|
|
+ public BaseMapper<GoodsBrand> getRepository() {
|
|
|
+ return goodsBrandMapper;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private GoodsBrandMapper goodsBrandMapper;
|
|
|
+
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private GoodsBrandConvert goodsBrandConvert;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private CommonService commonService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @desc : 重写主键
|
|
|
+ * @author : 于继渤
|
|
|
+ * @date : 2024/2/29 20:29
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public String getPrimaryKey() {
|
|
|
+ return "brand_id";
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @desc : 查询
|
|
|
+ * @author : 于继渤
|
|
|
+ * @date : 2023/1/5 9:39
|
|
|
+ */
|
|
|
+ @Pagination
|
|
|
+ public ResponseResultVO<PageList<GoodsBrandResponse>> selectByCond(GoodsBrandQuery goodsBrandQuery) {
|
|
|
+ return super.mergeListWithCount(goodsBrandQuery, goodsBrandMapper.selectByCond(goodsBrandQuery),
|
|
|
+ goodsBrandMapper.countByCond(goodsBrandQuery));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @desc : 新建
|
|
|
+ * @author : 于继渤
|
|
|
+ * @date : 2023/1/5 9:39
|
|
|
+ */
|
|
|
+ @Transactional(
|
|
|
+ rollbackFor = {Exception.class}
|
|
|
+ )
|
|
|
+ public ResponseResultVO<?> insert(GoodsBrandVO goodsBrandVO) {
|
|
|
+ //实体转换
|
|
|
+ GoodsBrand goodsBrand = goodsBrandConvert.convertToPo(goodsBrandVO);
|
|
|
+ goodsBrand.setShortName(goodsBrand.getBrandName());
|
|
|
+ Integer displayNo = goodsBrandMapper.selectDisplayNo(new GoodsBrandQuery());
|
|
|
+ if (displayNo != null) {
|
|
|
+ //插入序号
|
|
|
+ goodsBrand.setDisplayNo(displayNo);
|
|
|
+ } else {
|
|
|
+ goodsBrand.setDisplayNo(0);
|
|
|
+ }
|
|
|
+ //设置编码
|
|
|
+ Map<String, Object> uniqueNoteCode = commonService.getUniqueNoteCode(Constant.docNameConstant.BRAND.getName(), true);
|
|
|
+ goodsBrand.setBrandId(uniqueNoteCode.get("outId").toString());
|
|
|
+ goodsBrand.setBrandCode(uniqueNoteCode.get("outNote").toString());
|
|
|
+ //新建
|
|
|
+ goodsBrandMapper.insert(goodsBrand);
|
|
|
+
|
|
|
+ //保存供应商
|
|
|
+ List<String> supplierIds = goodsBrandVO.getSupplierIds();
|
|
|
+ if (supplierIds != null) {
|
|
|
+ for (String supplierId : supplierIds) {
|
|
|
+ goodsBrandMapper.saveSupplierBrand(supplierId, goodsBrand.getBrandId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return ResponseResultUtil.success();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @desc : 编辑
|
|
|
+ * @author : 于继渤
|
|
|
+ * @date : 2023/1/5 9:39
|
|
|
+ */
|
|
|
+ @Transactional(
|
|
|
+ rollbackFor = {Exception.class}
|
|
|
+ )
|
|
|
+ public ResponseResultVO<?> updateGoodsBrand(GoodsBrandVO goodsBrandVO) {
|
|
|
+ GoodsBrand goodsBrand = goodsBrandConvert.convertToPo(goodsBrandVO);
|
|
|
+ super.updateByUuid(goodsBrand);
|
|
|
+ return ResponseResultUtil.success();
|
|
|
+ }
|
|
|
|
|
|
|
|
|
}
|