Commit 7b45f597 by jiang'yun

修改问题

parent 2dd0b236
package com.qianhe.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
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.BzscCyglqglscZb;
import com.qianhe.service.IBzscCyglqglscZbService;
import com.qianhe.common.utils.poi.ExcelUtil;
import com.qianhe.common.core.page.TableDataInfo;
/**
* 标准手册-采油管理区管理手册-主Controller
*
* @author qianhe
* @date 2024-09-10
*/
@RestController
@RequestMapping("/system/bzscCyglqglscZb")
public class BzscCyglqglscZbController extends BaseController
{
@Autowired
private IBzscCyglqglscZbService bzscCyglqglscZbService;
/**
* 查询标准手册-采油管理区管理手册-主列表
*/
@PreAuthorize("@ss.hasPermi('system:bzscCyglqglscZb:list')")
@GetMapping("/list")
public TableDataInfo list(BzscCyglqglscZb bzscCyglqglscZb)
{
startPage();
List<BzscCyglqglscZb> list = bzscCyglqglscZbService.selectBzscCyglqglscZbList(bzscCyglqglscZb);
return getDataTable(list);
}
/**
* 导出标准手册-采油管理区管理手册-主列表
*/
@PreAuthorize("@ss.hasPermi('system:bzscCyglqglscZb:export')")
@Log(title = "标准手册-采油管理区管理手册-主", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, BzscCyglqglscZb bzscCyglqglscZb)
{
List<BzscCyglqglscZb> list = bzscCyglqglscZbService.selectBzscCyglqglscZbList(bzscCyglqglscZb);
ExcelUtil<BzscCyglqglscZb> util = new ExcelUtil<BzscCyglqglscZb>(BzscCyglqglscZb.class);
util.exportExcel(response, list, "标准手册-采油管理区管理手册-主数据");
}
/**
* 获取标准手册-采油管理区管理手册-主详细信息
*/
@PreAuthorize("@ss.hasPermi('system:bzscCyglqglscZb:query')")
@GetMapping(value = "/{ID}")
public AjaxResult getInfo(@PathVariable("ID") Long ID)
{
return success(bzscCyglqglscZbService.selectBzscCyglqglscZbByID(ID));
}
/**
* 新增标准手册-采油管理区管理手册-主
*/
@PreAuthorize("@ss.hasPermi('system:bzscCyglqglscZb:add')")
@Log(title = "标准手册-采油管理区管理手册-主", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody BzscCyglqglscZb bzscCyglqglscZb)
{
return toAjax(bzscCyglqglscZbService.insertBzscCyglqglscZb(bzscCyglqglscZb));
}
/**
* 修改标准手册-采油管理区管理手册-主
*/
@PreAuthorize("@ss.hasPermi('system:bzscCyglqglscZb:edit')")
@Log(title = "标准手册-采油管理区管理手册-主", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody BzscCyglqglscZb bzscCyglqglscZb)
{
return toAjax(bzscCyglqglscZbService.updateBzscCyglqglscZb(bzscCyglqglscZb));
}
/**
* 删除标准手册-采油管理区管理手册-主
*/
@PreAuthorize("@ss.hasPermi('system:bzscCyglqglscZb:remove')")
@Log(title = "标准手册-采油管理区管理手册-主", businessType = BusinessType.DELETE)
@DeleteMapping("/{IDs}")
public AjaxResult remove(@PathVariable Long[] IDs)
{
return toAjax(bzscCyglqglscZbService.deleteBzscCyglqglscZbByIDs(IDs));
}
}
package com.qianhe.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
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.BzscZczscZb;
import com.qianhe.service.IBzscZczscZbService;
import com.qianhe.common.utils.poi.ExcelUtil;
import com.qianhe.common.core.page.TableDataInfo;
/**
* 标准手册-注采站管理手册-主Controller
*
* @author qianhe
* @date 2024-09-11
*/
@RestController
@RequestMapping("/system/bzscZczscZb")
public class BzscZczscZbController extends BaseController
{
@Autowired
private IBzscZczscZbService bzscZczscZbService;
/**
* 查询标准手册-注采站管理手册-主列表
*/
@PreAuthorize("@ss.hasPermi('system:bzscZczscZb:list')")
@GetMapping("/list")
public TableDataInfo list(BzscZczscZb bzscZczscZb)
{
startPage();
List<BzscZczscZb> list = bzscZczscZbService.selectBzscZczscZbList(bzscZczscZb);
return getDataTable(list);
}
/**
* 导出标准手册-注采站管理手册-主列表
*/
@PreAuthorize("@ss.hasPermi('system:bzscZczscZb:export')")
@Log(title = "标准手册-注采站管理手册-主", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, BzscZczscZb bzscZczscZb)
{
List<BzscZczscZb> list = bzscZczscZbService.selectBzscZczscZbList(bzscZczscZb);
ExcelUtil<BzscZczscZb> util = new ExcelUtil<BzscZczscZb>(BzscZczscZb.class);
util.exportExcel(response, list, "标准手册-注采站管理手册-主数据");
}
/**
* 获取标准手册-注采站管理手册-主详细信息
*/
@PreAuthorize("@ss.hasPermi('system:bzscZczscZb:query')")
@GetMapping(value = "/{ID}")
public AjaxResult getInfo(@PathVariable("ID") Long ID)
{
return success(bzscZczscZbService.selectBzscZczscZbByID(ID));
}
/**
* 新增标准手册-注采站管理手册-主
*/
@PreAuthorize("@ss.hasPermi('system:bzscZczscZb:add')")
@Log(title = "标准手册-注采站管理手册-主", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody BzscZczscZb bzscZczscZb)
{
return toAjax(bzscZczscZbService.insertBzscZczscZb(bzscZczscZb));
}
/**
* 修改标准手册-注采站管理手册-主
*/
@PreAuthorize("@ss.hasPermi('system:bzscZczscZb:edit')")
@Log(title = "标准手册-注采站管理手册-主", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody BzscZczscZb bzscZczscZb)
{
return toAjax(bzscZczscZbService.updateBzscZczscZb(bzscZczscZb));
}
/**
* 删除标准手册-注采站管理手册-主
*/
@PreAuthorize("@ss.hasPermi('system:bzscZczscZb:remove')")
@Log(title = "标准手册-注采站管理手册-主", businessType = BusinessType.DELETE)
@DeleteMapping("/{IDs}")
public AjaxResult remove(@PathVariable Long[] IDs)
{
return toAjax(bzscZczscZbService.deleteBzscZczscZbByIDs(IDs));
}
}
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_cyglqglsc_cb
*
* @author qianhe
* @date 2024-09-10
*/
@Data
public class BzscCyglqglscCb 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<BzscCyglqglscCb> 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_cyglqglsc_zb
*
* @author qianhe
* @date 2024-09-10
*/
@Data
public class BzscCyglqglscZb 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<BzscCyglqglscCb> bzscCyglqglscCbList;
}
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_zczsc_cb
*
* @author qianhe
* @date 2024-09-11
*/
@Data
public class BzscZczscCb 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 Long 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<BzscZczscCb> 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_zczsc_zb
*
* @author qianhe
* @date 2024-09-11
*/
@Data
public class BzscZczscZb 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 Long 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<BzscZczscCb> bzscZczscCbList;
}
package com.qianhe.mapper;
import java.util.List;
import com.qianhe.domain.BzscCyglqglscZb;
import com.qianhe.domain.BzscCyglqglscCb;
/**
* 标准手册-采油管理区管理手册-主Mapper接口
*
* @author qianhe
* @date 2024-09-10
*/
public interface BzscCyglqglscZbMapper
{
/**
* 查询标准手册-采油管理区管理手册-主
*
* @param ID 标准手册-采油管理区管理手册-主主键
* @return 标准手册-采油管理区管理手册-主
*/
public BzscCyglqglscZb selectBzscCyglqglscZbByID(Long ID);
/**
* 查询标准手册-采油管理区管理手册-主列表
*
* @param bzscCyglqglscZb 标准手册-采油管理区管理手册-主
* @return 标准手册-采油管理区管理手册-主集合
*/
public List<BzscCyglqglscZb> selectBzscCyglqglscZbList(BzscCyglqglscZb bzscCyglqglscZb);
/**
* 新增标准手册-采油管理区管理手册-主
*
* @param bzscCyglqglscZb 标准手册-采油管理区管理手册-主
* @return 结果
*/
public int insertBzscCyglqglscZb(BzscCyglqglscZb bzscCyglqglscZb);
/**
* 修改标准手册-采油管理区管理手册-主
*
* @param bzscCyglqglscZb 标准手册-采油管理区管理手册-主
* @return 结果
*/
public int updateBzscCyglqglscZb(BzscCyglqglscZb bzscCyglqglscZb);
/**
* 删除标准手册-采油管理区管理手册-主
*
* @param ID 标准手册-采油管理区管理手册-主主键
* @return 结果
*/
public int deleteBzscCyglqglscZbByID(Long ID);
/**
* 批量删除标准手册-采油管理区管理手册-主
*
* @param IDs 需要删除的数据主键集合
* @return 结果
*/
public int deleteBzscCyglqglscZbByIDs(Long[] IDs);
/**
* 批量删除标准手册-采油管理区管理手册-从
*
* @param IDs 需要删除的数据主键集合
* @return 结果
*/
public int deleteBzscCyglqglscCbByZbIds(Long[] IDs);
/**
* 批量新增标准手册-采油管理区管理手册-从
*
* @param bzscCyglqglscCbList 标准手册-采油管理区管理手册-从列表
* @return 结果
*/
public int batchBzscCyglqglscCb(List<BzscCyglqglscCb> bzscCyglqglscCbList);
/**
* 通过标准手册-采油管理区管理手册-主主键删除标准手册-采油管理区管理手册-从信息
*
* @param ID 标准手册-采油管理区管理手册-主ID
* @return 结果
*/
public int deleteBzscCyglqglscCbByZbId(Long ID);
int insertBzscCyglqglscCb(BzscCyglqglscCb bzscCyglqglscCb);
List<BzscCyglqglscCb> selectBzscCyglqglscCbByZbId(Long ID);
}
package com.qianhe.mapper;
import java.util.List;
import com.qianhe.domain.BzscZczscZb;
import com.qianhe.domain.BzscZczscCb;
/**
* 标准手册-注采站管理手册-主Mapper接口
*
* @author qianhe
* @date 2024-09-11
*/
public interface BzscZczscZbMapper
{
/**
* 查询标准手册-注采站管理手册-主
*
* @param ID 标准手册-注采站管理手册-主主键
* @return 标准手册-注采站管理手册-主
*/
public BzscZczscZb selectBzscZczscZbByID(Long ID);
/**
* 查询标准手册-注采站管理手册-主列表
*
* @param bzscZczscZb 标准手册-注采站管理手册-主
* @return 标准手册-注采站管理手册-主集合
*/
public List<BzscZczscZb> selectBzscZczscZbList(BzscZczscZb bzscZczscZb);
/**
* 新增标准手册-注采站管理手册-主
*
* @param bzscZczscZb 标准手册-注采站管理手册-主
* @return 结果
*/
public int insertBzscZczscZb(BzscZczscZb bzscZczscZb);
/**
* 修改标准手册-注采站管理手册-主
*
* @param bzscZczscZb 标准手册-注采站管理手册-主
* @return 结果
*/
public int updateBzscZczscZb(BzscZczscZb bzscZczscZb);
/**
* 删除标准手册-注采站管理手册-主
*
* @param ID 标准手册-注采站管理手册-主主键
* @return 结果
*/
public int deleteBzscZczscZbByID(Long ID);
/**
* 批量删除标准手册-注采站管理手册-主
*
* @param IDs 需要删除的数据主键集合
* @return 结果
*/
public int deleteBzscZczscZbByIDs(Long[] IDs);
/**
* 批量删除标准手册-注采站管理手册-从
*
* @param IDs 需要删除的数据主键集合
* @return 结果
*/
public int deleteBzscZczscCbByZbIds(Long[] IDs);
/**
* 批量新增标准手册-注采站管理手册-从
*
* @param bzscZczscCbList 标准手册-注采站管理手册-从列表
* @return 结果
*/
public int batchBzscZczscCb(List<BzscZczscCb> bzscZczscCbList);
/**
* 通过标准手册-注采站管理手册-主主键删除标准手册-注采站管理手册-从信息
*
* @param ID 标准手册-注采站管理手册-主ID
* @return 结果
*/
public int deleteBzscZczscCbByZbId(Long ID);
int insertBzscZczscCb(BzscZczscCb bzscZczscCb);
List<BzscZczscCb> selectBzscZczscCbByID(Long ID);
}
package com.qianhe.service;
import java.util.List;
import com.qianhe.domain.BzscCyglqglscZb;
/**
* 标准手册-采油管理区管理手册-主Service接口
*
* @author qianhe
* @date 2024-09-10
*/
public interface IBzscCyglqglscZbService
{
/**
* 查询标准手册-采油管理区管理手册-主
*
* @param ID 标准手册-采油管理区管理手册-主主键
* @return 标准手册-采油管理区管理手册-主
*/
public BzscCyglqglscZb selectBzscCyglqglscZbByID(Long ID);
/**
* 查询标准手册-采油管理区管理手册-主列表
*
* @param bzscCyglqglscZb 标准手册-采油管理区管理手册-主
* @return 标准手册-采油管理区管理手册-主集合
*/
public List<BzscCyglqglscZb> selectBzscCyglqglscZbList(BzscCyglqglscZb bzscCyglqglscZb);
/**
* 新增标准手册-采油管理区管理手册-主
*
* @param bzscCyglqglscZb 标准手册-采油管理区管理手册-主
* @return 结果
*/
public int insertBzscCyglqglscZb(BzscCyglqglscZb bzscCyglqglscZb);
/**
* 修改标准手册-采油管理区管理手册-主
*
* @param bzscCyglqglscZb 标准手册-采油管理区管理手册-主
* @return 结果
*/
public int updateBzscCyglqglscZb(BzscCyglqglscZb bzscCyglqglscZb);
/**
* 批量删除标准手册-采油管理区管理手册-主
*
* @param IDs 需要删除的标准手册-采油管理区管理手册-主主键集合
* @return 结果
*/
public int deleteBzscCyglqglscZbByIDs(Long[] IDs);
/**
* 删除标准手册-采油管理区管理手册-主信息
*
* @param ID 标准手册-采油管理区管理手册-主主键
* @return 结果
*/
public int deleteBzscCyglqglscZbByID(Long ID);
}
package com.qianhe.service;
import java.util.List;
import com.qianhe.domain.BzscZczscZb;
/**
* 标准手册-注采站管理手册-主Service接口
*
* @author qianhe
* @date 2024-09-11
*/
public interface IBzscZczscZbService
{
/**
* 查询标准手册-注采站管理手册-主
*
* @param ID 标准手册-注采站管理手册-主主键
* @return 标准手册-注采站管理手册-主
*/
public BzscZczscZb selectBzscZczscZbByID(Long ID);
/**
* 查询标准手册-注采站管理手册-主列表
*
* @param bzscZczscZb 标准手册-注采站管理手册-主
* @return 标准手册-注采站管理手册-主集合
*/
public List<BzscZczscZb> selectBzscZczscZbList(BzscZczscZb bzscZczscZb);
/**
* 新增标准手册-注采站管理手册-主
*
* @param bzscZczscZb 标准手册-注采站管理手册-主
* @return 结果
*/
public int insertBzscZczscZb(BzscZczscZb bzscZczscZb);
/**
* 修改标准手册-注采站管理手册-主
*
* @param bzscZczscZb 标准手册-注采站管理手册-主
* @return 结果
*/
public int updateBzscZczscZb(BzscZczscZb bzscZczscZb);
/**
* 批量删除标准手册-注采站管理手册-主
*
* @param IDs 需要删除的标准手册-注采站管理手册-主主键集合
* @return 结果
*/
public int deleteBzscZczscZbByIDs(Long[] IDs);
/**
* 删除标准手册-注采站管理手册-主信息
*
* @param ID 标准手册-注采站管理手册-主主键
* @return 结果
*/
public int deleteBzscZczscZbByID(Long ID);
}
package com.qianhe.service.impl;
import java.util.Iterator;
import java.util.List;
import cn.hutool.core.lang.tree.TreeUtil;
import com.qianhe.common.annotation.DataScope;
import com.qianhe.common.core.domain.BaseEntity;
import com.qianhe.common.core.domain.entity.SysDept;
import com.qianhe.common.utils.DateUtils;
import com.qianhe.common.utils.SecurityUtils;
import com.qianhe.common.utils.bean.BeanUtils;
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.BzscCyglqglscCb;
import com.qianhe.mapper.BzscCyglqglscZbMapper;
import com.qianhe.domain.BzscCyglqglscZb;
import com.qianhe.service.IBzscCyglqglscZbService;
/**
* 标准手册-采油管理区管理手册-主Service业务层处理
*
* @author qianhe
* @date 2024-09-10
*/
@Service
public class BzscCyglqglscZbServiceImpl implements IBzscCyglqglscZbService
{
@Autowired
private BzscCyglqglscZbMapper bzscCyglqglscZbMapper;
/**
* 查询标准手册-采油管理区管理手册-主
*
* @param ID 标准手册-采油管理区管理手册-主主键
* @return 标准手册-采油管理区管理手册-主
*/
@Override
public BzscCyglqglscZb selectBzscCyglqglscZbByID(Long ID)
{
BzscCyglqglscZb bzscCyglqglscZb = bzscCyglqglscZbMapper.selectBzscCyglqglscZbByID(ID);
//查询从表
List<BzscCyglqglscCb> cbList=bzscCyglqglscZbMapper.selectBzscCyglqglscCbByZbId(ID);
bzscCyglqglscZb.setBzscCyglqglscCbList( buildDeptTree(cbList));
return bzscCyglqglscZb;
}
/**
* 查询标准手册-采油管理区管理手册-主列表
*
* @param bzscCyglqglscZb 标准手册-采油管理区管理手册-主
* @return 标准手册-采油管理区管理手册-主
*/
@Override
@DataScope(deptAlias = "d")
public List<BzscCyglqglscZb> selectBzscCyglqglscZbList(BzscCyglqglscZb bzscCyglqglscZb)
{
return bzscCyglqglscZbMapper.selectBzscCyglqglscZbList(bzscCyglqglscZb);
}
/**
* 新增标准手册-采油管理区管理手册-主
*
* @param bzscCyglqglscZb 标准手册-采油管理区管理手册-主
* @return 结果
*/
@Transactional
@Override
public int insertBzscCyglqglscZb(BzscCyglqglscZb bzscCyglqglscZb)
{
bzscCyglqglscZb.setCreateTime(DateUtils.getNowDate());
bzscCyglqglscZb.setCreateBy(SecurityUtils.getUsername());
int rows = bzscCyglqglscZbMapper.insertBzscCyglqglscZb(bzscCyglqglscZb);
insertBzscCyglqglscCb(bzscCyglqglscZb);
return rows;
}
/**
* 修改标准手册-采油管理区管理手册-主
*
* @param bzscCyglqglscZb 标准手册-采油管理区管理手册-主
* @return 结果
*/
@Transactional
@Override
public int updateBzscCyglqglscZb(BzscCyglqglscZb bzscCyglqglscZb)
{
bzscCyglqglscZb.setUpdateTime(DateUtils.getNowDate());
bzscCyglqglscZb.setUpdateBy(SecurityUtils.getUsername());
bzscCyglqglscZbMapper.deleteBzscCyglqglscCbByZbId(bzscCyglqglscZb.getID());
insertBzscCyglqglscCb(bzscCyglqglscZb);
return bzscCyglqglscZbMapper.updateBzscCyglqglscZb(bzscCyglqglscZb);
}
/**
* 批量删除标准手册-采油管理区管理手册-主
*
* @param IDs 需要删除的标准手册-采油管理区管理手册-主主键
* @return 结果
*/
@Transactional
@Override
public int deleteBzscCyglqglscZbByIDs(Long[] IDs)
{
bzscCyglqglscZbMapper.deleteBzscCyglqglscCbByZbIds(IDs);
return bzscCyglqglscZbMapper.deleteBzscCyglqglscZbByIDs(IDs);
}
/**
* 删除标准手册-采油管理区管理手册-主信息
*
* @param ID 标准手册-采油管理区管理手册-主主键
* @return 结果
*/
@Transactional
@Override
public int deleteBzscCyglqglscZbByID(Long ID)
{
bzscCyglqglscZbMapper.deleteBzscCyglqglscCbByZbId(ID);
return bzscCyglqglscZbMapper.deleteBzscCyglqglscZbByID(ID);
}
/**
* 新增标准手册-采油管理区管理手册-从信息
*
* @param bzscCyglqglscZb 标准手册-采油管理区管理手册-主对象
*/
public void insertBzscCyglqglscCb(BzscCyglqglscZb bzscCyglqglscZb)
{
List<BzscCyglqglscCb> bzscCyglqglscCbList = bzscCyglqglscZb.getBzscCyglqglscCbList();
Long ID = bzscCyglqglscZb.getID();
if (StringUtils.isNotNull(bzscCyglqglscCbList))
{
List<BzscCyglqglscCb> list = new ArrayList<BzscCyglqglscCb>();
//标题
for (BzscCyglqglscCb bzscCyglqglscCb : bzscCyglqglscCbList)
{
bzscCyglqglscCb.setZbId(ID);
bzscCyglqglscCb.setParentId(0L);
bzscCyglqglscZbMapper.insertBzscCyglqglscCb(bzscCyglqglscCb);
if(StringUtils.isNotNull(bzscCyglqglscCb.getChildList())){
for(BzscCyglqglscCb cb1:bzscCyglqglscCb.getChildList()){
cb1.setZbId(ID);
cb1.setParentId(bzscCyglqglscCb.getID());
bzscCyglqglscZbMapper.insertBzscCyglqglscCb(cb1);
if(cb1.getChildList().size()>0){
for(BzscCyglqglscCb cb2:cb1.getChildList()){
cb2.setZbId(ID);
cb2.setParentId(cb1.getID());
bzscCyglqglscZbMapper.insertBzscCyglqglscCb(cb2);
}
}else {
//一级分类没有子级 则本身添加一条子级
BzscCyglqglscCb cb2 =new BzscCyglqglscCb();
BeanUtils.copyProperties(cb1,cb2);
cb2.setZbId(ID);
cb2.setParentId(cb1.getID());
bzscCyglqglscZbMapper.insertBzscCyglqglscCb(cb2);
}
}
}
// list.add(bzscCyglqglscCb);
}
// if (list.size() > 0)
// {
// bzscCyglqglscZbMapper.batchBzscCyglqglscCb(list);
// }
}
}
public List<BzscCyglqglscCb> buildDeptTree(List<BzscCyglqglscCb> cbList)
{
List<BzscCyglqglscCb> returnList = new ArrayList<BzscCyglqglscCb>();
List<Long> tempList = cbList.stream().map(BzscCyglqglscCb::getID).collect(Collectors.toList());
for (BzscCyglqglscCb cb : cbList)
{
// 如果是顶级节点, 遍历该父节点的所有子节点
if (!tempList.contains(cb.getParentId()))
{
recursionFn(cbList, cb);
returnList.add(cb);
}
}
if (returnList.isEmpty())
{
returnList = cbList;
}
return returnList;
}
/**
* 递归列表
*/
private void recursionFn(List<BzscCyglqglscCb> list, BzscCyglqglscCb t)
{
// 得到子节点列表
List<BzscCyglqglscCb> childList = getChildList(list, t);
t.setChildList(childList);
for (BzscCyglqglscCb tChild : childList)
{
if (hasChild(list, tChild))
{
recursionFn(list, tChild);
}
}
}
/**
* 得到子节点列表
*/
private List<BzscCyglqglscCb> getChildList(List<BzscCyglqglscCb> list, BzscCyglqglscCb t)
{
List<BzscCyglqglscCb> tlist = new ArrayList<BzscCyglqglscCb>();
Iterator<BzscCyglqglscCb> it = list.iterator();
while (it.hasNext())
{
BzscCyglqglscCb n = (BzscCyglqglscCb) it.next();
if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().longValue() == t.getID().longValue())
{
tlist.add(n);
}
}
return tlist;
}
/**
* 判断是否有子节点
*/
private boolean hasChild(List<BzscCyglqglscCb> list, BzscCyglqglscCb t)
{
return getChildList(list, t).size() > 0;
}
}
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.SecurityUtils;
import com.qianhe.common.utils.bean.BeanUtils;
import com.qianhe.domain.BzscCyglqglscCb;
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.BzscZczscCb;
import com.qianhe.mapper.BzscZczscZbMapper;
import com.qianhe.domain.BzscZczscZb;
import com.qianhe.service.IBzscZczscZbService;
/**
* 标准手册-注采站管理手册-主Service业务层处理
*
* @author qianhe
* @date 2024-09-11
*/
@Service
public class BzscZczscZbServiceImpl implements IBzscZczscZbService
{
@Autowired
private BzscZczscZbMapper bzscZczscZbMapper;
/**
* 查询标准手册-注采站管理手册-主
*
* @param ID 标准手册-注采站管理手册-主主键
* @return 标准手册-注采站管理手册-主
*/
@Override
public BzscZczscZb selectBzscZczscZbByID(Long ID)
{
BzscZczscZb bzscZczscZb = bzscZczscZbMapper.selectBzscZczscZbByID(ID);
//查询从表
List<BzscZczscCb> cbList=bzscZczscZbMapper.selectBzscZczscCbByID(ID);
bzscZczscZb.setBzscZczscCbList(buildDeptTree(cbList));
return bzscZczscZb;
}
/**
* 查询标准手册-注采站管理手册-主列表
*
* @param bzscZczscZb 标准手册-注采站管理手册-主
* @return 标准手册-注采站管理手册-主
*/
@Override
@DataScope(deptAlias = "d")
public List<BzscZczscZb> selectBzscZczscZbList(BzscZczscZb bzscZczscZb)
{
return bzscZczscZbMapper.selectBzscZczscZbList(bzscZczscZb);
}
/**
* 新增标准手册-注采站管理手册-主
*
* @param bzscZczscZb 标准手册-注采站管理手册-主
* @return 结果
*/
@Transactional
@Override
public int insertBzscZczscZb(BzscZczscZb bzscZczscZb)
{
bzscZczscZb.setCreateTime(DateUtils.getNowDate());
bzscZczscZb.setCreateBy(SecurityUtils.getUsername());
int rows = bzscZczscZbMapper.insertBzscZczscZb(bzscZczscZb);
insertBzscZczscCb(bzscZczscZb);
return rows;
}
/**
* 修改标准手册-注采站管理手册-主
*
* @param bzscZczscZb 标准手册-注采站管理手册-主
* @return 结果
*/
@Transactional
@Override
public int updateBzscZczscZb(BzscZczscZb bzscZczscZb)
{
bzscZczscZb.setUpdateTime(DateUtils.getNowDate());
bzscZczscZb.setUpdateBy(SecurityUtils.getUsername());
bzscZczscZbMapper.deleteBzscZczscCbByZbId(bzscZczscZb.getID());
insertBzscZczscCb(bzscZczscZb);
return bzscZczscZbMapper.updateBzscZczscZb(bzscZczscZb);
}
/**
* 批量删除标准手册-注采站管理手册-主
*
* @param IDs 需要删除的标准手册-注采站管理手册-主主键
* @return 结果
*/
@Transactional
@Override
public int deleteBzscZczscZbByIDs(Long[] IDs)
{
bzscZczscZbMapper.deleteBzscZczscCbByZbIds(IDs);
return bzscZczscZbMapper.deleteBzscZczscZbByIDs(IDs);
}
/**
* 删除标准手册-注采站管理手册-主信息
*
* @param ID 标准手册-注采站管理手册-主主键
* @return 结果
*/
@Transactional
@Override
public int deleteBzscZczscZbByID(Long ID)
{
bzscZczscZbMapper.deleteBzscZczscCbByZbId(ID);
return bzscZczscZbMapper.deleteBzscZczscZbByID(ID);
}
/**
* 新增标准手册-注采站管理手册-从信息
*
* @param bzscZczscZb 标准手册-注采站管理手册-主对象
*/
public void insertBzscZczscCb(BzscZczscZb bzscZczscZb)
{
List<BzscZczscCb> bzscZczscCbList = bzscZczscZb.getBzscZczscCbList();
Long ID = bzscZczscZb.getID();
if (StringUtils.isNotNull(bzscZczscCbList))
{
// List<BzscZczscCb> list = new ArrayList<BzscZczscCb>();
for (BzscZczscCb bzscZczscCb : bzscZczscCbList)
{
bzscZczscCb.setZbId(ID);
bzscZczscCb.setZbId(ID);
bzscZczscCb.setParentId(0L);
bzscZczscZbMapper.insertBzscZczscCb(bzscZczscCb);
if(StringUtils.isNotNull(bzscZczscCb.getChildList())){
for(BzscZczscCb cb1:bzscZczscCb.getChildList()){
cb1.setZbId(ID);
cb1.setParentId(bzscZczscCb.getID());
bzscZczscZbMapper.insertBzscZczscCb(cb1);
if(cb1.getChildList().size()>0){
for(BzscZczscCb cb2:cb1.getChildList()){
cb2.setZbId(ID);
cb2.setParentId(cb1.getID());
bzscZczscZbMapper.insertBzscZczscCb(cb2);
}
}else {
//一级分类没有子级 则本身添加一条子级
BzscZczscCb cb2 =new BzscZczscCb();
BeanUtils.copyProperties(cb1,cb2);
cb2.setZbId(ID);
cb2.setParentId(cb1.getID());
bzscZczscZbMapper.insertBzscZczscCb(cb2);
}
}
}
// list.add(bzscZczscCb);
}
// if (list.size() > 0)
// {
// bzscZczscZbMapper.batchBzscZczscCb(list);
// }
}
}
public List<BzscZczscCb> buildDeptTree(List<BzscZczscCb> cbList)
{
List<BzscZczscCb> returnList = new ArrayList<BzscZczscCb>();
List<Long> tempList = cbList.stream().map(BzscZczscCb::getID).collect(Collectors.toList());
for (BzscZczscCb cb : cbList)
{
// 如果是顶级节点, 遍历该父节点的所有子节点
if (!tempList.contains(cb.getParentId()))
{
recursionFn(cbList, cb);
returnList.add(cb);
}
}
if (returnList.isEmpty())
{
returnList = cbList;
}
return returnList;
}
/**
* 递归列表
*/
private void recursionFn(List<BzscZczscCb> list, BzscZczscCb t)
{
// 得到子节点列表
List<BzscZczscCb> childList = getChildList(list, t);
t.setChildList(childList);
for (BzscZczscCb tChild : childList)
{
if (hasChild(list, tChild))
{
recursionFn(list, tChild);
}
}
}
/**
* 得到子节点列表
*/
private List<BzscZczscCb> getChildList(List<BzscZczscCb> list, BzscZczscCb t)
{
List<BzscZczscCb> tlist = new ArrayList<BzscZczscCb>();
Iterator<BzscZczscCb> it = list.iterator();
while (it.hasNext())
{
BzscZczscCb n = (BzscZczscCb) it.next();
if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().longValue() == t.getID().longValue())
{
tlist.add(n);
}
}
return tlist;
}
/**
* 判断是否有子节点
*/
private boolean hasChild(List<BzscZczscCb> list, BzscZczscCb t)
{
return getChildList(list, t).size() > 0;
}
}
<?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.BzscCyglqglscZbMapper">
<resultMap type="BzscCyglqglscZb" id="BzscCyglqglscZbResult">
<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="BzscCyglqglscZbBzscCyglqglscCbResult" type="BzscCyglqglscZb" extends="BzscCyglqglscZbResult">
<collection property="bzscCyglqglscCbList" notNullColumn="sub_ID" javaType="java.util.List" resultMap="BzscCyglqglscCbResult" />
</resultMap>
<resultMap type="BzscCyglqglscCb" id="BzscCyglqglscCbResult">
<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="selectBzscCyglqglscZbVo">
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,d.dept_name
from bzsc_cyglqglsc_zb a
left join sys_dept d on a.dept_id=d.dept_id
</sql>
<select id="selectBzscCyglqglscZbList" parameterType="BzscCyglqglscZb" resultMap="BzscCyglqglscZbResult">
<include refid="selectBzscCyglqglscZbVo"/>
<where>
<if test="deptId != null "> and (a.dept_id = #{deptId} or find_in_set(#{deptId},d.ancestors))</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="selectBzscCyglqglscZbByID" parameterType="Long" resultMap="BzscCyglqglscZbResult">
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_cyglqglsc_zb a
where a.ID = #{ID}
</select>
<select id="selectBzscCyglqglscCbByZbId" resultType="com.qianhe.domain.BzscCyglqglscCb">
select *from bzsc_cyglqglsc_cb where zb_id=#{ID} order by px
</select>
<insert id="insertBzscCyglqglscZb" parameterType="BzscCyglqglscZb" useGeneratedKeys="true" keyProperty="ID">
insert into bzsc_cyglqglsc_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="updateBzscCyglqglscZb" parameterType="BzscCyglqglscZb">
update bzsc_cyglqglsc_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="deleteBzscCyglqglscZbByID" parameterType="Long">
delete from bzsc_cyglqglsc_zb where ID = #{ID}
</delete>
<delete id="deleteBzscCyglqglscZbByIDs" parameterType="String">
delete from bzsc_cyglqglsc_zb where ID in
<foreach item="ID" collection="array" open="(" separator="," close=")">
#{ID}
</foreach>
</delete>
<delete id="deleteBzscCyglqglscCbByZbIds" parameterType="String">
delete from bzsc_cyglqglsc_cb where zb_id in
<foreach item="zbId" collection="array" open="(" separator="," close=")">
#{zbId}
</foreach>
</delete>
<delete id="deleteBzscCyglqglscCbByZbId" parameterType="Long">
delete from bzsc_cyglqglsc_cb where zb_id = #{zbId}
</delete>
<insert id="batchBzscCyglqglscCb">
insert into bzsc_cyglqglsc_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="insertBzscCyglqglscCb" parameterType="BzscCyglqglscCb" useGeneratedKeys="true" keyProperty="ID">
insert into bzsc_cyglqglsc_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
<?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.BzscZczscZbMapper">
<resultMap type="BzscZczscZb" id="BzscZczscZbResult">
<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="BzscZczscZbBzscZczscCbResult" type="BzscZczscZb" extends="BzscZczscZbResult">
<collection property="bzscZczscCbList" notNullColumn="sub_ID" javaType="java.util.List" resultMap="BzscZczscCbResult" />
</resultMap>
<resultMap type="BzscZczscCb" id="BzscZczscCbResult">
<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="selectBzscZczscZbVo">
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,d.dept_name from bzsc_zczsc_zb a
left join sys_dept d on a.dept_id=d.dept_id
</sql>
<select id="selectBzscZczscZbList" parameterType="BzscZczscZb" resultMap="BzscZczscZbResult">
<include refid="selectBzscZczscZbVo"/>
<where>
<if test="deptId != null "> and (a.dept_id = #{deptId} or find_in_set(#{deptId},d.ancestors))</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="selectBzscZczscZbByID" parameterType="Long" resultMap="BzscZczscZbResult">
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_zczsc_zb a
where a.ID = #{ID}
</select>
<select id="selectBzscZczscCbByID" resultType="com.qianhe.domain.BzscZczscCb">
select *from bzsc_zczsc_cb where zb_id=#{ID} order by px
</select>
<insert id="insertBzscZczscZb" parameterType="BzscZczscZb" useGeneratedKeys="true" keyProperty="ID">
insert into bzsc_zczsc_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="updateBzscZczscZb" parameterType="BzscZczscZb">
update bzsc_zczsc_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="deleteBzscZczscZbByID" parameterType="Long">
delete from bzsc_zczsc_zb where ID = #{ID}
</delete>
<delete id="deleteBzscZczscZbByIDs" parameterType="String">
delete from bzsc_zczsc_zb where ID in
<foreach item="ID" collection="array" open="(" separator="," close=")">
#{ID}
</foreach>
</delete>
<delete id="deleteBzscZczscCbByZbIds" parameterType="String">
delete from bzsc_zczsc_cb where zb_id in
<foreach item="zbId" collection="array" open="(" separator="," close=")">
#{zbId}
</foreach>
</delete>
<delete id="deleteBzscZczscCbByZbId" parameterType="Long">
delete from bzsc_zczsc_cb where zb_id = #{zbId}
</delete>
<insert id="batchBzscZczscCb">
insert into bzsc_zczsc_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="insertBzscZczscCb">
insert into bzsc_zczsc_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