Commit d1d7292b by jiang'yun

修改问题

parent b781e62f
...@@ -147,7 +147,8 @@ public class CommonController ...@@ -147,7 +147,8 @@ public class CommonController
@RequestParam("nd") String nd, @RequestParam("nd") String nd,
@RequestParam("mkmc") String mkmc, @RequestParam("mkmc") String mkmc,
@RequestParam("fjlx") String fjlx, @RequestParam("fjlx") String fjlx,
@RequestParam("rdpx") String rdpx) throws Exception @RequestParam("rdpx") String rdpx,
@RequestParam("yl1") String yl1) throws Exception
{ {
try try
{ {
...@@ -159,7 +160,7 @@ public class CommonController ...@@ -159,7 +160,7 @@ public class CommonController
// } // }
// String param="?deptId="+wdWdxxRd.getDeptId()+"&nd="+wdWdxxRd.getNd()+"&mkmc="+wdWdxxRd.getMkmc()+"&fjlx="+wdWdxxRd.getFjlx()+"&rdpx="+wdWdxxRd.getRdpx(); // String param="?deptId="+wdWdxxRd.getDeptId()+"&nd="+wdWdxxRd.getNd()+"&mkmc="+wdWdxxRd.getMkmc()+"&fjlx="+wdWdxxRd.getFjlx()+"&rdpx="+wdWdxxRd.getRdpx();
String param="?deptId="+deptId+"&nd="+nd+"&mkmc="+mkmc+"&fjlx="+fjlx+"&rdpx="+rdpx; String param="?deptId="+deptId+"&nd="+nd+"&mkmc="+mkmc+"&fjlx="+fjlx+"&rdpx="+rdpx+"&yl1="+yl1;
for (MultipartFile file : files) for (MultipartFile file : files)
{ {
// fileName:"/profile/upload/2024/09/14/1_20240914100039A002.jpg" // fileName:"/profile/upload/2024/09/14/1_20240914100039A002.jpg"
......
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.domain.BzscCyglqglscCb;
import com.qianhe.domain.BzscSczhzxscCb;
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.BzscSczhzxscZb;
import com.qianhe.service.IBzscSczhzxscZbService;
import com.qianhe.common.utils.poi.ExcelUtil;
import com.qianhe.common.core.page.TableDataInfo;
/**
* 标准手册-生产指挥中心管理手册-主Controller
*
* @author qianhe
* @date 2024-09-19
*/
@RestController
@RequestMapping("/system/bzscSczhzxscZb")
public class BzscSczhzxscZbController extends BaseController
{
@Autowired
private IBzscSczhzxscZbService bzscSczhzxscZbService;
/**
* 查询标准手册-生产指挥中心管理手册-主列表
*/
@PreAuthorize("@ss.hasPermi('system:bzscSczhzxscZb:list')")
@GetMapping("/list")
public TableDataInfo list(BzscSczhzxscZb bzscSczhzxscZb)
{
startPage();
List<BzscSczhzxscZb> list = bzscSczhzxscZbService.selectBzscSczhzxscZbList(bzscSczhzxscZb);
return getDataTable(list);
}
/**
* 导出标准手册-生产指挥中心管理手册-主列表
*/
@PreAuthorize("@ss.hasPermi('system:bzscSczhzxscZb:export')")
@Log(title = "标准手册-生产指挥中心管理手册-主", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, BzscSczhzxscZb bzscSczhzxscZb)
{
List<BzscSczhzxscZb> list = bzscSczhzxscZbService.selectBzscSczhzxscZbList(bzscSczhzxscZb);
ExcelUtil<BzscSczhzxscZb> util = new ExcelUtil<BzscSczhzxscZb>(BzscSczhzxscZb.class);
util.exportExcel(response, list, "标准手册-生产指挥中心管理手册-主数据");
}
/**
* 获取标准手册-生产指挥中心管理手册-主详细信息
*/
@PreAuthorize("@ss.hasPermi('system:bzscSczhzxscZb:query')")
@GetMapping(value = "/{ID}")
public AjaxResult getInfo(@PathVariable("ID") Long ID)
{
BzscSczhzxscZb bzscSczhzxscZb = bzscSczhzxscZbService.selectBzscSczhzxscZbByID(ID);
Map<String,Object> map =new HashMap<>();
BzscSczhzxscCb cb = bzscSczhzxscZb.getBzscSczhzxscCbList().size() > 0 ? bzscSczhzxscZb.getBzscSczhzxscCbList().get(0) : null;
map.put("nr",cb!=null ?cb.getChildList():new ArrayList<BzscCyglqglscCb>());
if(cb!=null){
cb.setChildList(new ArrayList<>());
}
map.put("bt",cb);
bzscSczhzxscZb.setBzscSczhzxscCbList(new ArrayList<>());
map.put("bzscSczhzxscZb",bzscSczhzxscZb);
return success(map);
}
/**
* 新增标准手册-生产指挥中心管理手册-主
*/
@PreAuthorize("@ss.hasPermi('system:bzscSczhzxscZb:add')")
@Log(title = "标准手册-生产指挥中心管理手册-主", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody BzscSczhzxscZb bzscSczhzxscZb)
{
return toAjax(bzscSczhzxscZbService.insertBzscSczhzxscZb(bzscSczhzxscZb));
}
/**
* 修改标准手册-生产指挥中心管理手册-主
*/
@PreAuthorize("@ss.hasPermi('system:bzscSczhzxscZb:edit')")
@Log(title = "标准手册-生产指挥中心管理手册-主", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody BzscSczhzxscZb bzscSczhzxscZb)
{
return toAjax(bzscSczhzxscZbService.updateBzscSczhzxscZb(bzscSczhzxscZb));
}
/**
* 删除标准手册-生产指挥中心管理手册-主
*/
@PreAuthorize("@ss.hasPermi('system:bzscSczhzxscZb:remove')")
@Log(title = "标准手册-生产指挥中心管理手册-主", businessType = BusinessType.DELETE)
@DeleteMapping("/{IDs}")
public AjaxResult remove(@PathVariable Long[] IDs)
{
return toAjax(bzscSczhzxscZbService.deleteBzscSczhzxscZbByIDs(IDs));
}
}
...@@ -37,7 +37,7 @@ public class WdWdxxRdController extends BaseController ...@@ -37,7 +37,7 @@ public class WdWdxxRdController extends BaseController
/** /**
* 查询文档-热点信息列表 * 查询文档-热点信息列表
*/ */
@PreAuthorize("@ss.hasPermi('system:wdWdxxRd:list')") // @PreAuthorize("@ss.hasPermi('system:wdWdxxRd:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(WdWdxxRd wdWdxxRd) public TableDataInfo list(WdWdxxRd wdWdxxRd)
{ {
......
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;
import java.util.List;
/**
* 标准手册-生产指挥中心管理手册-从对象 bzsc_sczhzxsc_cb
*
* @author qianhe
* @date 2024-09-19
*/
@Data
public class BzscSczhzxscCb extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
private Long ID;
/** 主表id */
@Excel(name = "主表id")
private Long zbId;
/** 单位id */
@Excel(name = "单位id")
private Long deptId;
/** 年度 */
@Excel(name = "年度")
private String nd;
/** 上级id */
@Excel(name = "上级id")
private Long parentId;
/** 名称 */
@Excel(name = "名称")
private String mc;
/** 描述 */
@Excel(name = "描述")
private String ms;
/** 内容 */
@Excel(name = "内容")
private String nr;
/** 排序 */
@Excel(name = "排序")
private Long px;
/** 预留1 */
@Excel(name = "预留1")
private String yl1;
/** 预留2 */
@Excel(name = "预留2")
private String yl2;
/** 预留3 */
@Excel(name = "预留3")
private String yl3;
/** 预留4 */
@Excel(name = "预留4")
private String yl4;
/** 预留5 */
@Excel(name = "预留5")
private String yl5;
private List<BzscSczhzxscCb> childList;
}
package com.qianhe.domain;
import java.util.List;
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;
/**
* 标准手册-生产指挥中心管理手册-主对象 bzsc_sczhzxsc_zb
*
* @author qianhe
* @date 2024-09-19
*/
@Data
public class BzscSczhzxscZb extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
private Long ID;
/** 单位id */
@Excel(name = "单位id")
private Long deptId;
/** 年度 */
@Excel(name = "年度")
private String nd;
/** 预留1 */
@Excel(name = "预留1")
private String yl1;
/** 预留2 */
@Excel(name = "预留2")
private String yl2;
/** 预留3 */
@Excel(name = "预留3")
private String yl3;
/** 预留4 */
@Excel(name = "预留4")
private String yl4;
/** 预留5 */
@Excel(name = "预留5")
private String yl5;
private String deptName;
/** 标准手册-生产指挥中心管理手册-从信息 */
private List<BzscSczhzxscCb> bzscSczhzxscCbList;
}
package com.qianhe.mapper;
import java.util.List;
import com.qianhe.domain.BzscSczhzxscZb;
import com.qianhe.domain.BzscSczhzxscCb;
/**
* 标准手册-生产指挥中心管理手册-主Mapper接口
*
* @author qianhe
* @date 2024-09-19
*/
public interface BzscSczhzxscZbMapper
{
/**
* 查询标准手册-生产指挥中心管理手册-主
*
* @param ID 标准手册-生产指挥中心管理手册-主主键
* @return 标准手册-生产指挥中心管理手册-主
*/
public BzscSczhzxscZb selectBzscSczhzxscZbByID(Long ID);
/**
* 查询标准手册-生产指挥中心管理手册-主列表
*
* @param bzscSczhzxscZb 标准手册-生产指挥中心管理手册-主
* @return 标准手册-生产指挥中心管理手册-主集合
*/
public List<BzscSczhzxscZb> selectBzscSczhzxscZbList(BzscSczhzxscZb bzscSczhzxscZb);
/**
* 新增标准手册-生产指挥中心管理手册-主
*
* @param bzscSczhzxscZb 标准手册-生产指挥中心管理手册-主
* @return 结果
*/
public int insertBzscSczhzxscZb(BzscSczhzxscZb bzscSczhzxscZb);
/**
* 修改标准手册-生产指挥中心管理手册-主
*
* @param bzscSczhzxscZb 标准手册-生产指挥中心管理手册-主
* @return 结果
*/
public int updateBzscSczhzxscZb(BzscSczhzxscZb bzscSczhzxscZb);
/**
* 删除标准手册-生产指挥中心管理手册-主
*
* @param ID 标准手册-生产指挥中心管理手册-主主键
* @return 结果
*/
public int deleteBzscSczhzxscZbByID(Long ID);
/**
* 批量删除标准手册-生产指挥中心管理手册-主
*
* @param IDs 需要删除的数据主键集合
* @return 结果
*/
public int deleteBzscSczhzxscZbByIDs(Long[] IDs);
/**
* 批量删除标准手册-生产指挥中心管理手册-从
*
* @param IDs 需要删除的数据主键集合
* @return 结果
*/
public int deleteBzscSczhzxscCbByZbIds(Long[] IDs);
/**
* 批量新增标准手册-生产指挥中心管理手册-从
*
* @param bzscSczhzxscCbList 标准手册-生产指挥中心管理手册-从列表
* @return 结果
*/
public int batchBzscSczhzxscCb(List<BzscSczhzxscCb> bzscSczhzxscCbList);
/**
* 通过标准手册-生产指挥中心管理手册-主主键删除标准手册-生产指挥中心管理手册-从信息
*
* @param ID 标准手册-生产指挥中心管理手册-主ID
* @return 结果
*/
public int deleteBzscSczhzxscCbByZbId(Long ID);
List<BzscSczhzxscCb> selectBzscSczhzxscCbByID(Long ID);
int insertBzscSczhzxscCb(BzscSczhzxscCb bzscSczhzxscCb);
}
package com.qianhe.service;
import java.util.List;
import com.qianhe.domain.BzscSczhzxscZb;
/**
* 标准手册-生产指挥中心管理手册-主Service接口
*
* @author qianhe
* @date 2024-09-19
*/
public interface IBzscSczhzxscZbService
{
/**
* 查询标准手册-生产指挥中心管理手册-主
*
* @param ID 标准手册-生产指挥中心管理手册-主主键
* @return 标准手册-生产指挥中心管理手册-主
*/
public BzscSczhzxscZb selectBzscSczhzxscZbByID(Long ID);
/**
* 查询标准手册-生产指挥中心管理手册-主列表
*
* @param bzscSczhzxscZb 标准手册-生产指挥中心管理手册-主
* @return 标准手册-生产指挥中心管理手册-主集合
*/
public List<BzscSczhzxscZb> selectBzscSczhzxscZbList(BzscSczhzxscZb bzscSczhzxscZb);
/**
* 新增标准手册-生产指挥中心管理手册-主
*
* @param bzscSczhzxscZb 标准手册-生产指挥中心管理手册-主
* @return 结果
*/
public int insertBzscSczhzxscZb(BzscSczhzxscZb bzscSczhzxscZb);
/**
* 修改标准手册-生产指挥中心管理手册-主
*
* @param bzscSczhzxscZb 标准手册-生产指挥中心管理手册-主
* @return 结果
*/
public int updateBzscSczhzxscZb(BzscSczhzxscZb bzscSczhzxscZb);
/**
* 批量删除标准手册-生产指挥中心管理手册-主
*
* @param IDs 需要删除的标准手册-生产指挥中心管理手册-主主键集合
* @return 结果
*/
public int deleteBzscSczhzxscZbByIDs(Long[] IDs);
/**
* 删除标准手册-生产指挥中心管理手册-主信息
*
* @param ID 标准手册-生产指挥中心管理手册-主主键
* @return 结果
*/
public int deleteBzscSczhzxscZbByID(Long ID);
}
...@@ -47,6 +47,7 @@ public class BzscCyglqglscZbServiceImpl implements IBzscCyglqglscZbService ...@@ -47,6 +47,7 @@ public class BzscCyglqglscZbServiceImpl implements IBzscCyglqglscZbService
//查询从表 //查询从表
List<BzscCyglqglscCb> cbList=bzscCyglqglscZbMapper.selectBzscCyglqglscCbByZbId(ID); List<BzscCyglqglscCb> cbList=bzscCyglqglscZbMapper.selectBzscCyglqglscCbByZbId(ID);
bzscCyglqglscZb.setBzscCyglqglscCbList( buildDeptTree(cbList)); bzscCyglqglscZb.setBzscCyglqglscCbList( buildDeptTree(cbList));
return bzscCyglqglscZb; return bzscCyglqglscZb;
} }
...@@ -142,16 +143,22 @@ public class BzscCyglqglscZbServiceImpl implements IBzscCyglqglscZbService ...@@ -142,16 +143,22 @@ public class BzscCyglqglscZbServiceImpl implements IBzscCyglqglscZbService
{ {
bzscCyglqglscCb.setZbId(ID); bzscCyglqglscCb.setZbId(ID);
bzscCyglqglscCb.setParentId(0L); bzscCyglqglscCb.setParentId(0L);
bzscCyglqglscCb.setDeptId(bzscCyglqglscZb.getDeptId());
bzscCyglqglscCb.setNd(bzscCyglqglscZb.getNd());
bzscCyglqglscZbMapper.insertBzscCyglqglscCb(bzscCyglqglscCb); bzscCyglqglscZbMapper.insertBzscCyglqglscCb(bzscCyglqglscCb);
if(StringUtils.isNotNull(bzscCyglqglscCb.getChildList())){ if(StringUtils.isNotNull(bzscCyglqglscCb.getChildList())){
for(BzscCyglqglscCb cb1:bzscCyglqglscCb.getChildList()){ for(BzscCyglqglscCb cb1:bzscCyglqglscCb.getChildList()){
cb1.setZbId(ID); cb1.setZbId(ID);
cb1.setParentId(bzscCyglqglscCb.getID()); cb1.setParentId(bzscCyglqglscCb.getID());
cb1.setDeptId(bzscCyglqglscZb.getDeptId());
cb1.setNd(bzscCyglqglscZb.getNd());
bzscCyglqglscZbMapper.insertBzscCyglqglscCb(cb1); bzscCyglqglscZbMapper.insertBzscCyglqglscCb(cb1);
if(cb1.getChildList().size()>0){ if(cb1.getChildList().size()>0){
for(BzscCyglqglscCb cb2:cb1.getChildList()){ for(BzscCyglqglscCb cb2:cb1.getChildList()){
cb2.setZbId(ID); cb2.setZbId(ID);
cb2.setParentId(cb1.getID()); cb2.setParentId(cb1.getID());
cb2.setDeptId(bzscCyglqglscZb.getDeptId());
cb2.setNd(bzscCyglqglscZb.getNd());
bzscCyglqglscZbMapper.insertBzscCyglqglscCb(cb2); bzscCyglqglscZbMapper.insertBzscCyglqglscCb(cb2);
} }
}else { }else {
...@@ -160,6 +167,8 @@ public class BzscCyglqglscZbServiceImpl implements IBzscCyglqglscZbService ...@@ -160,6 +167,8 @@ public class BzscCyglqglscZbServiceImpl implements IBzscCyglqglscZbService
BeanUtils.copyProperties(cb1,cb2); BeanUtils.copyProperties(cb1,cb2);
cb2.setZbId(ID); cb2.setZbId(ID);
cb2.setParentId(cb1.getID()); cb2.setParentId(cb1.getID());
cb2.setDeptId(bzscCyglqglscZb.getDeptId());
cb2.setNd(bzscCyglqglscZb.getNd());
bzscCyglqglscZbMapper.insertBzscCyglqglscCb(cb2); bzscCyglqglscZbMapper.insertBzscCyglqglscCb(cb2);
} }
} }
......
package com.qianhe.service.impl;
import java.util.Iterator;
import java.util.List;
import com.qianhe.common.annotation.DataScope;
import com.qianhe.common.utils.DateUtils;
import com.qianhe.common.utils.bean.BeanUtils;
import com.qianhe.domain.BzscCyglqglscCb;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.stream.Collectors;
import com.qianhe.common.utils.StringUtils;
import org.springframework.transaction.annotation.Transactional;
import com.qianhe.domain.BzscSczhzxscCb;
import com.qianhe.mapper.BzscSczhzxscZbMapper;
import com.qianhe.domain.BzscSczhzxscZb;
import com.qianhe.service.IBzscSczhzxscZbService;
/**
* 标准手册-生产指挥中心管理手册-主Service业务层处理
*
* @author qianhe
* @date 2024-09-19
*/
@Service
public class BzscSczhzxscZbServiceImpl implements IBzscSczhzxscZbService
{
@Autowired
private BzscSczhzxscZbMapper bzscSczhzxscZbMapper;
/**
* 查询标准手册-生产指挥中心管理手册-主
*
* @param ID 标准手册-生产指挥中心管理手册-主主键
* @return 标准手册-生产指挥中心管理手册-主
*/
@Override
public BzscSczhzxscZb selectBzscSczhzxscZbByID(Long ID)
{
BzscSczhzxscZb bzscSczhzxscZb = bzscSczhzxscZbMapper.selectBzscSczhzxscZbByID(ID);
List<BzscSczhzxscCb> cbList=bzscSczhzxscZbMapper.selectBzscSczhzxscCbByID(ID);
bzscSczhzxscZb.setBzscSczhzxscCbList( buildDeptTree(cbList));
return bzscSczhzxscZb;
}
/**
* 查询标准手册-生产指挥中心管理手册-主列表
*
* @param bzscSczhzxscZb 标准手册-生产指挥中心管理手册-主
* @return 标准手册-生产指挥中心管理手册-主
*/
@Override
@DataScope(deptAlias = "d")
public List<BzscSczhzxscZb> selectBzscSczhzxscZbList(BzscSczhzxscZb bzscSczhzxscZb)
{
return bzscSczhzxscZbMapper.selectBzscSczhzxscZbList(bzscSczhzxscZb);
}
/**
* 新增标准手册-生产指挥中心管理手册-主
*
* @param bzscSczhzxscZb 标准手册-生产指挥中心管理手册-主
* @return 结果
*/
@Transactional
@Override
public int insertBzscSczhzxscZb(BzscSczhzxscZb bzscSczhzxscZb)
{
bzscSczhzxscZb.setCreateTime(DateUtils.getNowDate());
int rows = bzscSczhzxscZbMapper.insertBzscSczhzxscZb(bzscSczhzxscZb);
insertBzscSczhzxscCb(bzscSczhzxscZb);
return rows;
}
/**
* 修改标准手册-生产指挥中心管理手册-主
*
* @param bzscSczhzxscZb 标准手册-生产指挥中心管理手册-主
* @return 结果
*/
@Transactional
@Override
public int updateBzscSczhzxscZb(BzscSczhzxscZb bzscSczhzxscZb)
{
bzscSczhzxscZb.setUpdateTime(DateUtils.getNowDate());
bzscSczhzxscZbMapper.deleteBzscSczhzxscCbByZbId(bzscSczhzxscZb.getID());
insertBzscSczhzxscCb(bzscSczhzxscZb);
return bzscSczhzxscZbMapper.updateBzscSczhzxscZb(bzscSczhzxscZb);
}
/**
* 批量删除标准手册-生产指挥中心管理手册-主
*
* @param IDs 需要删除的标准手册-生产指挥中心管理手册-主主键
* @return 结果
*/
@Transactional
@Override
public int deleteBzscSczhzxscZbByIDs(Long[] IDs)
{
bzscSczhzxscZbMapper.deleteBzscSczhzxscCbByZbIds(IDs);
return bzscSczhzxscZbMapper.deleteBzscSczhzxscZbByIDs(IDs);
}
/**
* 删除标准手册-生产指挥中心管理手册-主信息
*
* @param ID 标准手册-生产指挥中心管理手册-主主键
* @return 结果
*/
@Transactional
@Override
public int deleteBzscSczhzxscZbByID(Long ID)
{
bzscSczhzxscZbMapper.deleteBzscSczhzxscCbByZbId(ID);
return bzscSczhzxscZbMapper.deleteBzscSczhzxscZbByID(ID);
}
/**
* 新增标准手册-生产指挥中心管理手册-从信息
*
* @param bzscSczhzxscZb 标准手册-生产指挥中心管理手册-主对象
*/
public void insertBzscSczhzxscCb(BzscSczhzxscZb bzscSczhzxscZb)
{
List<BzscSczhzxscCb> bzscSczhzxscCbList = bzscSczhzxscZb.getBzscSczhzxscCbList();
Long ID = bzscSczhzxscZb.getID();
if (StringUtils.isNotNull(bzscSczhzxscCbList))
{
// List<BzscSczhzxscCb> list = new ArrayList<BzscSczhzxscCb>();
for (BzscSczhzxscCb bzscSczhzxscCb : bzscSczhzxscCbList)
{
bzscSczhzxscCb.setZbId(ID);
bzscSczhzxscCb.setParentId(0L);
bzscSczhzxscCb.setDeptId(bzscSczhzxscZb.getDeptId());
bzscSczhzxscCb.setNd(bzscSczhzxscZb.getNd());
bzscSczhzxscZbMapper.insertBzscSczhzxscCb(bzscSczhzxscCb);
if(StringUtils.isNotNull(bzscSczhzxscCb.getChildList())){
for(BzscSczhzxscCb cb1:bzscSczhzxscCb.getChildList()){
cb1.setZbId(ID);
cb1.setParentId(bzscSczhzxscZb.getID());
cb1.setDeptId(bzscSczhzxscZb.getDeptId());
cb1.setNd(bzscSczhzxscZb.getNd());
bzscSczhzxscZbMapper.insertBzscSczhzxscCb(cb1);
if(cb1.getChildList().size()>0){
for(BzscSczhzxscCb cb2:cb1.getChildList()){
cb2.setZbId(ID);
cb2.setParentId(cb1.getID());
cb2.setDeptId(bzscSczhzxscZb.getDeptId());
cb2.setNd(bzscSczhzxscZb.getNd());
bzscSczhzxscZbMapper.insertBzscSczhzxscCb(cb2);
}
}else {
//一级分类没有子级 则本身添加一条子级
BzscSczhzxscCb cb2 =new BzscSczhzxscCb();
BeanUtils.copyProperties(cb1,cb2);
cb2.setZbId(ID);
cb2.setParentId(cb1.getID());
cb2.setDeptId(bzscSczhzxscZb.getDeptId());
cb2.setNd(bzscSczhzxscZb.getNd());
bzscSczhzxscZbMapper.insertBzscSczhzxscCb(cb2);
}
}
}
// list.add(bzscSczhzxscCb);
}
// if (list.size() > 0)
// {
// bzscSczhzxscZbMapper.batchBzscSczhzxscCb(list);
// }
}
}
public List<BzscSczhzxscCb> buildDeptTree(List<BzscSczhzxscCb> cbList)
{
List<BzscSczhzxscCb> returnList = new ArrayList<BzscSczhzxscCb>();
List<Long> tempList = cbList.stream().map(BzscSczhzxscCb::getID).collect(Collectors.toList());
for (BzscSczhzxscCb cb : cbList)
{
// 如果是顶级节点, 遍历该父节点的所有子节点
if (!tempList.contains(cb.getParentId()))
{
recursionFn(cbList, cb);
returnList.add(cb);
}
}
if (returnList.isEmpty())
{
returnList = cbList;
}
return returnList;
}
/**
* 递归列表
*/
private void recursionFn(List<BzscSczhzxscCb> list, BzscSczhzxscCb t)
{
// 得到子节点列表
List<BzscSczhzxscCb> childList = getChildList(list, t);
t.setChildList(childList);
for (BzscSczhzxscCb tChild : childList)
{
if (hasChild(list, tChild))
{
recursionFn(list, tChild);
}
}
}
/**
* 得到子节点列表
*/
private List<BzscSczhzxscCb> getChildList(List<BzscSczhzxscCb> list, BzscSczhzxscCb t)
{
List<BzscSczhzxscCb> tlist = new ArrayList<BzscSczhzxscCb>();
Iterator<BzscSczhzxscCb> it = list.iterator();
while (it.hasNext())
{
BzscSczhzxscCb n = (BzscSczhzxscCb) it.next();
if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().longValue() == t.getID().longValue())
{
tlist.add(n);
}
}
return tlist;
}
/**
* 判断是否有子节点
*/
private boolean hasChild(List<BzscSczhzxscCb> list, BzscSczhzxscCb t)
{
return getChildList(list, t).size() > 0;
}
}
...@@ -139,18 +139,23 @@ public class BzscZczscZbServiceImpl implements IBzscZczscZbService ...@@ -139,18 +139,23 @@ public class BzscZczscZbServiceImpl implements IBzscZczscZbService
for (BzscZczscCb bzscZczscCb : bzscZczscCbList) for (BzscZczscCb bzscZczscCb : bzscZczscCbList)
{ {
bzscZczscCb.setZbId(ID); bzscZczscCb.setZbId(ID);
bzscZczscCb.setZbId(ID);
bzscZczscCb.setParentId(0L); bzscZczscCb.setParentId(0L);
bzscZczscCb.setDeptId(bzscZczscZb.getDeptId());
bzscZczscCb.setNd(bzscZczscZb.getNd());
bzscZczscZbMapper.insertBzscZczscCb(bzscZczscCb); bzscZczscZbMapper.insertBzscZczscCb(bzscZczscCb);
if(StringUtils.isNotNull(bzscZczscCb.getChildList())){ if(StringUtils.isNotNull(bzscZczscCb.getChildList())){
for(BzscZczscCb cb1:bzscZczscCb.getChildList()){ for(BzscZczscCb cb1:bzscZczscCb.getChildList()){
cb1.setZbId(ID); cb1.setZbId(ID);
cb1.setParentId(bzscZczscCb.getID()); cb1.setParentId(bzscZczscCb.getID());
cb1.setDeptId(bzscZczscZb.getDeptId());
cb1.setNd(bzscZczscZb.getNd());
bzscZczscZbMapper.insertBzscZczscCb(cb1); bzscZczscZbMapper.insertBzscZczscCb(cb1);
if(cb1.getChildList().size()>0){ if(cb1.getChildList().size()>0){
for(BzscZczscCb cb2:cb1.getChildList()){ for(BzscZczscCb cb2:cb1.getChildList()){
cb2.setZbId(ID); cb2.setZbId(ID);
cb2.setParentId(cb1.getID()); cb2.setParentId(cb1.getID());
cb2.setDeptId(bzscZczscZb.getDeptId());
cb2.setNd(bzscZczscZb.getNd());
bzscZczscZbMapper.insertBzscZczscCb(cb2); bzscZczscZbMapper.insertBzscZczscCb(cb2);
} }
}else { }else {
...@@ -159,6 +164,8 @@ public class BzscZczscZbServiceImpl implements IBzscZczscZbService ...@@ -159,6 +164,8 @@ public class BzscZczscZbServiceImpl implements IBzscZczscZbService
BeanUtils.copyProperties(cb1,cb2); BeanUtils.copyProperties(cb1,cb2);
cb2.setZbId(ID); cb2.setZbId(ID);
cb2.setParentId(cb1.getID()); cb2.setParentId(cb1.getID());
cb2.setDeptId(bzscZczscZb.getDeptId());
cb2.setNd(bzscZczscZb.getNd());
bzscZczscZbMapper.insertBzscZczscCb(cb2); bzscZczscZbMapper.insertBzscZczscCb(cb2);
} }
} }
......
<?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.BzscSczhzxscZbMapper">
<resultMap type="BzscSczhzxscZb" id="BzscSczhzxscZbResult">
<result property="ID" column="ID" />
<result property="deptId" column="dept_id" />
<result property="nd" column="nd" />
<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" />
</resultMap>
<resultMap id="BzscSczhzxscZbBzscSczhzxscCbResult" type="BzscSczhzxscZb" extends="BzscSczhzxscZbResult">
<collection property="bzscSczhzxscCbList" notNullColumn="sub_ID" javaType="java.util.List" resultMap="BzscSczhzxscCbResult" />
</resultMap>
<resultMap type="BzscSczhzxscCb" id="BzscSczhzxscCbResult">
<result property="ID" column="sub_ID" />
<result property="zbId" column="sub_zb_id" />
<result property="deptId" column="sub_dept_id" />
<result property="nd" column="sub_nd" />
<result property="parentId" column="sub_parent_id" />
<result property="mc" column="sub_mc" />
<result property="ms" column="sub_ms" />
<result property="nr" column="sub_nr" />
<result property="px" column="sub_px" />
<result property="createBy" column="sub_create_by" />
<result property="createTime" column="sub_create_time" />
<result property="updateBy" column="sub_update_by" />
<result property="updateTime" column="sub_update_time" />
<result property="remark" column="sub_remark" />
<result property="yl1" column="sub_yl1" />
<result property="yl2" column="sub_yl2" />
<result property="yl3" column="sub_yl3" />
<result property="yl4" column="sub_yl4" />
<result property="yl5" column="sub_yl5" />
</resultMap>
<sql id="selectBzscSczhzxscZbVo">
select a.* ,d.dept_name from bzsc_sczhzxsc_zb a
left join sys_dept d on a.dept_id=d.dept_id
</sql>
<select id="selectBzscSczhzxscZbList" parameterType="BzscSczhzxscZb" resultMap="BzscSczhzxscZbResult">
<include refid="selectBzscSczhzxscZbVo"/>
<where>
<if test="deptId != null "> and dept_id = #{deptId}</if>
<if test="nd != null and nd != ''"> and nd = #{nd}</if>
<if test="yl1 != null "> and a.yl1 like concat('%', #{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>
<!-- 数据范围过滤 -->
${params.dataScope}
</where>
</select>
<select id="selectBzscSczhzxscZbByID" parameterType="Long" resultMap="BzscSczhzxscZbResult">
select a.ID, a.dept_id, a.nd, a.create_by, a.create_time, a.update_by, a.update_time, a.remark, a.yl1, a.yl2, a.yl3, a.yl4, a.yl5 from bzsc_sczhzxsc_zb a
where a.ID = #{ID}
</select>
<select id="selectBzscSczhzxscCbByID" resultType="com.qianhe.domain.BzscSczhzxscCb">
select *from bzsc_sczhzxsc_cb where zb_id=#{ID} order by px
</select>
<insert id="insertBzscSczhzxscZb" parameterType="BzscSczhzxscZb" useGeneratedKeys="true" keyProperty="ID">
insert into bzsc_sczhzxsc_zb
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="deptId != null">dept_id,</if>
<if test="nd != null">nd,</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="nd != null">#{nd},</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>
<update id="updateBzscSczhzxscZb" parameterType="BzscSczhzxscZb">
update bzsc_sczhzxsc_zb
<trim prefix="SET" suffixOverrides=",">
<if test="deptId != null">dept_id = #{deptId},</if>
<if test="nd != null">nd = #{nd},</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="deleteBzscSczhzxscZbByID" parameterType="Long">
delete from bzsc_sczhzxsc_zb where ID = #{ID}
</delete>
<delete id="deleteBzscSczhzxscZbByIDs" parameterType="String">
delete from bzsc_sczhzxsc_zb where ID in
<foreach item="ID" collection="array" open="(" separator="," close=")">
#{ID}
</foreach>
</delete>
<delete id="deleteBzscSczhzxscCbByZbIds" parameterType="String">
delete from bzsc_sczhzxsc_cb where zb_id in
<foreach item="zbId" collection="array" open="(" separator="," close=")">
#{zbId}
</foreach>
</delete>
<delete id="deleteBzscSczhzxscCbByZbId" parameterType="Long">
delete from bzsc_sczhzxsc_cb where zb_id = #{zbId}
</delete>
<insert id="batchBzscSczhzxscCb">
insert into bzsc_sczhzxsc_cb( ID, zb_id, dept_id, nd, parent_id, mc, ms, nr, px, create_by, create_time, update_by, update_time, remark, yl1, yl2, yl3, yl4, yl5) values
<foreach item="item" index="index" collection="list" separator=",">
( #{item.ID}, #{item.zbId}, #{item.deptId}, #{item.nd}, #{item.parentId}, #{item.mc}, #{item.ms}, #{item.nr}, #{item.px}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime}, #{item.remark}, #{item.yl1}, #{item.yl2}, #{item.yl3}, #{item.yl4}, #{item.yl5})
</foreach>
</insert>
<insert id="insertBzscSczhzxscCb" parameterType="BzscSczhzxscCb" useGeneratedKeys="true" keyProperty="ID">
insert into bzsc_sczhzxsc_cb
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="zbId != null">zb_id,</if>
<if test="deptId != null">dept_id,</if>
<if test="nd != null">nd,</if>
<if test="parentId != null">parent_id,</if>
<if test="mc != null">mc,</if>
<if test="ms != null">ms,</if>
<if test="nr != null">nr,</if>
<if test="px != null">px,</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="zbId != null">#{zbId},</if>
<if test="deptId != null">#{deptId},</if>
<if test="nd != null">#{nd},</if>
<if test="parentId != null">#{parentId},</if>
<if test="mc != null">#{mc},</if>
<if test="ms != null">#{ms},</if>
<if test="nr != null">#{nr},</if>
<if test="px != null">#{px},</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>
</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