Jelajahi Sumber

基础资料修改

于继渤 2 tahun lalu
induk
melakukan
eecb6a2ec7

+ 0 - 2
src/main/java/com/dk/mdm/controller/mst/WarehouseController.java

@@ -83,8 +83,6 @@ public class WarehouseController{
     }
     }
 
 
 
 
-
-
     /**
     /**
      * @desc : 批量编辑序号
      * @desc : 批量编辑序号
      * @author : 于继渤
      * @author : 于继渤

+ 1 - 0
src/main/java/com/dk/mdm/mapper/mst/DictionaryDataMapper.java

@@ -38,6 +38,7 @@ public interface DictionaryDataMapper extends BaseMapper<DictionaryData>{
      * @date :  2023/1/4 9:39
      * @date :  2023/1/4 9:39
      */
      */
     Integer updateBatchDictionaryDataDisplayNo(List<Map<String,Object>> dataIds);
     Integer updateBatchDictionaryDataDisplayNo(List<Map<String,Object>> dataIds);
+    Integer updateFlgDefault(DictionaryDataQuery dictionaryDataQuery);
 
 
 }
 }
 
 

+ 8 - 0
src/main/java/com/dk/mdm/mapper/mst/DictionaryDataMapper.xml

@@ -217,4 +217,12 @@
             WHERE data_id = #{item.id}::uuid
             WHERE data_id = #{item.id}::uuid
         </foreach>
         </foreach>
     </update>
     </update>
+
+
+    <update id="updateFlgDefault">
+        UPDATE dkic_b.t_mst_dictionary_data
+        SET
+            flg_default = false
+        WHERE      dict_code = #{dictCode} AND  cp_id = #{cpId} and (flg_default = true OR flg_default is null)
+    </update>
 </mapper>
 </mapper>

+ 3 - 0
src/main/java/com/dk/mdm/mapper/mst/WarehouseMapper.java

@@ -33,11 +33,14 @@ public interface WarehouseMapper extends BaseMapper<Warehouse>{
 
 
 
 
 
 
+
     /**
     /**
      * @desc : 批量编辑序号
      * @desc : 批量编辑序号
      * @author : 于继渤
      * @author : 于继渤
      * @date :  2023/1/4 9:39
      * @date :  2023/1/4 9:39
      */
      */
     Integer updateBatchWarehouseDisplayNo(List<Map<String,Object>> dataIds);
     Integer updateBatchWarehouseDisplayNo(List<Map<String,Object>> dataIds);
+    Integer updateFlgDefault(Integer id);
+
 }
 }
 
 

+ 6 - 1
src/main/java/com/dk/mdm/mapper/mst/WarehouseMapper.xml

@@ -205,5 +205,10 @@
     </update>
     </update>
 
 
 
 
-
+    <update id="updateFlgDefault">
+        UPDATE dkic_b.t_mst_warehouse
+        SET
+            flg_default = false
+        WHERE    cp_id = #{id} AND (flg_default = true OR flg_default is null)
+    </update>
 </mapper>
 </mapper>

+ 8 - 0
src/main/java/com/dk/mdm/service/mst/DictionaryDataService.java

@@ -13,6 +13,7 @@ import com.dk.mdm.model.pojo.mst.DictionaryData;
 import com.dk.mdm.mapper.mst.DictionaryDataMapper;
 import com.dk.mdm.mapper.mst.DictionaryDataMapper;
 import com.dk.common.service.BaseService;
 import com.dk.common.service.BaseService;
 import com.dk.common.mapper.BaseMapper;
 import com.dk.common.mapper.BaseMapper;
+import com.dk.mdm.model.pojo.mst.Warehouse;
 import com.dk.mdm.model.query.mst.DictionaryDataQuery;
 import com.dk.mdm.model.query.mst.DictionaryDataQuery;
 import com.dk.mdm.model.query.mst.MoneyAccountQuery;
 import com.dk.mdm.model.query.mst.MoneyAccountQuery;
 import com.dk.mdm.model.response.mst.DictionaryDataResponse;
 import com.dk.mdm.model.response.mst.DictionaryDataResponse;
@@ -115,6 +116,13 @@ public class DictionaryDataService extends BaseService<DictionaryData> {
 			//系统预制 无法编辑
 			//系统预制 无法编辑
 			return ResponseResultUtil.error(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.SYSTEM_PRESET_DATA_UNABLE_TO_OPERATE.getMessage());
 			return ResponseResultUtil.error(ResponseCodeEnum.OPERATE_FAIL.getCode(), ErrorCodeEnum.SYSTEM_PRESET_DATA_UNABLE_TO_OPERATE.getMessage());
 		}
 		}
+		DictionaryData dictionaryData1 = dictionaryDataMapper.selectById(dictionaryDataVO.getDataId());
+		if ((dictionaryData1.getFlgDefault() == null || !dictionaryData1.getFlgDefault()) && dictionaryDataVO.getFlgDefault() != null && dictionaryDataVO.getFlgDefault()) {
+			//默认  把其他置为非默认
+			dictionaryDataMapper.updateFlgDefault(new DictionaryDataQuery().setCpId(dictionaryData1.getCpId()).setDictCode(dictionaryData1.getDictCode()));
+		}
+
+
 		super.updateByUuid(dictionaryData);
 		super.updateByUuid(dictionaryData);
 
 
 		return ResponseResultUtil.success();
 		return ResponseResultUtil.success();

+ 94 - 89
src/main/java/com/dk/mdm/service/mst/WarehouseService.java

@@ -25,94 +25,99 @@ import java.util.Map;
 @Transactional
 @Transactional
 public class WarehouseService extends BaseService<Warehouse> {
 public class WarehouseService extends BaseService<Warehouse> {
 
 
-	@Override
-	public BaseMapper<Warehouse> getRepository() {
-		return warehouseMapper;
-	}
-
-	@Autowired
-	private WarehouseMapper warehouseMapper;
-
-	@Autowired
-	private CommonService commonService;
-
-	@Autowired
-	private WarehouseConvert warehouseConvert;
-
-	/**
-	 * @desc : 重写主键
-	 * @author : 于继渤
-	 * @date : 2024/2/29 20:29
-	 */
-	@Override
-	public String getPrimaryKey() {
-		return "wh_id";
-	}
-
-
-	/**
-	 * @desc : 查询
-	 * @author : 于继渤
-	 * @date : 2023/1/5 9:39
-	 */
-	@Pagination
-	public ResponseResultVO<PageList<WarehouseResponse>> selectByCond(WarehouseQuery warehouseQuery) {
-		return super.mergeListWithCount(warehouseQuery, warehouseMapper.selectByCond(warehouseQuery),
-				warehouseMapper.countByCond(warehouseQuery));
-	}
-
-
-
-	/**
-	 * @desc : 新建
-	 * @author : 于继渤
-	 * @date : 2023/1/5 9:39
-	 */
-	@Transactional(
-			rollbackFor = {Exception.class}
-	)
-	public ResponseResultVO<?> insert(WarehouseVO warehouseVO) {
-		//实体转换
-		Warehouse warehouse = warehouseConvert.convertToPo(warehouseVO);
-		//设置序号
-		warehouse.setDisplayNo(commonService.getMaxDisplayNo(Constant.DisplayNoTable.WAREHOUSE));
-		//设置编码
-		Map<String, Object> uniqueNoteCode = commonService.getUniqueNoteCode(Constant.docNameConstant.WAREHOUSE.getName(), true);
-		warehouse.setWhId(uniqueNoteCode.get("outId").toString());
-		warehouse.setWhCode(uniqueNoteCode.get("outNote").toString());
-		//新建
-		warehouseMapper.insert(warehouse);
-
-		return ResponseResultUtil.success();
-	}
-
-
-
-	/**
-	 * @desc : 编辑
-	 * @author : 于继渤
-	 * @date : 2023/1/5 9:39
-	 */
-	@Transactional(
-			rollbackFor = {Exception.class}
-	)
-	public ResponseResultVO<?> update(WarehouseVO warehouseVO) {
-		Warehouse warehouse = warehouseConvert.convertToPo(warehouseVO);
-		super.updateByUuid(warehouse);
-		return ResponseResultUtil.success();
-	}
-
-	/**
-	 * @desc : 编辑
-	 * @author : 于继渤
-	 * @date : 2023/1/5 9:39
-	 */
-	@Transactional(
-			rollbackFor = {Exception.class}
-	)
-	public ResponseResultVO<?> updateBatchWarehouseDisplayNo(WarehouseVO warehouseVO) {
-		warehouseMapper.updateBatchWarehouseDisplayNo(warehouseVO.getDataIds());
-		return ResponseResultUtil.success();
-	}
+    @Override
+    public BaseMapper<Warehouse> getRepository() {
+        return warehouseMapper;
+    }
+
+    @Autowired
+    private WarehouseMapper warehouseMapper;
+
+    @Autowired
+    private CommonService commonService;
+
+    @Autowired
+    private WarehouseConvert warehouseConvert;
+
+    /**
+     * @desc : 重写主键
+     * @author : 于继渤
+     * @date : 2024/2/29 20:29
+     */
+    @Override
+    public String getPrimaryKey() {
+        return "wh_id";
+    }
+
+
+    /**
+     * @desc : 查询
+     * @author : 于继渤
+     * @date : 2023/1/5 9:39
+     */
+    @Pagination
+    public ResponseResultVO<PageList<WarehouseResponse>> selectByCond(WarehouseQuery warehouseQuery) {
+        return super.mergeListWithCount(warehouseQuery, warehouseMapper.selectByCond(warehouseQuery),
+                warehouseMapper.countByCond(warehouseQuery));
+    }
+
+
+    /**
+     * @desc : 新建
+     * @author : 于继渤
+     * @date : 2023/1/5 9:39
+     */
+    @Transactional(
+            rollbackFor = {Exception.class}
+    )
+    public ResponseResultVO<?> insert(WarehouseVO warehouseVO) {
+        //实体转换
+        Warehouse warehouse = warehouseConvert.convertToPo(warehouseVO);
+        //设置序号
+        warehouse.setDisplayNo(commonService.getMaxDisplayNo(Constant.DisplayNoTable.WAREHOUSE));
+        //设置编码
+        Map<String, Object> uniqueNoteCode = commonService.getUniqueNoteCode(Constant.docNameConstant.WAREHOUSE.getName(), true);
+        warehouse.setWhId(uniqueNoteCode.get("outId").toString());
+        warehouse.setWhCode(uniqueNoteCode.get("outNote").toString());
+        //新建
+        warehouseMapper.insert(warehouse);
+
+        return ResponseResultUtil.success();
+    }
+
+
+    /**
+     * @desc : 编辑
+     * @author : 于继渤
+     * @date : 2023/1/5 9:39
+     */
+    @Transactional(
+            rollbackFor = {Exception.class}
+    )
+    public ResponseResultVO<?> update(WarehouseVO warehouseVO) {
+        Warehouse warehouse1 = warehouseMapper.selectById(warehouseVO.getWhId());
+        if ((warehouse1.getFlgDefault() == null || !warehouse1.getFlgDefault()) && warehouseVO.getFlgDefault() != null && warehouseVO.getFlgDefault()) {
+            //默认  把其他置为非默认
+            warehouseMapper.updateFlgDefault(warehouseVO.getCpId());
+        }
+        Warehouse warehouse = warehouseConvert.convertToPo(warehouseVO);
+        super.updateByUuid(warehouse);
+        return ResponseResultUtil.success();
+    }
+
+
+
+    /**
+     * @desc : 编辑
+     * @author : 于继渤
+     * @date : 2023/1/5 9:39
+     */
+    @Transactional(
+            rollbackFor = {Exception.class}
+    )
+    public ResponseResultVO<?> updateBatchWarehouseDisplayNo(WarehouseVO warehouseVO) {
+        warehouseMapper.updateBatchWarehouseDisplayNo(warehouseVO.getDataIds());
+        return ResponseResultUtil.success();
+    }
 
 
 }
 }