|
|
@@ -1,13 +1,25 @@
|
|
|
package com.dk.mdm.service.mst;
|
|
|
|
|
|
+import com.dk.common.infrastructure.annotaiton.Pagination;
|
|
|
+import com.dk.common.infrastructure.constant.Constant;
|
|
|
+import com.dk.common.model.pojo.PageList;
|
|
|
+import com.dk.common.response.ResponseResultUtil;
|
|
|
+import com.dk.common.response.ResponseResultVO;
|
|
|
+import com.dk.mdm.infrastructure.convert.mst.SaleChannelConvert;
|
|
|
import com.dk.mdm.model.pojo.mst.SaleChannel;
|
|
|
import com.dk.mdm.mapper.mst.SaleChannelMapper;
|
|
|
import com.dk.common.service.BaseService;
|
|
|
import com.dk.common.mapper.BaseMapper;
|
|
|
+import com.dk.mdm.model.query.mst.SaleChannelQuery;
|
|
|
+import com.dk.mdm.model.response.mst.WarehouseResponse;
|
|
|
+import com.dk.mdm.model.vo.mst.SaleChannelVO;
|
|
|
+import com.dk.mdm.service.common.CommonService;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
@Service
|
|
|
@Transactional
|
|
|
public class SaleChannelService extends BaseService<SaleChannel> {
|
|
|
@@ -20,4 +32,80 @@ public class SaleChannelService extends BaseService<SaleChannel> {
|
|
|
@Autowired
|
|
|
private SaleChannelMapper saleChannelMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private CommonService commonService;
|
|
|
+
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private SaleChannelConvert saleChannelConvert;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @desc : 重写主键
|
|
|
+ * @author : 于继渤
|
|
|
+ * @date : 2024/2/29 20:29
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public String getPrimaryKey() {
|
|
|
+ return "channel_id";
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @desc : 查询
|
|
|
+ * @author : 于继渤
|
|
|
+ * @date : 2023/1/5 9:39
|
|
|
+ */
|
|
|
+ @Pagination
|
|
|
+ public ResponseResultVO<PageList<WarehouseResponse>> selectByCond(SaleChannelQuery saleChannelQuery) {
|
|
|
+ return super.mergeListWithCount(saleChannelQuery, saleChannelMapper.selectByCond(saleChannelQuery),
|
|
|
+ saleChannelMapper.countByCond(saleChannelQuery));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @desc : 新建
|
|
|
+ * @author : 于继渤
|
|
|
+ * @date : 2023/1/5 9:39
|
|
|
+ */
|
|
|
+ @Transactional(
|
|
|
+ rollbackFor = {Exception.class}
|
|
|
+ )
|
|
|
+ public ResponseResultVO<?> insert(SaleChannelVO saleChannelVO) {
|
|
|
+ //实体转换
|
|
|
+ SaleChannel saleChannel = saleChannelConvert.convertToPo(saleChannelVO);
|
|
|
+
|
|
|
+ Integer displayNo = saleChannelMapper.selectDisplayNo(new SaleChannelQuery());
|
|
|
+ if (displayNo != null) {
|
|
|
+ //插入序号
|
|
|
+ saleChannel.setDisplayNo(displayNo);
|
|
|
+ } else {
|
|
|
+ saleChannel.setDisplayNo(0);
|
|
|
+ }
|
|
|
+ //设置编码
|
|
|
+ Map<String, Object> uniqueNoteCode = commonService.getUniqueNoteCode(Constant.docNameConstant.SALECHANNEL.getName(), true);
|
|
|
+ saleChannel.setChannelId(uniqueNoteCode.get("outId").toString());
|
|
|
+ saleChannel.setChannelCode(uniqueNoteCode.get("outNote").toString());
|
|
|
+ //新建
|
|
|
+ saleChannelMapper.insert(saleChannel);
|
|
|
+
|
|
|
+ return ResponseResultUtil.success();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @desc : 编辑
|
|
|
+ * @author : 于继渤
|
|
|
+ * @date : 2023/1/5 9:39
|
|
|
+ */
|
|
|
+ @Transactional(
|
|
|
+ rollbackFor = {Exception.class}
|
|
|
+ )
|
|
|
+ public ResponseResultVO<?> update(SaleChannelVO saleChannelVO) {
|
|
|
+ SaleChannel saleChannel = saleChannelConvert.convertToPo(saleChannelVO);
|
|
|
+ super.updateByUuid(saleChannel);
|
|
|
+ return ResponseResultUtil.success();
|
|
|
+ }
|
|
|
+
|
|
|
}
|