he2802 2 years ago
parent
commit
0701536dcc

+ 17 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/financial/service/impl/TopCostTpServiceImpl.java

@@ -119,7 +119,23 @@ public class TopCostTpServiceImpl extends ServiceImpl<TopCostTpMapper, TopCostTp
             itemBo.setTpId(bo.getTpId());
             iTopCostTpItemService.insertByAddBo(itemBo);
         }
-        return this.updateById(update);
+        if(this.updateById(update)){
+            if(Validator.isNotEmpty(bo.getDefaultStatus())){
+                if(bo.getDefaultStatus()==1){
+                    LambdaUpdateWrapper<TopCostTp> objectLambdaUpdateWrapper = Wrappers.lambdaUpdate();
+                    objectLambdaUpdateWrapper.eq(TopCostTp::getTpId, bo.getTpId());
+                    objectLambdaUpdateWrapper.set(TopCostTp::getDefaultStatus, 0);
+                    objectLambdaUpdateWrapper.set(TopCostTp::getUpdateTime, DateUtils.getNowTime());
+                    update(null, objectLambdaUpdateWrapper);
+                    update.setDefaultStatus(1);
+                }
+                if(bo.getDefaultStatus()==0){
+                    update.setDefaultStatus(0);
+                }
+            }
+            return true;
+        }
+        return false;
     }
 
     /**

+ 2 - 2
zhongzheng-system/src/main/resources/mapper/modules/top/TopCostTpItemMapper.xml

@@ -2,9 +2,9 @@
 <!DOCTYPE mapper
 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.zhongzheng.modules.financial.mapper.TopCostTpItemMapper">
+<mapper namespace="com.zhongzheng.modules.top.financial.mapper.TopCostTpItemMapper">
 
-    <resultMap type="com.zhongzheng.modules.financial.domain.TopCostTpItem" id="TopCostTpItemResult">
+    <resultMap type="com.zhongzheng.modules.top.financial.domain.TopCostTpItem" id="TopCostTpItemResult">
         <result property="id" column="id"/>
         <result property="tpId" column="tp_id"/>
         <result property="itemName" column="item_name"/>

+ 0 - 2
zhongzheng-system/src/main/resources/mapper/modules/top/TopCostTpMapper.xml

@@ -12,7 +12,5 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="updateTime" column="update_time"/>
     </resultMap>
 
-    <select id="queryList" parameterType="com.zhongzheng.modules.top.financial.bo.TopCostTpQueryBo"  resultMap="TopCourseBusinessVoResult">
 
-    </select>
 </mapper>