Browse Source

党建乘数配置增删改查

‘xugp 1 năm trước cách đây
mục cha
commit
b73c620621

+ 87 - 2
ims-service/ims-eval/src/main/java/com/ims/eval/controller/PartyBuildingMultiplierController.java

@@ -1,9 +1,24 @@
 package com.ims.eval.controller;
 
 
-import org.springframework.web.bind.annotation.RequestMapping;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.ims.eval.cache.CacheContext;
+import com.ims.eval.config.CustomException;
+import com.ims.eval.entity.BinStage;
+import com.ims.eval.entity.Indicator;
+import com.ims.eval.entity.PartyBuildingMultiplier;
+import com.ims.eval.entity.dto.result.R;
+import com.ims.eval.service.IBinStageService;
+import com.ims.eval.service.IPartyBuildingMultiplierService;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
 
-import org.springframework.web.bind.annotation.RestController;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
 
 /**
  * <p>
@@ -13,8 +28,78 @@ import org.springframework.web.bind.annotation.RestController;
  * @author wang
  * @since 2023-03-29
  */
+@Slf4j
 @RestController
 @RequestMapping("//party-building-multiplier")
 public class PartyBuildingMultiplierController {
 
+	@Autowired
+	private IPartyBuildingMultiplierService iPartyBuildingMultiplierService;
+
+
+
+	/**
+	 * 查询
+	 *
+	 * @param id         主键ID
+	 * @param departId     部门id
+	 * @param sectionId   板块id
+	 * @param year       年度
+	 * @return
+	 */
+	@GetMapping(value = "/list")
+	public R list(@RequestParam(value = "pageNum", required = false) Integer pageNum,
+				  @RequestParam(value = "pageSize", required = false) Integer pageSize,
+		          @RequestParam(value = "id", required = false) String id,
+				  @RequestParam(value = "departId", required = false) String departId,
+				  @RequestParam(value = "sectionId", required = false) String sectionId,
+				  @RequestParam(value = "year", required = false) String year) {
+
+		IPage<PartyBuildingMultiplier> list = iPartyBuildingMultiplierService.listAll(pageNum,pageSize,id, departId, sectionId, year);
+		return R.ok().data(list);
+
+	}
+
+
+	/**
+	 * 添加
+	 *
+	 * @param partyBuildingMultiplier
+	 * @return
+	 */
+	@PostMapping(value = "/save")
+	@ApiOperation(value = "新增(修改)", notes = "新增(修改)")
+	public R addAll(@RequestBody PartyBuildingMultiplier partyBuildingMultiplier) {
+
+		try {
+			boolean b = iPartyBuildingMultiplierService.saveOrUpdate(partyBuildingMultiplier);
+			if (b) {
+				return R.ok().data(b);
+			} else {
+				return R.error().data("保存失败!");
+			}
+		} catch (CustomException e){
+			return R.customError(e.getMessage()).data("失败!");
+		}
+	}
+
+
+	/**
+	 * 批量删除
+	 *
+	 * @param ids
+	 * @return
+	 */
+	@PostMapping(value = "/remove/{ids}")
+	@ApiOperation(value = "删除", notes = "删除")
+	public R deleteAll(@PathVariable("ids") String ids) {
+		String[] strings = ids.split(",");
+		boolean b = iPartyBuildingMultiplierService.removeByIds(Arrays.asList(strings));
+		if (b) {
+			return R.ok().data(b);
+		} else {
+			return R.error().data("删除失败!");
+		}
+	}
+
 }

+ 9 - 0
ims-service/ims-eval/src/main/java/com/ims/eval/dao/PartyBuildingMultiplierMapper.java

@@ -1,7 +1,11 @@
 package com.ims.eval.dao;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ims.eval.entity.PartyBuildingMultiplier;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
 
 /**
  * <p>
@@ -13,4 +17,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface PartyBuildingMultiplierMapper extends BaseMapper<PartyBuildingMultiplier> {
 
+	IPage<PartyBuildingMultiplier> selectAll(Page page,
+											 @Param("id") String id,
+											 @Param("departId") String departId,
+											 @Param("sectionId") String sectionId,
+											 @Param("year") String year);
 }

+ 14 - 2
ims-service/ims-eval/src/main/java/com/ims/eval/entity/PartyBuildingMultiplier.java

@@ -6,10 +6,10 @@ import lombok.EqualsAndHashCode;
 
 /**
  * <p>
- * 
+ * 党建乘数配置
  * </p>
  *
- * @author wang
+ * @author xugp
  * @since 2023-03-29
  */
 @Data
@@ -28,11 +28,23 @@ public class PartyBuildingMultiplier extends Model {
      */
     private String departId;
 
+
+	/**
+	 * 单位名称
+	 */
+    private String organization_Name;
+
+
     /**
      * 板块id
      */
     private String sectionId;
 
+	/**
+	 * 板块名称
+	 */
+	private String sectionName;
+
     /**
      * 党建乘数
      */

+ 3 - 1
ims-service/ims-eval/src/main/java/com/ims/eval/service/IPartyBuildingMultiplierService.java

@@ -1,11 +1,12 @@
 package com.ims.eval.service;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.ims.eval.entity.PartyBuildingMultiplier;
 import com.baomidou.mybatisplus.extension.service.IService;
 
 /**
  * <p>
- *  服务类
+ * 党建乘数配置 服务类
  * </p>
  *
  * @author wang
@@ -13,4 +14,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface IPartyBuildingMultiplierService extends IService<PartyBuildingMultiplier> {
 
+    IPage<PartyBuildingMultiplier> listAll(Integer pageNum,Integer pageSize,String id, String departId, String sectionId, String year);
 }

+ 24 - 0
ims-service/ims-eval/src/main/java/com/ims/eval/service/impl/PartyBuildingMultiplierServiceImpl.java

@@ -1,9 +1,15 @@
 package com.ims.eval.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ims.common.utils.StringUtils;
+import com.ims.eval.config.CustomException;
 import com.ims.eval.entity.PartyBuildingMultiplier;
 import com.ims.eval.dao.PartyBuildingMultiplierMapper;
 import com.ims.eval.service.IPartyBuildingMultiplierService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 /**
@@ -17,4 +23,22 @@ import org.springframework.stereotype.Service;
 @Service
 public class PartyBuildingMultiplierServiceImpl extends ServiceImpl<PartyBuildingMultiplierMapper, PartyBuildingMultiplier> implements IPartyBuildingMultiplierService {
 
+	@Autowired
+	private PartyBuildingMultiplierMapper partyBuildingMultiplierMapper;
+
+	@Override
+	public IPage<PartyBuildingMultiplier> listAll(Integer pageNum,Integer pageSize,String id, String departId, String sectionId, String year) {
+
+
+		if (null == pageNum || null == pageSize) {
+			throw new CustomException("分页参数为空");
+		}
+
+		Page<PartyBuildingMultiplier> page = new Page<>(pageNum, pageSize);
+
+		IPage<PartyBuildingMultiplier> list = partyBuildingMultiplierMapper.selectAll(page,id,departId,sectionId,year);
+
+		return list;
+
+	}
 }

+ 29 - 0
ims-service/ims-eval/src/main/resources/mappers/PartyBuildingMultiplierMapper.xml

@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ims.eval.dao.PartyBuildingMultiplierMapper">
+
+    <select id="selectAll" resultType="com.ims.eval.entity.PartyBuildingMultiplier">
+        SELECT
+            a.id,a.depart_id,a.section_id,b.section_name,a.multiplier,
+               a.remarks,a.year
+        FROM
+        party_building_multiplier a
+        left join bin_section b on a.section_id = b.id
+        <where>
+            1=1
+            <if test="id !=null and id !=''">
+                and a.id=#{id}
+            </if>
+            <if test="departId !=null and departId !=''">
+                and a.depart_id=#{departId}
+            </if>
+            <if test="sectionId !=null and sectionId !=''">
+                and a.section_id=#{sectionId}
+            </if>
+            <if test="year !=null and year !=''">
+                and a.year=#{year}
+            </if>
+        </where>
+    </select>
+
+</mapper>