Browse Source

ljx:修改价格指数新增接口没id

ljx 1 month ago
parent
commit
0a35c4ba5a

+ 6 - 0
enteprise-admin/src/main/java/com/enteprise/priceindex/service/impl/PriceIndexServiceImpl.java

@@ -54,6 +54,12 @@ public class PriceIndexServiceImpl implements IPriceIndexService
     @Override
     public int insertPriceIndex(PriceIndex priceIndex)
     {
+        String name = priceIndex.getName();
+        if (priceIndex.getCode() == null || name == null) {
+            throw new RuntimeException("代码或名称为空!");
+        }
+        Long id =Long.valueOf( name.replace("企业", "") + priceIndex.getMonth() +priceIndex.getYear());
+        priceIndex.setId(id);
         return priceIndexMapper.insertPriceIndex(priceIndex);
     }