Commit 954c2d29 by wangjian

2025-08-05 规范建设 V5

parent fb163b72
package com.qianhe.controller;
import com.qianhe.common.annotation.Log;
import com.qianhe.common.core.controller.BaseController;
import com.qianhe.common.core.domain.AjaxResult;
import com.qianhe.common.core.domain.entity.SysDept;
import com.qianhe.common.core.page.TableDataInfo;
import com.qianhe.common.enums.BusinessType;
import com.qianhe.common.exception.BusinessException;
import com.qianhe.common.utils.DateUtils;
import com.qianhe.common.utils.SecurityUtils;
import com.qianhe.common.utils.StringUtils;
import com.qianhe.domain.SjGfjsZdgzCb;
import com.qianhe.domain.SjGfjsZsdwwtcj;
import com.qianhe.mapper.SjGfjsZdgzMapper;
import com.qianhe.service.ISjGfjsBfzwhService;
import com.qianhe.service.ISjGfjsBfzjcService;
import com.qianhe.system.mapper.SysDeptMapper;
import org.apache.poi.ss.usermodel.DataFormatter;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* 规范建设-帮扶组检查Controller
*
* @author qianhe
* @date 2024-07-23
*/
@RestController
@RequestMapping("/system/sjGfjsBfzjc")
public class SjGfjsBfzjcController extends BaseController
{
@Autowired
private ISjGfjsBfzjcService sjGfjsJcdwwtcjService;
@Autowired
private SysDeptMapper sysDeptMapper;
@Autowired
private SjGfjsZdgzMapper sjGfjsZdgzMapper;
@Autowired
private ISjGfjsBfzwhService sjGfjsBfzwhService;
/**
* 查询规范建设-帮扶组检查列表
*/
@GetMapping("/list")
public TableDataInfo list(SjGfjsZsdwwtcj sjGfjsZsdwwtcj)
{
sjGfjsZsdwwtcj.setJcjb("帮扶组检查");
List<SjGfjsZsdwwtcj> list = sjGfjsJcdwwtcjService.selectSjGfjsZsdwwtcjList(sjGfjsZsdwwtcj);
return getDataTable(list);
}
/**
* 导出规范建设-帮扶组检查列表
*/
@Log(title = "规范建设-帮扶组检查", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, SjGfjsZsdwwtcj sjGfjsZsdwwtcj)
{
Workbook exl = null;
OutputStream out = null;
InputStream in = null;
try {
in =this.getClass().getResourceAsStream("/static/gfjs_bfz_wtjc.xlsx");
exl = WorkbookFactory.create(in);
out = response.getOutputStream();
response.reset();
String filename = URLEncoder.encode("帮扶组检查模板.xlsx", "UTF-8");
response.setCharacterEncoding("UTF-8");
response.setHeader("Content-Disposition", "attachment;filename=" + filename);
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
exl.write(out);
exl.close();
}catch(Exception e){
e.getMessage();
throw new BusinessException("导出Excel失败,请联系网站管理员!");
}finally{
if (exl != null) {
try {
exl.close();
} catch (IOException e1) {
e1.printStackTrace();
}
}
if (out != null) {
try {
out.close();
} catch (IOException e1) {
e1.printStackTrace();
}
}
}
}
/**
* 获取规范建设-帮扶组检查详细信息
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(sjGfjsJcdwwtcjService.selectSjGfjsZsdwwtcjById(id));
}
/**
* 新增规范建设-帮扶组检查
*/
@Log(title = "规范建设-帮扶组检查", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody SjGfjsZsdwwtcj sjGfjsZsdwwtcj)
{
sjGfjsZsdwwtcj.setJcjb("帮扶组检查");
return toAjax(sjGfjsJcdwwtcjService.insertSjGfjsZsdwwtcj(sjGfjsZsdwwtcj));
}
/**
* 修改规范建设-帮扶组检查
*/
@Log(title = "规范建设-帮扶组检查", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody SjGfjsZsdwwtcj sjGfjsZsdwwtcj)
{
sjGfjsZsdwwtcj.setJcjb("帮扶组检查");
return toAjax(sjGfjsJcdwwtcjService.updateSjGfjsZsdwwtcj(sjGfjsZsdwwtcj));
}
/**
* 删除规范建设-帮扶组检查
*/
@Log(title = "规范建设-帮扶组检查", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(sjGfjsJcdwwtcjService.deleteSjGfjsZsdwwtcjByIds(ids));
}
@PostMapping("/importData")
public AjaxResult importData(MultipartFile file, boolean updateSupport, SjGfjsZsdwwtcj sjGfjsZsdwwtcj) throws Exception{
XSSFWorkbook workbook = null;
List<SysDept> deptList = sysDeptMapper.selectDeptList(new SysDept());
try {
//装载流
workbook = new XSSFWorkbook(file.getInputStream());
// 获取一个工作表,下标从0开始
XSSFSheet sheet = workbook.getSheetAt(0);
int lastRowNum = sheet.getLastRowNum();
List<SjGfjsZsdwwtcj> list=new ArrayList<>();
// 通过循环,逐行取出表中每行数据
for(int i=0;i<=lastRowNum;i++) {//跳过第一行和第二行
if(i==0 || i==1){
continue;
}
// 获取行
XSSFRow row = sheet.getRow(i);
SjGfjsZsdwwtcj zsdwwtcj=new SjGfjsZsdwwtcj();
System.out.println(row);
//日期
String rq=new DataFormatter().formatCellValue(row.getCell(1));
if(StringUtils.isEmpty(rq)){
return AjaxResult.error("导入失败,第"+(i+1)+"行日期不能为空");
}
Date date = DateUtils.parseDate(rq);
if(date==null){
return AjaxResult.error("导入失败,第"+(i+1)+"行日期格式错误");
}
zsdwwtcj.setRq(DateUtils.parseDateToStr("yyyy-MM",date));
//单位
String dw=new DataFormatter().formatCellValue(row.getCell(2)) ;
if(StringUtils.isEmpty(dw)){
return AjaxResult.error("导入失败,第"+(i+1)+"行单位不能为空");
}
//查询单位id
String[] split = dw.split("/");
if(split.length<2){
return AjaxResult.error("导入失败,第"+(i+1)+"行输入的单位格式有误!");
}
String ejdw=split[0];
SysDept ejdept = deptList.stream().filter(dept -> dept.getDeptName().equals(ejdw)).findFirst().orElse(null);
if(ejdept==null){
return AjaxResult.error("导入失败,第"+(i+1)+"行未匹配到二级单位");
}
String sjdw=split[1];
SysDept sjdept = deptList.stream().filter(dept -> dept.getDeptName().equals(sjdw) && dept.getParentId().equals(ejdept.getDeptId())).findFirst().orElse(null);
if(sjdept==null){
return AjaxResult.error("导入失败,第"+(i+1)+"行未匹配到三级单位");
}
zsdwwtcj.setDeptId(sjdept.getDeptId());
//问题描述
String wtms=new DataFormatter().formatCellValue(row.getCell(3)) ;
if(StringUtils.isEmpty(wtms)){
return AjaxResult.error("导入失败,第"+(i+1)+"行问题描述不能为空");
}
zsdwwtcj.setWtmc(wtms);
//考核内容
String khnr=new DataFormatter().formatCellValue(row.getCell(4)) ;
if(StringUtils.isEmpty(khnr)){
return AjaxResult.error("导入失败,第"+(i+1)+"行实施路径不能为空");
}
zsdwwtcj.setKhnr(khnr);
//考核项点
String khxd=new DataFormatter().formatCellValue(row.getCell(5)) ;
if(StringUtils.isEmpty(khxd)){
return AjaxResult.error("导入失败,第"+(i+1)+"行重点工作不能为空");
}
zsdwwtcj.setKhxd(khxd);
String pjbz=new DataFormatter().formatCellValue(row.getCell(6)) ;
if(StringUtils.isEmpty(pjbz)){
return AjaxResult.error("导入失败,第"+(i+1)+"行主要工作内容不能为空");
}
//匹配评价标准
String substring = pjbz.substring(6);
long l = Long.parseLong(substring);
SjGfjsZdgzCb sjGfjsZdgzCb=new SjGfjsZdgzCb();
sjGfjsZdgzCb.setKhxd(khxd);
sjGfjsZdgzCb.setKhnr(khnr);
sjGfjsZdgzCb.setLx("基础");
if(StringUtils.isEmpty(sjdept.getDeptLx())){
return AjaxResult.error("导入失败,第"+(i+1)+"行单位未设置类型");
}
sjGfjsZdgzCb.setPx(l);
sjGfjsZdgzCb.setNd(rq.substring(0,4));
SjGfjsZdgzCb cb=sjGfjsZdgzMapper.selectSjGfjsZdgzCb(sjGfjsZdgzCb);
if(cb==null){
return AjaxResult.error("导入失败,第"+(i+1)+"行未匹配到主要工作内容");
}
zsdwwtcj.setPjbzid(cb.getId()+"");
zsdwwtcj.setPjbzmc(cb.getPjbz());
String zgzrr=new DataFormatter().formatCellValue(row.getCell(7)) ;
zsdwwtcj.setZgzrr(zgzrr);
String zgcs=new DataFormatter().formatCellValue(row.getCell(8)) ;
zsdwwtcj.setZgcs(zgcs);
String zgqx=new DataFormatter().formatCellValue(row.getCell(9)) ;
zsdwwtcj.setZgqx(zgqx);
String zgzt=new DataFormatter().formatCellValue(row.getCell(10)) ;
zsdwwtcj.setZgzt(zgzt);
zsdwwtcj.setJcjb("帮扶组检查");
zsdwwtcj.setCreateTime(DateUtils.getNowDate());
zsdwwtcj.setCreateBy(SecurityUtils.getUsername());
zsdwwtcj.setYl3(sjGfjsZsdwwtcj.getYl3());
list.add(zsdwwtcj);
}
if(list.size()>0){
sjGfjsJcdwwtcjService.batchSave(list);
}
} catch (IOException e) {
e.getMessage();
e.printStackTrace();
throw new BusinessException("导入Excel失败,请联系网站管理员!");
} finally {
workbook.close();
}
return AjaxResult.success("导入成功");
}
/**
* 查询规范建设-帮扶组检查列表
*/
@GetMapping("/list_bfz")
public TableDataInfo list_bfz(SjGfjsZsdwwtcj sjGfjsZsdwwtcj)
{
sjGfjsZsdwwtcj.setJcjb("帮扶组检查");
List<SjGfjsZsdwwtcj> list = sjGfjsJcdwwtcjService.selectSjGfjsZsdwwtcjList_bfz(sjGfjsZsdwwtcj);
return getDataTable(list);
}
//批量提交 ids
@Log(title = "批量提交 帮扶组检查", businessType = BusinessType.UPDATE)
@PostMapping("/pltj")
public AjaxResult pltj(@RequestBody SjGfjsZsdwwtcj fjx)
{
fjx.setZt("1");
return toAjax(sjGfjsJcdwwtcjService.plxg(fjx));
}
}
package com.qianhe.controller;
import com.qianhe.common.annotation.Log;
import com.qianhe.common.core.controller.BaseController;
import com.qianhe.common.core.domain.AjaxResult;
import com.qianhe.common.core.domain.entity.SysDept;
import com.qianhe.common.core.domain.entity.SysRole;
import com.qianhe.common.core.page.TableDataInfo;
import com.qianhe.common.enums.BusinessType;
import com.qianhe.common.utils.SecurityUtils;
import com.qianhe.common.utils.StringUtils;
import com.qianhe.common.utils.poi.ExcelUtil;
import com.qianhe.domain.SjGfjsBfzbfdx;
import com.qianhe.domain.SjGfjsBfzwh;
import com.qianhe.service.ISjGfjsBfzwhService;
import com.qianhe.system.service.ISysDeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 三基帮扶组维护Controller
*
* @author qianhe
* @date 2024-08-31
*/
@RestController
@RequestMapping("/system/sjGfjsBfzwh")
public class SjGfjsBfzwhController extends BaseController
{
@Autowired
private ISjGfjsBfzwhService sjGfjsBfzwhService;
/**
* 查询三基帮扶组维护列表
*/
@GetMapping("/list")
public TableDataInfo list(SjGfjsBfzwh sjGfjsBfzwh)
{
sjGfjsBfzwh.setLxr(SecurityUtils.getUserId());
// 拿到角色如果是管理员 不限制。不是管理员只能看到自己的帮扶组
List<SysRole> rolelist = SecurityUtils.getLoginUser().getUser().getRoles();
if(StringUtils.isNotEmpty(rolelist)){
for (SysRole role :rolelist){
Long roleid = role.getRoleId();
if(roleid==1||roleid==100){
sjGfjsBfzwh.setLxr(null);
}
}
}
startPage();
List<SjGfjsBfzwh> list = sjGfjsBfzwhService.selectSjGfjsBfzwhList(sjGfjsBfzwh);
return getDataTable(list);
}
/**
* 查询三基帮扶组维护下拉框
*/
@GetMapping("/xlklist")
public TableDataInfo xlklist(SjGfjsBfzwh sjGfjsBfzwh)
{
// 获取当前登陆人
sjGfjsBfzwh.setLxr(SecurityUtils.getUserId());
// 拿到角色如果是管理员 不限制。不是管理员只能看到自己的帮扶组
List<SysRole> rolelist = SecurityUtils.getLoginUser().getUser().getRoles();
if(StringUtils.isNotEmpty(rolelist)){
for (SysRole role :rolelist){
Long roleid = role.getRoleId();
if(roleid==1||roleid==100){
sjGfjsBfzwh.setLxr(null);
}
}
}
List<SjGfjsBfzwh> list = sjGfjsBfzwhService.selectSjGfjsBfzwhList(sjGfjsBfzwh);
return getDataTable(list);
}
/**
* 导出三基帮扶组维护列表
*/
@Log(title = "三基帮扶组维护", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, SjGfjsBfzwh sjGfjsBfzwh)
{
// 获取当前登陆人
sjGfjsBfzwh.setLxr(SecurityUtils.getUserId());
List<SjGfjsBfzwh> list = sjGfjsBfzwhService.selectSjGfjsBfzwhList(sjGfjsBfzwh);
ExcelUtil<SjGfjsBfzwh> util = new ExcelUtil<SjGfjsBfzwh>(SjGfjsBfzwh.class);
util.exportExcel(response, list, "三基帮扶组维护数据");
}
/**
* 获取三基帮扶组维护详细信息
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(sjGfjsBfzwhService.selectSjGfjsBfzwhById(id));
}
/**
* 新增三基帮扶组维护
*/
@Log(title = "三基帮扶组维护", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody SjGfjsBfzwh sjGfjsBfzwh)
{
return toAjax(sjGfjsBfzwhService.insertSjGfjsBfzwh(sjGfjsBfzwh));
}
/**
* 修改三基帮扶组维护
*/
@Log(title = "三基帮扶组维护", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody SjGfjsBfzwh sjGfjsBfzwh)
{
return toAjax(sjGfjsBfzwhService.updateSjGfjsBfzwh(sjGfjsBfzwh));
}
/**
* 删除三基帮扶组维护
*/
@Log(title = "三基帮扶组维护", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(sjGfjsBfzwhService.deleteSjGfjsBfzwhByIds(ids));
}
@Autowired
private ISysDeptService deptService;
/**
* 加载对应帮扶组单位列表树
*/
@GetMapping(value = "/bfzBfdxTreeselect/{id}")
public AjaxResult roleMenuTreeselect(@PathVariable("id") Long id)
{
List<SysDept> depts = deptService.selectDeptList_sy(new SysDept());
AjaxResult ajax = AjaxResult.success();
ajax.put("checkedKeys", sjGfjsBfzwhService.selectBfdxListByBfz(id));
ajax.put("menus", sjGfjsBfzwhService.buildBfdwTreeSelect(depts));
return ajax;
}
/**
* 获取菜单下拉树列表
*/
@GetMapping("/deptTreeselect")
public AjaxResult treeselect(SysDept dept)
{
List<SysDept> depts = deptService.selectDeptList_sy(new SysDept());
return success(sjGfjsBfzwhService.buildBfdwTreeSelect(depts));
}
/**
* 查询帮扶对象下拉框
*/
@GetMapping("/bfdxlist")
public TableDataInfo selectBfdxlist(SjGfjsBfzbfdx sjGfjsBfzbfdx)
{
List<SjGfjsBfzbfdx> list = sjGfjsBfzwhService.selectBfdxlist(sjGfjsBfzbfdx);
return getDataTable(list);
}
}
package com.qianhe.domain;
import com.qianhe.common.annotation.Excel;
import com.qianhe.common.core.domain.BaseEntity;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 三基帮扶组维护对象 sj_bfzwh
*
* @author qianhe
* @date 2024-08-31
*/
@Data
public class SjGfjsBfzbfdx extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 帮扶组id */
private Long id;
/** 部门id */
@Excel(name = "部门id")
private Long deptId;
private String deptName;
private String deptLx;
}
package com.qianhe.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.qianhe.common.annotation.Excel;
import com.qianhe.common.core.domain.BaseEntity;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.Date;
/**
* 三基帮扶组维护对象 sj_bfzwh
*
* @author qianhe
* @date 2024-08-31
*/
@Data
public class SjGfjsBfzwh extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
private Long id;
/** 帮扶组名称 */
@Excel(name = "帮扶组名称")
private String bfzmc;
/** 联系人 */
@Excel(name = "联系人")
private Long lxr;
private String lxrname;
/** 年度 */
@Excel(name = "年度")
private String nd;
/** 录入人 */
@Excel(name = "录入人")
private String lrr;
/** 录入时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "录入时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date lrsj;
/** 修改人 */
@Excel(name = "修改人")
private String xgr;
/** 修改时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "修改时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date xgsj;
/** 备注 */
@Excel(name = "备注")
private String bz;
/** 单位组 */
private Long[] deptIds;
private String deptNames;
}
package com.qianhe.mapper;
import com.qianhe.domain.SjGfjsZsdwwtcj;
import java.util.List;
/**
* 规范建设-帮扶组检查Mapper接口
*
* @author qianhe
* @date 2024-07-23
*/
public interface SjGfjsBfzjcMapper
{
/**
* 查询规范建设-帮扶组检查
*
* @param id 规范建设-帮扶组检查主键
* @return 规范建设-扶组检查帮
*/
public SjGfjsZsdwwtcj selectSjGfjsZsdwwtcjById(Long id);
/**
* 查询规范建设-扶组检查帮列表
*
* @param sjGfjsZsdwwtcj 规范建设-扶组检查帮
* @return 规范建设-扶组检查帮集合
*/
public List<SjGfjsZsdwwtcj> selectSjGfjsZsdwwtcjList(SjGfjsZsdwwtcj sjGfjsZsdwwtcj);
public List<SjGfjsZsdwwtcj> selectSjGfjsZsdwwtcjList_bfz(SjGfjsZsdwwtcj sjGfjsZsdwwtcj);
/**
* 新增规范建设-扶组检查帮
*
* @param sjGfjsZsdwwtcj 规范建设-扶组检查帮
* @return 结果
*/
public int insertSjGfjsZsdwwtcj(SjGfjsZsdwwtcj sjGfjsZsdwwtcj);
/**
* 修改规范建设-扶组检查帮
*
* @param sjGfjsZsdwwtcj 规范建设-扶组检查帮
* @return 结果
*/
public int updateSjGfjsZsdwwtcj(SjGfjsZsdwwtcj sjGfjsZsdwwtcj);
/**
* 删除规范建设-扶组检查帮
*
* @param id 规范建设-扶组检查帮主键
* @return 结果
*/
public int deleteSjGfjsZsdwwtcjById(Long id);
/**
* 批量删除规范建设-扶组检查帮
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteSjGfjsZsdwwtcjByIds(Long[] ids);
int batchSave(List<SjGfjsZsdwwtcj> list);
public int plxg(SjGfjsZsdwwtcj sjGfjsZsdwwtcj);
}
package com.qianhe.mapper;
import com.qianhe.domain.SjGfjsBfzbfdx;
import com.qianhe.domain.SjGfjsBfzwh;
import java.util.List;
/**
* 三基帮扶组维护Mapper接口
*
* @author qianhe
* @date 2024-08-31
*/
public interface SjGfjsBfzwhMapper
{
/**
* 查询三基帮扶组维护
*
* @param id 三基帮扶组维护主键
* @return 三基帮扶组维护
*/
public SjGfjsBfzwh selectSjGfjsBfzwhById(Long id);
/**
* 根据联系人查询三基帮扶组
*/
public SjGfjsBfzwh selectbfz(String lxr);
/**
* 查询三基帮扶组维护列表
*
* @param sjGfjsBfzwh 三基帮扶组维护
* @return 三基帮扶组维护集合
*/
public List<SjGfjsBfzwh> selectSjGfjsBfzwhList(SjGfjsBfzwh sjGfjsBfzwh);
/**
* 新增三基帮扶组维护
*
* @param sjGfjsBfzwh 三基帮扶组维护
* @return 结果
*/
public int insertSjGfjsBfzwh(SjGfjsBfzwh sjGfjsBfzwh);
/**
* 修改三基帮扶组维护
*
* @param sjGfjsBfzwh 三基帮扶组维护
* @return 结果
*/
public int updateSjGfjsBfzwh(SjGfjsBfzwh sjGfjsBfzwh);
/**
* 删除三基帮扶组维护
*
* @param id 三基帮扶组维护主键
* @return 结果
*/
public int deleteSjGfjsBfzwhById(Long id);
/**
* 批量删除三基帮扶组维护
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteSjGfjsBfzwhByIds(Long[] ids);
public List<Long> selectBfdxListByBfz(Long id);
public int batchBfzBfdx(List<SjGfjsBfzbfdx> bfzBfdxList);
public int deleteBfzBfdxById(Long id);
public int deleteBfzBfdx(Long[] ids);
public List<SjGfjsBfzbfdx> selectBfdxlist(SjGfjsBfzbfdx sjGfjsBfzbfdx);
}
package com.qianhe.service;
import com.qianhe.domain.SjGfjsZsdwwtcj;
import java.util.List;
/**
* 规范建设-帮扶组检查Service接口
*
* @author qianhe
* @date 2024-07-23
*/
public interface ISjGfjsBfzjcService
{
/**
* 查询规范建设-帮扶组检查
*
* @param id 规范建设-帮扶组检查主键
* @return 规范建设-帮扶组检查
*/
public SjGfjsZsdwwtcj selectSjGfjsZsdwwtcjById(Long id);
/**
* 查询规范建设-帮扶组检查列表
*
* @param sjGfjsZsdwwtcj 规范建设-帮扶组检查
* @return 规范建设-帮扶组检查集合
*/
public List<SjGfjsZsdwwtcj> selectSjGfjsZsdwwtcjList(SjGfjsZsdwwtcj sjGfjsZsdwwtcj);
public List<SjGfjsZsdwwtcj> selectSjGfjsZsdwwtcjList_bfz(SjGfjsZsdwwtcj sjGfjsZsdwwtcj);
/**
* 新增规范建设-帮扶组检查
*
* @param sjGfjsZsdwwtcj 规范建设-帮扶组检查
* @return 结果
*/
public int insertSjGfjsZsdwwtcj(SjGfjsZsdwwtcj sjGfjsZsdwwtcj);
/**
* 修改规范建设-帮扶组检查
*
* @param sjGfjsZsdwwtcj 规范建设-帮扶组检查
* @return 结果
*/
public int updateSjGfjsZsdwwtcj(SjGfjsZsdwwtcj sjGfjsZsdwwtcj);
/**
* 批量删除规范建设-帮扶组检查
*
* @param ids 需要删除的规范建设-帮扶组检查主键集合
* @return 结果
*/
public int deleteSjGfjsZsdwwtcjByIds(Long[] ids);
/**
* 删除规范建设-帮扶组检查信息
*
* @param id 规范建设-帮扶组检查主键
* @return 结果
*/
public int deleteSjGfjsZsdwwtcjById(Long id);
int batchSave(List<SjGfjsZsdwwtcj> list);
public int plxg(SjGfjsZsdwwtcj sjGfjsZsdwwtcj);
}
package com.qianhe.service;
import com.qianhe.common.core.domain.TreeSelect;
import com.qianhe.common.core.domain.entity.SysDept;
import com.qianhe.domain.SjGfjsBfzbfdx;
import com.qianhe.domain.SjGfjsBfzwh;
import java.util.List;
/**
* 三基帮扶组维护Service接口
*
* @author qianhe
* @date 2024-08-31
*/
public interface ISjGfjsBfzwhService
{
/**
* 查询三基帮扶组维护
*
* @param id 三基帮扶组维护主键
* @return 三基帮扶组维护
*/
public SjGfjsBfzwh selectSjGfjsBfzwhById(Long id);
public SjGfjsBfzwh selectbfz(String lxr);
/**
* 查询三基帮扶组维护列表
*
* @param sjGfjsBfzwh 三基帮扶组维护
* @return 三基帮扶组维护集合
*/
public List<SjGfjsBfzwh> selectSjGfjsBfzwhList(SjGfjsBfzwh sjGfjsBfzwh);
/**
* 新增三基帮扶组维护
*
* @param sjGfjsBfzwh 三基帮扶组维护
* @return 结果
*/
public int insertSjGfjsBfzwh(SjGfjsBfzwh sjGfjsBfzwh);
/**
* 修改三基帮扶组维护
*
* @param sjGfjsBfzwh 三基帮扶组维护
* @return 结果
*/
public int updateSjGfjsBfzwh(SjGfjsBfzwh sjGfjsBfzwh);
/**
* 批量删除三基帮扶组维护
*
* @param ids 需要删除的三基帮扶组维护主键集合
* @return 结果
*/
public int deleteSjGfjsBfzwhByIds(Long[] ids);
/**
* 删除三基帮扶组维护信息
*
* @param id 三基帮扶组维护主键
* @return 结果
*/
public int deleteSjGfjsBfzwhById(Long id);
/**
* 查询三基帮扶组帮扶对象
*
* @param id 三基帮扶组维护主键
* @return 三基帮扶组维护
*/
public List<Long> selectBfdxListByBfz(Long id);
/**
* 构建前端所需要下拉树结构
*
* @param depts 单位列表
* @return 下拉树结构列表
*/
public List<TreeSelect> buildBfdwTreeSelect(List<SysDept> depts);
public List<SysDept> buildBfdwxTree(List<SysDept> menus);
public List<SjGfjsBfzbfdx> selectBfdxlist(SjGfjsBfzbfdx sjGfjsBfzbfdx);
}
package com.qianhe.service.impl;
import com.qianhe.common.annotation.DataScope;
import com.qianhe.common.utils.DateUtils;
import com.qianhe.common.utils.SecurityUtils;
import com.qianhe.domain.SjGfjsZsdwwtcj;
import com.qianhe.mapper.SjGfjsBfzjcMapper;
import com.qianhe.service.ISjGfjsBfzjcService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 规范建设-帮扶组检查Service业务层处理
*
* @author qianhe
* @date 2024-07-23
*/
@Service
public class SjGfjsBfzjcServiceImpl implements ISjGfjsBfzjcService
{
@Autowired
private SjGfjsBfzjcMapper sjGfjsJcdwwtcjMapper;
/**
* 查询规范建设-帮扶组检查
*
* @param id 规范建设-帮扶组检查主键
* @return 规范建设-帮扶组检查
*/
@Override
public SjGfjsZsdwwtcj selectSjGfjsZsdwwtcjById(Long id)
{
SjGfjsZsdwwtcj zsdwwtcj = sjGfjsJcdwwtcjMapper.selectSjGfjsZsdwwtcjById(id);
return zsdwwtcj;
}
/**
* 查询规范建设-帮扶组检查列表
*
* @param sjGfjsZsdwwtcj 规范建设-帮扶组检查
* @return 规范建设-帮扶组检查
*/
@Override
@DataScope(deptAlias = "d")
public List<SjGfjsZsdwwtcj> selectSjGfjsZsdwwtcjList(SjGfjsZsdwwtcj sjGfjsZsdwwtcj)
{
return sjGfjsJcdwwtcjMapper.selectSjGfjsZsdwwtcjList(sjGfjsZsdwwtcj);
}
@Override
public List<SjGfjsZsdwwtcj> selectSjGfjsZsdwwtcjList_bfz(SjGfjsZsdwwtcj sjGfjsZsdwwtcj)
{
return sjGfjsJcdwwtcjMapper.selectSjGfjsZsdwwtcjList_bfz(sjGfjsZsdwwtcj);
}
/**
* 新增规范建设-帮扶组检查
*
* @param sjGfjsZsdwwtcj 规范建设-帮扶组检查
* @return 结果
*/
@Override
public int insertSjGfjsZsdwwtcj(SjGfjsZsdwwtcj sjGfjsZsdwwtcj)
{
sjGfjsZsdwwtcj.setCreateTime(DateUtils.getNowDate());
sjGfjsZsdwwtcj.setCreateBy(SecurityUtils.getUsername());
return sjGfjsJcdwwtcjMapper.insertSjGfjsZsdwwtcj(sjGfjsZsdwwtcj);
}
/**
* 修改规范建设-帮扶组检查
*
* @param sjGfjsZsdwwtcj 规范建设-帮扶组检查
* @return 结果
*/
@Override
public int updateSjGfjsZsdwwtcj(SjGfjsZsdwwtcj sjGfjsZsdwwtcj)
{
sjGfjsZsdwwtcj.setUpdateTime(DateUtils.getNowDate());
sjGfjsZsdwwtcj.setUpdateBy(SecurityUtils.getUsername());
return sjGfjsJcdwwtcjMapper.updateSjGfjsZsdwwtcj(sjGfjsZsdwwtcj);
}
/**
* 批量删除规范建设-帮扶组检查
*
* @param ids 需要删除的规范建设-帮扶组检查主键
* @return 结果
*/
@Override
public int deleteSjGfjsZsdwwtcjByIds(Long[] ids)
{
return sjGfjsJcdwwtcjMapper.deleteSjGfjsZsdwwtcjByIds(ids);
}
/**
* 删除规范建设-帮扶组检查信息
*
* @param id 规范建设-帮扶组检查主键
* @return 结果
*/
@Override
public int deleteSjGfjsZsdwwtcjById(Long id)
{
return sjGfjsJcdwwtcjMapper.deleteSjGfjsZsdwwtcjById(id);
}
@Override
public int batchSave(List<SjGfjsZsdwwtcj> list) {
return sjGfjsJcdwwtcjMapper.batchSave(list);
}
@Override
public int plxg(SjGfjsZsdwwtcj sjGfjsZsdwwtcj)
{
sjGfjsZsdwwtcj.setUpdateTime(DateUtils.getNowDate());
sjGfjsZsdwwtcj.setUpdateBy(SecurityUtils.getUsername());
return sjGfjsJcdwwtcjMapper.plxg(sjGfjsZsdwwtcj);
}
}
package com.qianhe.service.impl;
import com.qianhe.common.core.domain.TreeSelect;
import com.qianhe.common.core.domain.entity.SysDept;
import com.qianhe.domain.SjGfjsBfzbfdx;
import com.qianhe.domain.SjGfjsBfzwh;
import com.qianhe.mapper.SjGfjsBfzwhMapper;
import com.qianhe.service.ISjGfjsBfzwhService;
import com.qianhe.system.domain.SysUserRole;
import com.qianhe.system.mapper.SysUserRoleMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.stream.Collectors;
/**
* 三基帮扶组维护Service业务层处理
*
* @author qianhe
* @date 2024-08-31
*/
@Service
public class SjGfjsBfzwhServiceImpl implements ISjGfjsBfzwhService
{
@Autowired
private SjGfjsBfzwhMapper sjGfjsBfzwhMapper;
/**
* 查询三基帮扶组维护
*
* @param id 三基帮扶组维护主键
* @return 三基帮扶组维护
*/
@Override
public SjGfjsBfzwh selectSjGfjsBfzwhById(Long id)
{
return sjGfjsBfzwhMapper.selectSjGfjsBfzwhById(id);
}
/**
* 根据联系人查询三基帮扶组
*/
@Override
public SjGfjsBfzwh selectbfz(String lxr)
{
return sjGfjsBfzwhMapper.selectbfz(lxr);
}
/**
* 查询三基帮扶组维护列表
*
* @param sjGfjsBfzwh 三基帮扶组维护
* @return 三基帮扶组维护
*/
@Override
public List<SjGfjsBfzwh> selectSjGfjsBfzwhList(SjGfjsBfzwh sjGfjsBfzwh)
{
return sjGfjsBfzwhMapper.selectSjGfjsBfzwhList(sjGfjsBfzwh);
}
@Autowired
private SysUserRoleMapper userRoleMapper;
/**
* 新增三基帮扶组维护
*
* @param sjGfjsBfzwh 三基帮扶组维护
* @return 结果
*/
@Override
@Transactional
public int insertSjGfjsBfzwh(SjGfjsBfzwh sjGfjsBfzwh)
{
// 给联系人一个帮扶组角色
SysUserRole userRole = new SysUserRole();
userRole.setUserId(sjGfjsBfzwh.getLxr());
userRole.setRoleId(new Long(104));
userRoleMapper.deleteUserRoleInfo(userRole);
userRoleMapper.insertUserRole(userRole);
sjGfjsBfzwhMapper.insertSjGfjsBfzwh(sjGfjsBfzwh);
return insertBfzBfdx(sjGfjsBfzwh);
}
/**
* 新增帮扶组帮扶对象信息
*
*/
public int insertBfzBfdx(SjGfjsBfzwh sjGfjsBfzwh)
{
int rows = 1;
List<SjGfjsBfzbfdx> list = new ArrayList<SjGfjsBfzbfdx>();
for (Long deptId : sjGfjsBfzwh.getDeptIds())
{
SjGfjsBfzbfdx rm = new SjGfjsBfzbfdx();
rm.setId(sjGfjsBfzwh.getId());
rm.setDeptId(deptId);
list.add(rm);
}
if (list.size() > 0)
{
rows = sjGfjsBfzwhMapper.batchBfzBfdx(list);
}
return rows;
}
/**
* 修改三基帮扶组维护
*
* @param sjGfjsBfzwh 三基帮扶组维护
* @return 结果
*/
@Override
@Transactional
public int updateSjGfjsBfzwh(SjGfjsBfzwh sjGfjsBfzwh)
{
// 给联系人一个帮扶组角色
SysUserRole userRole = new SysUserRole();
userRole.setUserId(sjGfjsBfzwh.getLxr());
userRole.setRoleId(new Long(104));
userRoleMapper.deleteUserRoleInfo(userRole);
userRoleMapper.insertUserRole(userRole);
sjGfjsBfzwhMapper.updateSjGfjsBfzwh(sjGfjsBfzwh);
// 删除帮扶组与帮扶对象关联
sjGfjsBfzwhMapper.deleteBfzBfdxById(sjGfjsBfzwh.getId());
return insertBfzBfdx(sjGfjsBfzwh);
}
/**
* 批量删除三基帮扶组维护
*
* @param ids 需要删除的三基帮扶组维护主键
* @return 结果
*/
@Override
@Transactional
public int deleteSjGfjsBfzwhByIds(Long[] ids)
{
sjGfjsBfzwhMapper.deleteBfzBfdx(ids);
return sjGfjsBfzwhMapper.deleteSjGfjsBfzwhByIds(ids);
}
/**
* 删除三基帮扶组维护信息
*
* @param id 三基帮扶组维护主键
* @return 结果
*/
@Override
@Transactional
public int deleteSjGfjsBfzwhById(Long id)
{
sjGfjsBfzwhMapper.deleteBfzBfdxById(id);
return sjGfjsBfzwhMapper.deleteSjGfjsBfzwhById(id);
}
@Override
public List<Long> selectBfdxListByBfz(Long id)
{
return sjGfjsBfzwhMapper.selectBfdxListByBfz(id);
}
/**
* 构建前端所需要下拉树结构
*
* @param depts 菜单列表
* @return 下拉树结构列表
*/
@Override
public List<TreeSelect> buildBfdwTreeSelect(List<SysDept> depts)
{
List<SysDept> deptTrees = buildBfdwxTree(depts);
return deptTrees.stream().map(TreeSelect::new).collect(Collectors.toList());
}
/**
* 构建前端所需要树结构
*
* @param depts 单位列表
* @return 树结构列表
*/
@Override
public List<SysDept> buildBfdwxTree(List<SysDept> depts)
{
List<SysDept> returnList = new ArrayList<SysDept>();
List<Long> tempList = depts.stream().map(SysDept::getDeptId).collect(Collectors.toList());
for (Iterator<SysDept> iterator = depts.iterator(); iterator.hasNext();)
{
SysDept menu = (SysDept) iterator.next();
// 如果是顶级节点, 遍历该父节点的所有子节点
if (!tempList.contains(menu.getParentId()))
{
recursionFn(depts, menu);
returnList.add(menu);
}
}
if (returnList.isEmpty())
{
returnList = depts;
}
return returnList;
}
/**
* 递归列表
*
* @param list 分类表
* @param t 子节点
*/
private void recursionFn(List<SysDept> list, SysDept t)
{
// 得到子节点列表
List<SysDept> childList = getChildList(list, t);
t.setChildren(childList);
for (SysDept tChild : childList)
{
if (hasChild(list, tChild))
{
recursionFn(list, tChild);
}
}
}
/**
* 得到子节点列表
*/
private List<SysDept> getChildList(List<SysDept> list, SysDept t)
{
List<SysDept> tlist = new ArrayList<SysDept>();
Iterator<SysDept> it = list.iterator();
while (it.hasNext())
{
SysDept n = (SysDept) it.next();
if (n.getParentId().longValue() == t.getDeptId().longValue())
{
tlist.add(n);
}
}
return tlist;
}
/**
* 判断是否有子节点
*/
private boolean hasChild(List<SysDept> list, SysDept t)
{
return getChildList(list, t).size() > 0;
}
@Override
public List<SjGfjsBfzbfdx> selectBfdxlist(SjGfjsBfzbfdx sjGfjsBfzbfdx)
{
return sjGfjsBfzwhMapper.selectBfdxlist(sjGfjsBfzbfdx);
}
}
<?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.SjGfjsBfzjcMapper">
<resultMap type="SjGfjsZsdwwtcj" id="SjGfjsZsdwwtcjResult">
<result property="id" column="id" />
<result property="deptId" column="dept_id" />
<result property="rq" column="rq" />
<result property="jcjb" column="jcjb" />
<result property="wtmc" column="wtmc" />
<result property="khnr" column="khnr" />
<result property="khxd" column="khxd" />
<result property="pjbzid" column="pjbzid" />
<result property="pjbzmc" column="pjbzmc" />
<result property="zgzrr" column="zgzrr" />
<result property="zgcs" column="zgcs" />
<result property="zgqx" column="zgqx" />
<result property="zgzt" column="zgzt" />
<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" />
<result property="yl1" column="yl1" />
<result property="yl2" column="yl2" />
<result property="yl3" column="yl3" />
<result property="yl4" column="yl4" />
<result property="yl5" column="yl5" />
<result property="deptName" column="dept_name" />
<result property="deptLx" column="dept_lx" />
</resultMap>
<sql id="selectSjGfjsZsdwwtcjVo">
select a.id,
a.dept_id,
a.rq,
a.jcjb,
a.wtmc,
a.khnr,
a.khxd,
a.pjbzid,
a.pjbzmc,
a.zgzrr,
a.zgcs,
a.zgqx,
a.zgzt,
a.create_by,
a.create_time,
a.update_by,
a.update_time,
a.remark,
a.yl1,
a.yl2,
a.yl3,
a.yl4,
a.yl5,
d.dept_name,d.dept_lx,
b.bfzmc as yl3name
from sj_gfjs_zsdwwtcj a
left join sys_dept d on a.dept_id=d.dept_id
left join sj_gfjs_bfzwh b on a.yl3 = b.id
</sql>
<select id="selectSjGfjsZsdwwtcjList" parameterType="SjGfjsZsdwwtcj" resultMap="SjGfjsZsdwwtcjResult">
<include refid="selectSjGfjsZsdwwtcjVo"/>
<where>
<if test="deptId != null ">and (a.dept_id = #{deptId} or find_in_set(#{deptId},d.ancestors))</if>
<if test="rq != null and rq != ''"> and a.rq = #{rq}</if>
<if test="jcjb != null and jcjb != ''"> and a.jcjb = #{jcjb}</if>
<if test="wtmc != null and wtmc != ''"> and a.wtmc = #{wtmc}</if>
<if test="khnr != null and khnr != ''"> and a.khnr = #{khnr}</if>
<if test="khxd != null and khxd != ''"> and a.khxd = #{khxd}</if>
<if test="pjbzid != null and pjbzid != ''"> and a.pjbzid = #{pjbzid}</if>
<if test="pjbzmc != null and pjbzmc != ''"> and a.pjbzmc = #{pjbzmc}</if>
<if test="zgzrr != null and zgzrr != ''"> and a.zgzrr = #{zgzrr}</if>
<if test="zgcs != null and zgcs != ''"> and a.zgcs = #{zgcs}</if>
<if test="zgqx != null and zgqx != ''"> and a.zgqx = #{zgqx}</if>
<if test="zgzt != null and zgzt != ''"> and a.zgzt = #{zgzt}</if>
<if test="yl1 != null and yl1 != ''"> and a.yl1 = #{yl1}</if>
<if test="yl2 != null and yl2 != ''"> and a.yl2 = #{yl2}</if>
<if test="yl3 != null and yl3 != ''"> and a.yl3 = #{yl3}</if>
<if test="yl4 != null and yl4 != ''"> and a.yl4 = #{yl4}</if>
<if test="yl5 != null and yl5 != ''"> and a.yl5 = #{yl5}</if>
<if test="createBy != null and createBy != ''"> and a.create_by = #{createBy}</if>
<if test="startRq != null and startRq != ''"> and rq >= #{startRq}</if>
<if test="endRq != null and endRq != ''"> and rq &lt;= #{endRq}</if>
<!-- 数据范围过滤 -->
${params.dataScope}
</where>
order by a.rq desc
</select>
<select id="selectSjGfjsZsdwwtcjList_bfz" parameterType="SjGfjsZsdwwtcj" resultMap="SjGfjsZsdwwtcjResult">
<include refid="selectSjGfjsZsdwwtcjVo"/>
<where>
<if test="deptId != null ">and (a.dept_id = #{deptId} or find_in_set(#{deptId},d.ancestors))</if>
<if test="rq != null and rq != ''"> and rq = #{rq}</if>
<if test="jcjb != null and jcjb != ''"> and jcjb = #{jcjb}</if>
<if test="wtmc != null and wtmc != ''"> and wtmc = #{wtmc}</if>
<if test="khnr != null and khnr != ''"> and khnr = #{khnr}</if>
<if test="khxd != null and khxd != ''"> and khxd = #{khxd}</if>
<if test="pjbzid != null and pjbzid != ''"> and pjbzid = #{pjbzid}</if>
<if test="pjbzmc != null and pjbzmc != ''"> and pjbzmc = #{pjbzmc}</if>
<if test="zgzrr != null and zgzrr != ''"> and zgzrr = #{zgzrr}</if>
<if test="zgcs != null and zgcs != ''"> and zgcs = #{zgcs}</if>
<if test="zgqx != null and zgqx != ''"> and zgqx = #{zgqx}</if>
<if test="zgzt != null and zgzt != ''"> and zgzt = #{zgzt}</if>
<if test="yl1 != null and yl1 != ''"> and yl1 = #{yl1}</if>
<if test="yl2 != null and yl2 != ''"> and yl2 = #{yl2}</if>
<if test="yl3 != null and yl3 != ''"> and yl3 = #{yl3}</if>
<if test="yl4 != null and yl4 != ''"> and yl4 = #{yl4}</if>
<if test="yl5 != null and yl5 != ''"> and yl5 = #{yl5}</if>
<if test="createBy != null and createBy != ''"> and a.create_by = #{createBy}</if>
<if test="startRq != null and startRq != ''"> and rq >= #{startRq}</if>
<if test="endRq != null and endRq != ''"> and rq &lt;= #{endRq}</if>
</where>
order by a.rq desc
</select>
<select id="selectSjGfjsZsdwwtcjById" parameterType="Long" resultMap="SjGfjsZsdwwtcjResult">
<include refid="selectSjGfjsZsdwwtcjVo"/>
where a.id = #{id}
</select>
<insert id="insertSjGfjsZsdwwtcj" parameterType="SjGfjsZsdwwtcj" useGeneratedKeys="true" keyProperty="id">
insert into sj_gfjs_zsdwwtcj
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="deptId != null">dept_id,</if>
<if test="rq != null">rq,</if>
<if test="jcjb != null">jcjb,</if>
<if test="wtmc != null">wtmc,</if>
<if test="khnr != null">khnr,</if>
<if test="khxd != null">khxd,</if>
<if test="pjbzid != null">pjbzid,</if>
<if test="pjbzmc != null">pjbzmc,</if>
<if test="zgzrr != null">zgzrr,</if>
<if test="zgcs != null">zgcs,</if>
<if test="zgqx != null">zgqx,</if>
<if test="zgzt != null">zgzt,</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>
<if test="yl1 != null">yl1,</if>
<if test="yl2 != null">yl2,</if>
<if test="yl3 != null">yl3,</if>
<if test="yl4 != null">yl4,</if>
<if test="yl5 != null">yl5,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="deptId != null">#{deptId},</if>
<if test="rq != null">#{rq},</if>
<if test="jcjb != null">#{jcjb},</if>
<if test="wtmc != null">#{wtmc},</if>
<if test="khnr != null">#{khnr},</if>
<if test="khxd != null">#{khxd},</if>
<if test="pjbzid != null">#{pjbzid},</if>
<if test="pjbzmc != null">#{pjbzmc},</if>
<if test="zgzrr != null">#{zgzrr},</if>
<if test="zgcs != null">#{zgcs},</if>
<if test="zgqx != null">#{zgqx},</if>
<if test="zgzt != null">#{zgzt},</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>
<if test="yl1 != null">#{yl1},</if>
<if test="yl2 != null">#{yl2},</if>
<if test="yl3 != null">#{yl3},</if>
<if test="yl4 != null">#{yl4},</if>
<if test="yl5 != null">#{yl5},</if>
</trim>
</insert>
<insert id="batchSave">
insert into sj_gfjs_zsdwwtcj( dept_id, rq, jcjb, wtmc, khnr, khxd, pjbzid, pjbzmc, zgzrr, zgcs, zgqx, zgzt,create_by,create_time,remark,yl1,yl2,yl3,yl4,yl5) values
<foreach item="item" index="index" collection="list" separator=",">
( #{item.deptId}, #{item.rq}, #{item.jcjb}, #{item.wtmc}, #{item.khnr}, #{item.khxd}, #{item.pjbzid}, #{item.pjbzmc}, #{item.zgzrr}, #{item.zgcs}, #{item.zgqx}, #{item.zgzt}
, #{item.createBy}, #{item.createTime}, #{item.remark},#{item.yl1}, #{item.yl2}, #{item.yl3}, #{item.yl4}, #{item.yl5})
</foreach>
</insert>
<update id="updateSjGfjsZsdwwtcj" parameterType="SjGfjsZsdwwtcj">
update sj_gfjs_zsdwwtcj
<trim prefix="SET" suffixOverrides=",">
<if test="deptId != null">dept_id = #{deptId},</if>
<if test="rq != null">rq = #{rq},</if>
<if test="jcjb != null">jcjb = #{jcjb},</if>
<if test="wtmc != null">wtmc = #{wtmc},</if>
<if test="khnr != null">khnr = #{khnr},</if>
<if test="khxd != null">khxd = #{khxd},</if>
<if test="pjbzid != null">pjbzid = #{pjbzid},</if>
<if test="pjbzmc != null">pjbzmc = #{pjbzmc},</if>
<if test="zgzrr != null">zgzrr = #{zgzrr},</if>
<if test="zgcs != null">zgcs = #{zgcs},</if>
<if test="zgqx != null">zgqx = #{zgqx},</if>
<if test="zgzt != null">zgzt = #{zgzt},</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>
<if test="yl1 != null">yl1 = #{yl1},</if>
<if test="yl2 != null">yl2 = #{yl2},</if>
<if test="yl3 != null">yl3 = #{yl3},</if>
<if test="yl4 != null">yl4 = #{yl4},</if>
<if test="yl5 != null">yl5 = #{yl5},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteSjGfjsZsdwwtcjById" parameterType="Long">
delete from sj_gfjs_zsdwwtcj where id = #{id}
</delete>
<delete id="deleteSjGfjsZsdwwtcjByIds" parameterType="String">
delete from sj_gfjs_zsdwwtcj where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<!--批量修改 根据ids-->
<update id="plxg" parameterType="SjGfjsZsdwwtcj">
update sj_gfjs_zsdwwtcj
<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>
<?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.SjGfjsBfzwhMapper">
<resultMap type="SjGfjsBfzwh" id="SjGfjsBfzwhResult">
<result property="id" column="id" />
<result property="bfzmc" column="bfzmc" />
<result property="lxr" column="lxr" />
<result property="nd" column="nd" />
<result property="lrr" column="lrr" />
<result property="lrsj" column="lrsj" />
<result property="xgr" column="xgr" />
<result property="xgsj" column="xgsj" />
<result property="deptLx" column="dept_lx" />
<result property="bz" column="bz" />
<result property="deptNames" column="deptNames" />
</resultMap>
<resultMap type="SjGfjsBfzbfdx" id="SjGfjsBfzbfdxResult">
<result property="id" column="id" />
<result property="deptId" column="dept_id" />
<result property="deptName" column="dept_name" />
</resultMap>
<sql id="selectSjGfjsBfzwhVo">
select a.id, a.bfzmc, a.lxr, a.nd, a.lrr, s.nick_name lxrname, a.lrsj, a.xgr, a.xgsj, a.bz
from sj_gfjs_bfzwh a
left join sys_user s on a.lxr = s.user_id
</sql>
<select id="selectSjGfjsBfzwhList" parameterType="SjGfjsBfzwh" resultMap="SjGfjsBfzwhResult">
select a.id, a.bfzmc, a.lxr, a.nd, a.lrr, s.nick_name lxrname, a.lrsj, a.xgr, a.xgsj, a.bz,
GROUP_CONCAT(CONCAT(p.dept_name,'/',c.dept_name)) deptNames
from sj_gfjs_bfzwh a
left join sys_user s on a.lxr = s.user_id
left join sj_gfjs_bfzbfdx bfdx on bfdx.id = a.id
LEFT JOIN sys_dept c on bfdx.dept_id = c.dept_id
LEFT JOIN sys_dept p on c.parent_id = p.dept_id
<where>
<if test="bfzmc != null and bfzmc != ''"> and a.bfzmc = #{bfzmc}</if>
<if test="lxr != null and lxr != ''"> and a.lxr = #{lxr}</if>
<if test="nd != null and nd != ''"> and a.nd = #{nd}</if>
<if test="lrr != null and lrr != ''"> and a.lrr = #{lrr}</if>
<if test="lrsj != null "> and a.lrsj = #{lrsj}</if>
<if test="xgr != null and xgr != ''"> and a.xgr = #{xgr}</if>
<if test="xgsj != null "> and a.xgsj = #{xgsj}</if>
<if test="bz != null and bz != ''"> and a.bz = #{bz}</if>
</where>
group by a.id
</select>
<select id="selectSjGfjsBfzwhById" parameterType="Long" resultMap="SjGfjsBfzwhResult">
<include refid="selectSjGfjsBfzwhVo"/>
where id = #{id}
</select>
<select id="selectbfz" parameterType="String" resultMap="SjGfjsBfzwhResult">
<include refid="selectSjGfjsBfzwhVo"/>
where lxr = #{lxr}
</select>
<insert id="insertSjGfjsBfzwh" parameterType="SjGfjsBfzwh" useGeneratedKeys="true" keyProperty="id">
insert into sj_gfjs_bfzwh
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="bfzmc != null">bfzmc,</if>
<if test="lxr != null">lxr,</if>
<if test="nd != null">nd,</if>
<if test="lrr != null">lrr,</if>
<if test="lrsj != null">lrsj,</if>
<if test="xgr != null">xgr,</if>
<if test="xgsj != null">xgsj,</if>
<if test="bz != null">bz,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="bfzmc != null">#{bfzmc},</if>
<if test="lxr != null">#{lxr},</if>
<if test="nd != null">#{nd},</if>
<if test="lrr != null">#{lrr},</if>
<if test="lrsj != null">#{lrsj},</if>
<if test="xgr != null">#{xgr},</if>
<if test="xgsj != null">#{xgsj},</if>
<if test="bz != null">#{bz},</if>
</trim>
</insert>
<update id="updateSjGfjsBfzwh" parameterType="SjGfjsBfzwh">
update sj_gfjs_bfzwh
<trim prefix="SET" suffixOverrides=",">
<if test="bfzmc != null">bfzmc = #{bfzmc},</if>
<if test="lxr != null">lxr = #{lxr},</if>
<if test="nd != null">nd = #{nd},</if>
<if test="lrr != null">lrr = #{lrr},</if>
<if test="lrsj != null">lrsj = #{lrsj},</if>
<if test="xgr != null">xgr = #{xgr},</if>
<if test="xgsj != null">xgsj = #{xgsj},</if>
<if test="bz != null">bz = #{bz},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteSjGfjsBfzwhById" parameterType="Long">
delete from sj_gfjs_bfzwh where id = #{id}
</delete>
<delete id="deleteSjGfjsBfzwhByIds" parameterType="String">
delete from sj_gfjs_bfzwh where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectBfdxListByBfz" resultType="Long">
select d.dept_id from sys_dept d
left join sj_gfjs_bfzbfdx m
on m.dept_id = d.dept_id
where m.id = #{id}
order by d.parent_id, d.order_num
</select>
<insert id="batchBfzBfdx">
insert into sj_gfjs_bfzbfdx(id, dept_id) values
<foreach item="item" index="index" collection="list" separator=",">
(#{item.id},#{item.deptId})
</foreach>
</insert>
<delete id="deleteBfzBfdxById" parameterType="Long">
delete from sj_gfjs_bfzbfdx where id=#{id}
</delete>
<delete id="deleteBfzBfdx" parameterType="Long">
delete from sj_gfjs_bfzbfdx where id in
<foreach collection="array" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectBfdxlist" parameterType="SjGfjsBfzbfdx" resultMap="SjGfjsBfzbfdxResult">
select bfdx.id, bfdx.dept_id, CONCAT(p.dept_name,'/',c.dept_name) dept_name, c.dept_lx
from sj_gfjs_bfzbfdx bfdx
LEFT JOIN sys_dept c on bfdx.dept_id = c.dept_id
LEFT JOIN sys_dept p on c.parent_id = p.dept_id
<where>
<if test="id != null "> and id = #{id}</if>
<if test="deptId != null "> and dept_id = #{deptId}</if>
</where>
</select>
</mapper>
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