he2802 2 年之前
父節點
當前提交
4e2d493303

+ 10 - 5
zhongzheng-admin-saas/src/main/java/com/zhongzheng/controller/financial/TopCostInstTpController.java

@@ -3,10 +3,7 @@ package com.zhongzheng.controller.financial;
 import java.util.List;
 import java.util.Arrays;
 
-import com.zhongzheng.modules.top.financial.bo.TopCostInstTpAddBo;
-import com.zhongzheng.modules.top.financial.bo.TopCostInstTpEditBo;
-import com.zhongzheng.modules.top.financial.bo.TopCostInstTpQueryBo;
-import com.zhongzheng.modules.top.financial.bo.TopCostTpQueryBo;
+import com.zhongzheng.modules.top.financial.bo.*;
 import com.zhongzheng.modules.top.financial.service.ITopCostInstTpService;
 import com.zhongzheng.modules.top.financial.vo.TopCostInstTpVo;
 import lombok.RequiredArgsConstructor;
@@ -51,7 +48,7 @@ public class TopCostInstTpController extends BaseController {
     @GetMapping("/list")
     public TableDataInfo<TopCostInstTpVo> list(TopCostInstTpQueryBo bo) {
         startPage();
-        List<TopCostInstTpVo> list = iTopCostInstTpService.queryList(bo);
+        List<TopCostInstTpVo> list = iTopCostInstTpService.selectList(bo);
         return getDataTable(list);
     }
 
@@ -95,4 +92,12 @@ public class TopCostInstTpController extends BaseController {
     public AjaxResult<Void> deleteBatch(@RequestBody TopCostInstTpQueryBo bo) {
         return toAjax(iTopCostInstTpService.deleteBatch(bo) ? 1 : 0);
     }
+
+    @ApiOperation("修改供应商成本模板默认状态")
+    @PreAuthorize("@ss.hasPermi('system:tp:edit')")
+    @Log(title = "修改供应商成本模板默认状态", businessType = BusinessType.UPDATE)
+    @PostMapping("/editDefaultStatus")
+    public AjaxResult<Void> editDefaultStatus(@RequestBody TopCostInstTpEditBo bo) {
+        return toAjax(iTopCostInstTpService.updateDefaultStatus(bo) ? 1 : 0);
+    }
 }

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/financial/bo/TopCostInstTpQueryBo.java

@@ -52,4 +52,8 @@ public class TopCostInstTpQueryBo extends BaseEntity {
 
 	@ApiModelProperty("id数组")
 	private List<Long> ids;
+
+	private String instName;
+
+	private List<Integer> statusList;
 }

+ 5 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/financial/mapper/TopCostInstTpMapper.java

@@ -1,7 +1,11 @@
 package com.zhongzheng.modules.top.financial.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.zhongzheng.modules.top.financial.bo.TopCostInstTpQueryBo;
 import com.zhongzheng.modules.top.financial.domain.TopCostInstTp;
+import com.zhongzheng.modules.top.financial.vo.TopCostInstTpVo;
+
+import java.util.List;
 
 /**
  * 供应商成本模板Mapper接口
@@ -10,5 +14,6 @@ import com.zhongzheng.modules.top.financial.domain.TopCostInstTp;
  * @date 2023-07-21
  */
 public interface TopCostInstTpMapper extends BaseMapper<TopCostInstTp> {
+   List<TopCostInstTpVo> selectList(TopCostInstTpQueryBo bo);
 
 }

+ 5 - 4
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/financial/service/ITopCostInstTpService.java

@@ -2,10 +2,7 @@ package com.zhongzheng.modules.top.financial.service;
 
 
 import com.baomidou.mybatisplus.extension.service.IService;
-import com.zhongzheng.modules.top.financial.bo.TopCostInstTpAddBo;
-import com.zhongzheng.modules.top.financial.bo.TopCostInstTpEditBo;
-import com.zhongzheng.modules.top.financial.bo.TopCostInstTpQueryBo;
-import com.zhongzheng.modules.top.financial.bo.TopCostTpQueryBo;
+import com.zhongzheng.modules.top.financial.bo.*;
 import com.zhongzheng.modules.top.financial.domain.TopCostInstTp;
 import com.zhongzheng.modules.top.financial.vo.TopCostInstTpVo;
 
@@ -53,4 +50,8 @@ public interface ITopCostInstTpService extends IService<TopCostInstTp> {
 	Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
 
 	Boolean deleteBatch(TopCostInstTpQueryBo queryBo);
+
+	List<TopCostInstTpVo> selectList(TopCostInstTpQueryBo bo);
+
+	Boolean updateDefaultStatus(TopCostInstTpEditBo bo);
 }

+ 30 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/financial/service/impl/TopCostInstTpServiceImpl.java

@@ -162,4 +162,34 @@ public class TopCostInstTpServiceImpl extends ServiceImpl<TopCostInstTpMapper, T
         }
         return true;
     }
+
+    @Override
+    public List<TopCostInstTpVo> selectList(TopCostInstTpQueryBo bo) {
+        return baseMapper.selectList(bo);
+    }
+
+    @Override
+    public Boolean updateDefaultStatus(TopCostInstTpEditBo bo) {
+        TopCostInstTp update = new TopCostInstTp();
+        update.setTpId(bo.getTpId());
+        if(Validator.isNotEmpty(bo.getDefaultStatus())){
+            if(Validator.isEmpty(bo.getInstId())){
+                throw new CustomException("缺少供应商ID");
+            }
+            if(bo.getDefaultStatus()==1){
+                LambdaUpdateWrapper<TopCostInstTp> objectLambdaUpdateWrapper = Wrappers.lambdaUpdate();
+                objectLambdaUpdateWrapper.ne(TopCostInstTp::getTpId, bo.getTpId());
+                objectLambdaUpdateWrapper.eq(TopCostInstTp::getInstId, bo.getInstId());
+                objectLambdaUpdateWrapper.set(TopCostInstTp::getDefaultStatus, 0);
+                objectLambdaUpdateWrapper.set(TopCostInstTp::getUpdateTime, DateUtils.getNowTime());
+                update(null, objectLambdaUpdateWrapper);
+                update.setDefaultStatus(1);
+            }
+            if(bo.getDefaultStatus()==0){
+                update.setDefaultStatus(0);
+            }
+        }
+        update.setUpdateTime(DateUtils.getNowTime());
+        return this.updateById(update);
+    }
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/top/financial/vo/TopCostInstTpVo.java

@@ -40,4 +40,6 @@ public class TopCostInstTpVo {
 	@Excel(name = "供应商ID")
 	@ApiModelProperty("供应商ID")
 	private Long instId;
+	@ApiModelProperty("供应商名称")
+	private String instName;
 }

+ 23 - 1
zhongzheng-system/src/main/resources/mapper/modules/top/TopCostInstTpMapper.xml

@@ -14,5 +14,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="instId" column="inst_id"/>
     </resultMap>
 
-
+    <select id="selectList" parameterType="com.zhongzheng.modules.top.financial.bo.TopCostInstTpQueryBo"  resultType="com.zhongzheng.modules.top.financial.vo.TopCostInstTpVo">
+        SELECT
+        ct.*,
+        ti.inst_name
+        FROM
+        top_cost_inst_tp ct
+        LEFT JOIN top_institution ti ON ct.inst_id = ti.inst_id
+        WHERE
+        1 = 1
+        <if test="statusList != null and statusList.size()!=0 ">
+            AND ct.status in
+            <foreach collection="statusList" item="item" index="index" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="instName != null and instName != ''">
+            AND ti.inst_name  like concat('%', #{instName}, '%')
+        </if>
+        <if test="instId != null and instId != ''">
+            AND ti.inst_id  = #{instId}
+        </if>
+        ORDER BY ct.tp_id DESC
+    </select>
 </mapper>