Commit 6a157836 by wangjian

2025-11-29 wj 新增 星级班组

parent 5afeef4d
package com.qianhe.controller;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import com.qianhe.common.constant.HttpStatus;
import com.qianhe.domain.SjBzxx;
import com.qianhe.domain.SjGfjsZsdwkhpj;
import com.qianhe.domain.SjGfjsZsdwwtcj;
import com.qianhe.service.ISjBzxxService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.qianhe.common.annotation.Log;
import com.qianhe.common.core.controller.BaseController;
import com.qianhe.common.core.domain.AjaxResult;
import com.qianhe.common.enums.BusinessType;
import com.qianhe.domain.SjGfjsXjbz;
import com.qianhe.service.ISjGfjsXjbzService;
import com.qianhe.common.utils.poi.ExcelUtil;
import com.qianhe.common.core.page.TableDataInfo;
/**
* 三基 规范建设 星级班组Controller
*
* @author qianhe
* @date 2025-11-28
*/
@RestController
@RequestMapping("/system/sjGfjsXjbz")
public class SjGfjsXjbzController extends BaseController
{
@Autowired
private ISjGfjsXjbzService sjGfjsXjbzService;
@Autowired
private ISjBzxxService sjBzxxService;
/**
* 查询三基 规范建设 星级班组列表
*/
@GetMapping("/list")
public TableDataInfo list(SjGfjsXjbz sjGfjsXjbz)
{
startPage();
List<SjGfjsXjbz> list = sjGfjsXjbzService.selectSjGfjsXjbzList(sjGfjsXjbz);
return getDataTable(list);
}
/**
* 查询 星级班组 单位下 指定年
*/
@GetMapping("/listAll")
public Map<String,Object> listAll(SjGfjsXjbz sjGfjsXjbz){
Map<String,Object> map=new HashMap<>();
Long deptId = sjGfjsXjbz.getDeptId();
String nd = sjGfjsXjbz.getNd();
//查询 指定单位下 指定年 已保存的 班组星级 数据
List<SjGfjsXjbz> list = sjGfjsXjbzService.selectSjGfjsXjbzList(sjGfjsXjbz);
if(list.size()<=0){//没有需要插入一个初始的
SjBzxx qry = new SjBzxx();
qry.setDeptId(deptId);
List<SjBzxx> bzsList = sjBzxxService.selectSjBzxxList(qry);
List<SjGfjsXjbz> xjbzsList = new ArrayList<>();
for (SjBzxx bz:bzsList) {
SjGfjsXjbz xj = new SjGfjsXjbz();
xj.setBzId(bz.getId());
xj.setDeptId(bz.getDeptId());
xj.setNd(nd);
xj.setBzlx(bz.getBzlx());
xj.setBzmc(bz.getBzmc());
xj.setZt("0");
xjbzsList.add(xj);
}
if (xjbzsList.size() > 0) {
sjGfjsXjbzService.batchSave(xjbzsList);
}
}
list = sjGfjsXjbzService.selectSjGfjsXjbzList(sjGfjsXjbz);
map.put("code", HttpStatus.SUCCESS);
map.put("msg","查询成功");
map.put("khpjData", list);
return map;
}
/**
* 导出三基 规范建设 星级班组列表
*/
@Log(title = "三基 规范建设 星级班组", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, SjGfjsXjbz sjGfjsXjbz)
{
List<SjGfjsXjbz> list = sjGfjsXjbzService.selectSjGfjsXjbzList(sjGfjsXjbz);
ExcelUtil<SjGfjsXjbz> util = new ExcelUtil<SjGfjsXjbz>(SjGfjsXjbz.class);
util.exportExcel(response, list, "三基 规范建设 星级班组数据");
}
/**
* 获取三基 规范建设 星级班组详细信息
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(sjGfjsXjbzService.selectSjGfjsXjbzById(id));
}
/**
* 新增三基 规范建设 星级班组
*/
@Log(title = "三基 规范建设 星级班组", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody SjGfjsXjbz sjGfjsXjbz)
{
return toAjax(sjGfjsXjbzService.insertSjGfjsXjbz(sjGfjsXjbz));
}
/**
* 修改三基 规范建设 星级班组
*/
@Log(title = "三基 规范建设 星级班组", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody SjGfjsXjbz sjGfjsXjbz)
{
return toAjax(sjGfjsXjbzService.updateSjGfjsXjbz(sjGfjsXjbz));
}
/**
* 删除三基 规范建设 星级班组
*/
@Log(title = "三基 规范建设 星级班组", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(sjGfjsXjbzService.deleteSjGfjsXjbzByIds(ids));
}
@PutMapping("/pledit")
public AjaxResult pledit(@RequestBody List<SjGfjsXjbz> list)
{
return toAjax(sjGfjsXjbzService.pledit(list));
}
//批量提交 ids
@PostMapping("/pltj")
public AjaxResult pltj(@RequestBody SjGfjsXjbz fjx)
{
fjx.setZt("1");
return toAjax(sjGfjsXjbzService.plxg(fjx));
}
}
package com.qianhe.domain;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.qianhe.common.annotation.Excel;
import com.qianhe.common.core.domain.BaseEntity;
/**
* 三基 规范建设 星级班组对象 sj_gfjs_xjbz
*
* @author qianhe
* @date 2025-11-28
*/
@Data
public class SjGfjsXjbz extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
private Long id;
/** 班组id */
@Excel(name = "班组id")
private Long bzId;
/** 单位id */
@Excel(name = "单位id")
private Long deptId;
/** 上级单位id */
@Excel(name = "上级单位id")
private Long parentDeptId;
/** 年度 */
@Excel(name = "年度")
private String nd;
/** 班组类型 */
@Excel(name = "班组类型")
private String bzlx;
/** 班组名称 */
@Excel(name = "班组名称")
private String bzmc;
/** 星级 */
@Excel(name = "星级")
private String xj;
/** 星级描述 */
@Excel(name = "星级描述")
private String xjms;
/** 排名 可自调整 */
@Excel(name = "排名 可自调整")
private Long pm;
/** 状态 0 未提交 1 已提交 */
@Excel(name = "状态 0 未提交 1 已提交")
private String zt;
/** 分档级别 */
@Excel(name = "分档级别")
private String fdjb;
private String ids;
}
package com.qianhe.mapper;
import java.util.List;
import com.qianhe.domain.SjGfjsXjbz;
import com.qianhe.domain.SjGfjsZsdwkhpj;
import com.qianhe.domain.SjGfjsZsdwwtcj;
/**
* 三基 规范建设 星级班组Mapper接口
*
* @author qianhe
* @date 2025-11-28
*/
public interface SjGfjsXjbzMapper
{
/**
* 查询三基 规范建设 星级班组
*
* @param id 三基 规范建设 星级班组主键
* @return 三基 规范建设 星级班组
*/
public SjGfjsXjbz selectSjGfjsXjbzById(Long id);
/**
* 查询三基 规范建设 星级班组列表
*
* @param sjGfjsXjbz 三基 规范建设 星级班组
* @return 三基 规范建设 星级班组集合
*/
public List<SjGfjsXjbz> selectSjGfjsXjbzList(SjGfjsXjbz sjGfjsXjbz);
/**
* 新增三基 规范建设 星级班组
*
* @param sjGfjsXjbz 三基 规范建设 星级班组
* @return 结果
*/
public int insertSjGfjsXjbz(SjGfjsXjbz sjGfjsXjbz);
/**
* 修改三基 规范建设 星级班组
*
* @param sjGfjsXjbz 三基 规范建设 星级班组
* @return 结果
*/
public int updateSjGfjsXjbz(SjGfjsXjbz sjGfjsXjbz);
/**
* 删除三基 规范建设 星级班组
*
* @param id 三基 规范建设 星级班组主键
* @return 结果
*/
public int deleteSjGfjsXjbzById(Long id);
/**
* 批量删除三基 规范建设 星级班组
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteSjGfjsXjbzByIds(Long[] ids);
int batchSave(List<SjGfjsXjbz> addList);
int pledit(List<SjGfjsXjbz> list);
public int plxg(SjGfjsXjbz s);
}
package com.qianhe.service;
import java.util.List;
import com.qianhe.domain.SjGfjsXjbz;
import com.qianhe.domain.SjGfjsZsdwkhpj;
import com.qianhe.domain.SjGfjsZsdwwtcj;
/**
* 三基 规范建设 星级班组Service接口
*
* @author qianhe
* @date 2025-11-28
*/
public interface ISjGfjsXjbzService
{
/**
* 查询三基 规范建设 星级班组
*
* @param id 三基 规范建设 星级班组主键
* @return 三基 规范建设 星级班组
*/
public SjGfjsXjbz selectSjGfjsXjbzById(Long id);
/**
* 查询三基 规范建设 星级班组列表
*
* @param sjGfjsXjbz 三基 规范建设 星级班组
* @return 三基 规范建设 星级班组集合
*/
public List<SjGfjsXjbz> selectSjGfjsXjbzList(SjGfjsXjbz sjGfjsXjbz);
/**
* 新增三基 规范建设 星级班组
*
* @param sjGfjsXjbz 三基 规范建设 星级班组
* @return 结果
*/
public int insertSjGfjsXjbz(SjGfjsXjbz sjGfjsXjbz);
/**
* 修改三基 规范建设 星级班组
*
* @param sjGfjsXjbz 三基 规范建设 星级班组
* @return 结果
*/
public int updateSjGfjsXjbz(SjGfjsXjbz sjGfjsXjbz);
/**
* 批量删除三基 规范建设 星级班组
*
* @param ids 需要删除的三基 规范建设 星级班组主键集合
* @return 结果
*/
public int deleteSjGfjsXjbzByIds(Long[] ids);
/**
* 删除三基 规范建设 星级班组信息
*
* @param id 三基 规范建设 星级班组主键
* @return 结果
*/
public int deleteSjGfjsXjbzById(Long id);
int batchSave(List<SjGfjsXjbz> addList);
int pledit(List<SjGfjsXjbz> list);
public int plxg(SjGfjsXjbz s);
}
package com.qianhe.service.impl;
import java.util.List;
import com.qianhe.common.utils.DateUtils;
import com.qianhe.common.utils.SecurityUtils;
import com.qianhe.domain.SjGfjsZsdwkhpj;
import com.qianhe.domain.SjGfjsZsdwwtcj;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.qianhe.mapper.SjGfjsXjbzMapper;
import com.qianhe.domain.SjGfjsXjbz;
import com.qianhe.service.ISjGfjsXjbzService;
/**
* 三基 规范建设 星级班组Service业务层处理
*
* @author qianhe
* @date 2025-11-28
*/
@Service
public class SjGfjsXjbzServiceImpl implements ISjGfjsXjbzService
{
@Autowired
private SjGfjsXjbzMapper sjGfjsXjbzMapper;
/**
* 查询三基 规范建设 星级班组
*
* @param id 三基 规范建设 星级班组主键
* @return 三基 规范建设 星级班组
*/
@Override
public SjGfjsXjbz selectSjGfjsXjbzById(Long id)
{
return sjGfjsXjbzMapper.selectSjGfjsXjbzById(id);
}
/**
* 查询三基 规范建设 星级班组列表
*
* @param sjGfjsXjbz 三基 规范建设 星级班组
* @return 三基 规范建设 星级班组
*/
@Override
public List<SjGfjsXjbz> selectSjGfjsXjbzList(SjGfjsXjbz sjGfjsXjbz)
{
return sjGfjsXjbzMapper.selectSjGfjsXjbzList(sjGfjsXjbz);
}
/**
* 新增三基 规范建设 星级班组
*
* @param sjGfjsXjbz 三基 规范建设 星级班组
* @return 结果
*/
@Override
public int insertSjGfjsXjbz(SjGfjsXjbz sjGfjsXjbz)
{
return sjGfjsXjbzMapper.insertSjGfjsXjbz(sjGfjsXjbz);
}
/**
* 修改三基 规范建设 星级班组
*
* @param sjGfjsXjbz 三基 规范建设 星级班组
* @return 结果
*/
@Override
public int updateSjGfjsXjbz(SjGfjsXjbz sjGfjsXjbz)
{
return sjGfjsXjbzMapper.updateSjGfjsXjbz(sjGfjsXjbz);
}
/**
* 批量删除三基 规范建设 星级班组
*
* @param ids 需要删除的三基 规范建设 星级班组主键
* @return 结果
*/
@Override
public int deleteSjGfjsXjbzByIds(Long[] ids)
{
return sjGfjsXjbzMapper.deleteSjGfjsXjbzByIds(ids);
}
/**
* 删除三基 规范建设 星级班组信息
*
* @param id 三基 规范建设 星级班组主键
* @return 结果
*/
@Override
public int deleteSjGfjsXjbzById(Long id)
{
return sjGfjsXjbzMapper.deleteSjGfjsXjbzById(id);
}
@Override
public int pledit(List<SjGfjsXjbz> list) {
int mxint = sjGfjsXjbzMapper.pledit(list);
return mxint;
}
@Override
public int batchSave(List<SjGfjsXjbz> addList) {
return sjGfjsXjbzMapper.batchSave(addList);
}
@Override
public int plxg(SjGfjsXjbz s)
{
return sjGfjsXjbzMapper.plxg(s);
}
}
<?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.qianhe.mapper.SjGfjsXjbzMapper">
<resultMap type="SjGfjsXjbz" id="SjGfjsXjbzResult">
<result property="id" column="id" />
<result property="bzId" column="bz_id" />
<result property="deptId" column="dept_id" />
<result property="parentDeptId" column="parent_dept_id" />
<result property="nd" column="nd" />
<result property="bzlx" column="bzlx" />
<result property="bzmc" column="bzmc" />
<result property="xj" column="xj" />
<result property="xjms" column="xjms" />
<result property="pm" column="pm" />
<result property="zt" column="zt" />
<result property="fdjb" column="fdjb" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectSjGfjsXjbzVo">
select id, bz_id, dept_id, parent_dept_id, nd, bzlx, bzmc, xj, xjms, pm, zt, fdjb ,
a.create_by,
a.create_time,
a.update_by,
a.update_time,
a.remark,
from sj_gfjs_xjbz a
</sql>
<select id="selectSjGfjsXjbzList" parameterType="SjGfjsXjbz" resultMap="SjGfjsXjbzResult">
<include refid="selectSjGfjsXjbzVo"/>
<where>
<if test="bzId != null "> and bz_id = #{bzId}</if>
<if test="deptId != null "> and dept_id = #{deptId}</if>
<if test="parentDeptId != null "> and parent_dept_id = #{parentDeptId}</if>
<if test="nd != null and nd != ''"> and nd = #{nd}</if>
<if test="bzlx != null and bzlx != ''"> and bzlx = #{bzlx}</if>
<if test="bzmc != null and bzmc != ''"> and bzmc = #{bzmc}</if>
<if test="xj != null and xj != ''"> and xj = #{xj}</if>
<if test="xjms != null and xjms != ''"> and xjms = #{xjms}</if>
<if test="pm != null "> and pm = #{pm}</if>
<if test="zt != null and zt != ''"> and zt = #{zt}</if>
<if test="fdjb != null and fdjb != ''"> and fdjb = #{fdjb}</if>
</where>
</select>
<select id="selectSjGfjsXjbzById" parameterType="Long" resultMap="SjGfjsXjbzResult">
<include refid="selectSjGfjsXjbzVo"/>
where id = #{id}
</select>
<insert id="insertSjGfjsXjbz" parameterType="SjGfjsXjbz" useGeneratedKeys="true" keyProperty="id">
insert into sj_gfjs_xjbz
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="bzId != null">bz_id,</if>
<if test="deptId != null">dept_id,</if>
<if test="parentDeptId != null">parent_dept_id,</if>
<if test="nd != null">nd,</if>
<if test="bzlx != null">bzlx,</if>
<if test="bzmc != null">bzmc,</if>
<if test="xj != null">xj,</if>
<if test="xjms != null">xjms,</if>
<if test="pm != null">pm,</if>
<if test="zt != null">zt,</if>
<if test="fdjb != null">fdjb,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="bzId != null">#{bzId},</if>
<if test="deptId != null">#{deptId},</if>
<if test="parentDeptId != null">#{parentDeptId},</if>
<if test="nd != null">#{nd},</if>
<if test="bzlx != null">#{bzlx},</if>
<if test="bzmc != null">#{bzmc},</if>
<if test="xj != null">#{xj},</if>
<if test="xjms != null">#{xjms},</if>
<if test="pm != null">#{pm},</if>
<if test="zt != null">#{zt},</if>
<if test="fdjb != null">#{fdjb},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateSjGfjsXjbz" parameterType="SjGfjsXjbz">
update sj_gfjs_xjbz
<trim prefix="SET" suffixOverrides=",">
<if test="bzId != null">bz_id = #{bzId},</if>
<if test="deptId != null">dept_id = #{deptId},</if>
<if test="parentDeptId != null">parent_dept_id = #{parentDeptId},</if>
<if test="nd != null">nd = #{nd},</if>
<if test="bzlx != null">bzlx = #{bzlx},</if>
<if test="bzmc != null">bzmc = #{bzmc},</if>
<if test="xj != null">xj = #{xj},</if>
<if test="xjms != null">xjms = #{xjms},</if>
<if test="pm != null">pm = #{pm},</if>
<if test="zt != null">zt = #{zt},</if>
<if test="fdjb != null">fdjb = #{fdjb},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteSjGfjsXjbzById" parameterType="Long">
delete from sj_gfjs_xjbz where id = #{id}
</delete>
<delete id="deleteSjGfjsXjbzByIds" parameterType="String">
delete from sj_gfjs_xjbz where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<insert id="batchSave">
insert into sj_gfjs_xjbz(id, bz_id, dept_id, parent_dept_id, nd, bzlx, bzmc, xj, xjms, pm, zt, fdjb) values
<foreach item="item" index="index" collection="list" separator=",">
( #{item.id},
#{item.bzId},
#{item.deptId},
#{item.parentDeptId},
#{item.nd},
#{item.bzlx},
#{item.bzmc},
#{item.xj},
#{item.xjms},
#{item.pm},
#{item.zt},
#{item.fdjb})
</foreach>
</insert>
<update id="pledit">
<foreach collection="list" item="item" index="index" open="" close="" separator=";">
update sj_gfjs_xjbz
<trim prefix="SET" suffixOverrides=",">
<if test="item.xj != null">xj = #{item.xj},</if>
<if test="item.xjms != null">xjms = #{item.xjms},</if>
<if test="item.pm != null">pm = #{item.pm},</if>
<if test="item.zt != null">zt = #{item.zt},</if>
<if test="item.fdjb != null">fdjb = #{item.fdjb},</if>
</trim>
where id = #{item.id}
</foreach>
</update>
<!--批量修改 根据ids-->
<update id="plxg" parameterType="SjGfjsXjbz">
update sj_gfjs_xjbz
<trim prefix="SET" suffixOverrides=",">
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="zt != null">zt = #{zt},</if>
</trim>
where FIND_IN_SET(id, #{ids})
</update>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment