Pre Merge pull request !345 from 温宏建/sys_post_whj
This commit is contained in:
commit
144fb01926
|
|
@ -0,0 +1,118 @@
|
|||
package com.ruoyi.system.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.ruoyi.system.api.domain.SysDept;
|
||||
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.ruoyi.common.log.annotation.Log;
|
||||
import com.ruoyi.common.log.enums.BusinessType;
|
||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||
import com.ruoyi.system.domain.SysDuty;
|
||||
import com.ruoyi.system.service.ISysDutyService;
|
||||
import com.ruoyi.common.core.web.controller.BaseController;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.web.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 职称Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2023-10-29
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/duty")
|
||||
public class SysDutyController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysDutyService sysDutyService;
|
||||
|
||||
/**
|
||||
* 查询职称列表
|
||||
*/
|
||||
@RequiresPermissions("system:duty:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysDuty sysDuty)
|
||||
{
|
||||
startPage();
|
||||
List<SysDuty> list = sysDutyService.selectSysDutyList(sysDuty);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出职称列表
|
||||
*/
|
||||
@RequiresPermissions("system:duty:export")
|
||||
@Log(title = "职称", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, SysDuty sysDuty)
|
||||
{
|
||||
List<SysDuty> list = sysDutyService.selectSysDutyList(sysDuty);
|
||||
ExcelUtil<SysDuty> util = new ExcelUtil<SysDuty>(SysDuty.class);
|
||||
util.exportExcel(response, list, "职称数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取职称详细信息
|
||||
*/
|
||||
@RequiresPermissions("system:duty:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(sysDutyService.selectSysDutyById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增职称
|
||||
*/
|
||||
@RequiresPermissions("system:duty:add")
|
||||
@Log(title = "职称", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SysDuty sysDuty)
|
||||
{
|
||||
return toAjax(sysDutyService.insertSysDuty(sysDuty));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改职称
|
||||
*/
|
||||
@RequiresPermissions("system:duty:edit")
|
||||
@Log(title = "职称", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SysDuty sysDuty)
|
||||
{
|
||||
return toAjax(sysDutyService.updateSysDuty(sysDuty));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除职称
|
||||
*/
|
||||
@RequiresPermissions("system:duty:remove")
|
||||
@Log(title = "职称", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(sysDutyService.deleteSysDutyByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取对应角色部门树列表
|
||||
*/
|
||||
@RequiresPermissions("system:duty:list")
|
||||
@GetMapping(value = "/dutyTree")
|
||||
public AjaxResult deptTree() {
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("dutys", sysDutyService.selectDutyTreeList());
|
||||
return ajax;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,167 @@
|
|||
package com.ruoyi.system.domain;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.core.annotation.Excel;
|
||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 职称对象 sys_duty
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2023-10-29
|
||||
*/
|
||||
public class SysDuty extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键id */
|
||||
private Long id;
|
||||
|
||||
/** 父职称id */
|
||||
@Excel(name = "父职称id")
|
||||
private Long parentId;
|
||||
|
||||
/** 祖级列表 */
|
||||
private String ancestors;
|
||||
|
||||
/** 编码 */
|
||||
@Excel(name = "编码")
|
||||
private String code;
|
||||
|
||||
/** 名称 */
|
||||
@Excel(name = "名称")
|
||||
private String name;
|
||||
|
||||
/** 职级 */
|
||||
@Excel(name = "职级")
|
||||
private Integer level;
|
||||
|
||||
/** 删除标志(0代表存在 2代表删除) */
|
||||
private String delFlag;
|
||||
|
||||
/** 创建时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date createTime;
|
||||
|
||||
/** 更新时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date updateTime;
|
||||
|
||||
/** 子部门 */
|
||||
private List<SysDuty> children = new ArrayList<>();
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setParentId(Long parentId)
|
||||
{
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
public Long getParentId()
|
||||
{
|
||||
return parentId;
|
||||
}
|
||||
public void setAncestors(String ancestors)
|
||||
{
|
||||
this.ancestors = ancestors;
|
||||
}
|
||||
|
||||
public String getAncestors()
|
||||
{
|
||||
return ancestors;
|
||||
}
|
||||
public void setCode(String code)
|
||||
{
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getCode()
|
||||
{
|
||||
return code;
|
||||
}
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
public void setLevel(Integer level)
|
||||
{
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
public Integer getLevel()
|
||||
{
|
||||
return level;
|
||||
}
|
||||
public void setDelFlag(String delFlag)
|
||||
{
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
public String getDelFlag()
|
||||
{
|
||||
return delFlag;
|
||||
}
|
||||
public void setCreateTime(Date createTime)
|
||||
{
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public Date getCreateTime()
|
||||
{
|
||||
return createTime;
|
||||
}
|
||||
public void setUpdateTime(Date updateTime)
|
||||
{
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
public Date getUpdateTime()
|
||||
{
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public List<SysDuty> getChildren() {
|
||||
return children;
|
||||
}
|
||||
|
||||
public void setChildren(List<SysDuty> children) {
|
||||
this.children = children;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("parentId", getParentId())
|
||||
.append("ancestors", getAncestors())
|
||||
.append("code", getCode())
|
||||
.append("name", getName())
|
||||
.append("level", getLevel())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("delFlag", getDelFlag())
|
||||
.append("createDate", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateDate", getUpdateTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -30,6 +30,18 @@ public class SysPost extends BaseEntity
|
|||
@Excel(name = "岗位名称")
|
||||
private String postName;
|
||||
|
||||
/** 岗位职级Id */
|
||||
@Excel(name = "岗位职级Id")
|
||||
private Long dutyId;
|
||||
|
||||
/** 岗位职级编码 */
|
||||
@Excel(name = "岗位职级编码")
|
||||
private String dutyCode;
|
||||
|
||||
/** 岗位职级名称 */
|
||||
@Excel(name = "岗位职级名称")
|
||||
private String dutyName;
|
||||
|
||||
/** 岗位排序 */
|
||||
@Excel(name = "岗位排序")
|
||||
private Integer postSort;
|
||||
|
|
@ -86,6 +98,30 @@ public class SysPost extends BaseEntity
|
|||
this.postSort = postSort;
|
||||
}
|
||||
|
||||
public Long getDutyId() {
|
||||
return dutyId;
|
||||
}
|
||||
|
||||
public void setDutyId(Long dutyId) {
|
||||
this.dutyId = dutyId;
|
||||
}
|
||||
|
||||
public String getDutyCode() {
|
||||
return dutyCode;
|
||||
}
|
||||
|
||||
public void setDutyCode(String dutyCode) {
|
||||
this.dutyCode = dutyCode;
|
||||
}
|
||||
|
||||
public String getDutyName() {
|
||||
return dutyName;
|
||||
}
|
||||
|
||||
public void setDutyName(String dutyName) {
|
||||
this.dutyName = dutyName;
|
||||
}
|
||||
|
||||
public String getStatus()
|
||||
{
|
||||
return status;
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import java.util.List;
|
|||
import java.util.stream.Collectors;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.ruoyi.system.api.domain.SysDept;
|
||||
import com.ruoyi.system.domain.SysDuty;
|
||||
import com.ruoyi.system.domain.SysMenu;
|
||||
|
||||
/**
|
||||
|
|
@ -45,6 +46,13 @@ public class TreeSelect implements Serializable
|
|||
this.children = menu.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public TreeSelect(SysDuty duty)
|
||||
{
|
||||
this.id = duty.getId();
|
||||
this.label = duty.getName();
|
||||
this.children = duty.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,61 @@
|
|||
package com.ruoyi.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.SysDuty;
|
||||
|
||||
/**
|
||||
* 职称Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2023-10-29
|
||||
*/
|
||||
public interface SysDutyMapper
|
||||
{
|
||||
/**
|
||||
* 查询职称
|
||||
*
|
||||
* @param id 职称主键
|
||||
* @return 职称
|
||||
*/
|
||||
public SysDuty selectSysDutyById(Long id);
|
||||
|
||||
/**
|
||||
* 查询职称列表
|
||||
*
|
||||
* @param sysDuty 职称
|
||||
* @return 职称集合
|
||||
*/
|
||||
public List<SysDuty> selectSysDutyList(SysDuty sysDuty);
|
||||
|
||||
/**
|
||||
* 新增职称
|
||||
*
|
||||
* @param sysDuty 职称
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertSysDuty(SysDuty sysDuty);
|
||||
|
||||
/**
|
||||
* 修改职称
|
||||
*
|
||||
* @param sysDuty 职称
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateSysDuty(SysDuty sysDuty);
|
||||
|
||||
/**
|
||||
* 删除职称
|
||||
*
|
||||
* @param id 职称主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysDutyById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除职称
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysDutyByIds(Long[] ids);
|
||||
}
|
||||
|
|
@ -0,0 +1,88 @@
|
|||
package com.ruoyi.system.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.system.api.domain.SysDept;
|
||||
import com.ruoyi.system.domain.SysDuty;
|
||||
import com.ruoyi.system.domain.vo.TreeSelect;
|
||||
|
||||
/**
|
||||
* 职称Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2023-10-29
|
||||
*/
|
||||
public interface ISysDutyService
|
||||
{
|
||||
/**
|
||||
* 查询职称
|
||||
*
|
||||
* @param id 职称主键
|
||||
* @return 职称
|
||||
*/
|
||||
public SysDuty selectSysDutyById(Long id);
|
||||
|
||||
/**
|
||||
* 查询职称列表
|
||||
*
|
||||
* @param sysDuty 职称
|
||||
* @return 职称集合
|
||||
*/
|
||||
public List<SysDuty> selectSysDutyList(SysDuty sysDuty);
|
||||
|
||||
/**
|
||||
* 新增职称
|
||||
*
|
||||
* @param sysDuty 职称
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertSysDuty(SysDuty sysDuty);
|
||||
|
||||
/**
|
||||
* 修改职称
|
||||
*
|
||||
* @param sysDuty 职称
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateSysDuty(SysDuty sysDuty);
|
||||
|
||||
/**
|
||||
* 批量删除职称
|
||||
*
|
||||
* @param ids 需要删除的职称主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysDutyByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除职称信息
|
||||
*
|
||||
* @param id 职称主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysDutyById(Long id);
|
||||
|
||||
/**
|
||||
* 查询职称树结构信息
|
||||
*
|
||||
* @return 职称树信息集合
|
||||
*/
|
||||
public List<TreeSelect> selectDutyTreeList();
|
||||
|
||||
/**
|
||||
* 构建前端所需要下拉树结构
|
||||
*
|
||||
* @param dutys 职称列表
|
||||
* @return 下拉树结构列表
|
||||
*/
|
||||
public List<TreeSelect> buildDutyTreeSelect(List<SysDuty> dutys);
|
||||
|
||||
|
||||
/**
|
||||
* 构建前端所需要树结构
|
||||
*
|
||||
* @param dutys 职称列表
|
||||
* @return 树结构列表
|
||||
*/
|
||||
public List<SysDuty> buildDutyTree(List<SysDuty> dutys);
|
||||
}
|
||||
|
|
@ -0,0 +1,194 @@
|
|||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.ruoyi.common.core.utils.SpringUtils;
|
||||
import com.ruoyi.common.core.utils.StringUtils;
|
||||
import com.ruoyi.system.domain.vo.TreeSelect;
|
||||
import com.ruoyi.system.mapper.SysDutyMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.system.domain.SysDuty;
|
||||
import com.ruoyi.system.service.ISysDutyService;
|
||||
|
||||
/**
|
||||
* 职称Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2023-10-29
|
||||
*/
|
||||
@Service
|
||||
public class SysDutyServiceImpl implements ISysDutyService
|
||||
{
|
||||
@Autowired
|
||||
private SysDutyMapper sysDutyMapper;
|
||||
|
||||
/**
|
||||
* 查询职称
|
||||
*
|
||||
* @param id 职称主键
|
||||
* @return 职称
|
||||
*/
|
||||
@Override
|
||||
public SysDuty selectSysDutyById(Long id)
|
||||
{
|
||||
return sysDutyMapper.selectSysDutyById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询职称列表
|
||||
*
|
||||
* @param sysDuty 职称
|
||||
* @return 职称
|
||||
*/
|
||||
@Override
|
||||
public List<SysDuty> selectSysDutyList(SysDuty sysDuty)
|
||||
{
|
||||
return sysDutyMapper.selectSysDutyList(sysDuty);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增职称
|
||||
*
|
||||
* @param sysDuty 职称
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertSysDuty(SysDuty sysDuty)
|
||||
{
|
||||
return sysDutyMapper.insertSysDuty(sysDuty);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改职称
|
||||
*
|
||||
* @param sysDuty 职称
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateSysDuty(SysDuty sysDuty)
|
||||
{
|
||||
return sysDutyMapper.updateSysDuty(sysDuty);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除职称
|
||||
*
|
||||
* @param ids 需要删除的职称主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSysDutyByIds(Long[] ids)
|
||||
{
|
||||
return sysDutyMapper.deleteSysDutyByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除职称信息
|
||||
*
|
||||
* @param id 职称主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSysDutyById(Long id)
|
||||
{
|
||||
return sysDutyMapper.deleteSysDutyById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询职称树结构信息
|
||||
*
|
||||
* @return 职称树信息集合
|
||||
*/
|
||||
@Override
|
||||
public List<TreeSelect> selectDutyTreeList() {
|
||||
List<SysDuty> dutys = selectSysDutyList(new SysDuty());
|
||||
return buildDutyTreeSelect(dutys);
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建前端所需要下拉树结构
|
||||
*
|
||||
* @param dutys 职称列表
|
||||
* @return 下拉树结构列表
|
||||
*/
|
||||
@Override
|
||||
public List<TreeSelect> buildDutyTreeSelect(List<SysDuty> dutys)
|
||||
{
|
||||
List<SysDuty> deptTrees = buildDutyTree(dutys);
|
||||
return deptTrees.stream().map(TreeSelect::new).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建前端所需要树结构
|
||||
*
|
||||
* @param dutys 职称列表
|
||||
* @return 树结构列表
|
||||
*/
|
||||
@Override
|
||||
public List<SysDuty> buildDutyTree(List<SysDuty> dutys)
|
||||
{
|
||||
List<SysDuty> returnList = new ArrayList<>();
|
||||
List<Long> tempList = dutys.stream().map(SysDuty::getId).collect(Collectors.toList());
|
||||
for (SysDuty duty : dutys)
|
||||
{
|
||||
// 如果是顶级节点, 遍历该父节点的所有子节点
|
||||
if (!tempList.contains(duty.getParentId()))
|
||||
{
|
||||
recursionFn(dutys, duty);
|
||||
returnList.add(duty);
|
||||
}
|
||||
}
|
||||
if (returnList.isEmpty())
|
||||
{
|
||||
returnList = dutys;
|
||||
}
|
||||
return returnList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归列表
|
||||
*/
|
||||
private void recursionFn(List<SysDuty> list, SysDuty t)
|
||||
{
|
||||
// 得到子节点列表
|
||||
List<SysDuty> childList = getChildList(list, t);
|
||||
t.setChildren(childList);
|
||||
for (SysDuty tChild : childList)
|
||||
{
|
||||
if (hasChild(list, tChild))
|
||||
{
|
||||
recursionFn(list, tChild);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 得到子节点列表
|
||||
*/
|
||||
private List<SysDuty> getChildList(List<SysDuty> list, SysDuty t)
|
||||
{
|
||||
List<SysDuty> tlist = new ArrayList<>();
|
||||
Iterator<SysDuty> it = list.iterator();
|
||||
while (it.hasNext())
|
||||
{
|
||||
SysDuty n = it.next();
|
||||
if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().longValue() == t.getId().longValue())
|
||||
{
|
||||
tlist.add(n);
|
||||
}
|
||||
}
|
||||
return tlist;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否有子节点
|
||||
*/
|
||||
private boolean hasChild(List<SysDuty> list, SysDuty t)
|
||||
{
|
||||
return getChildList(list, t).size() > 0 ? true : false;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,99 @@
|
|||
<?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.ruoyi.system.mapper.SysDutyMapper">
|
||||
|
||||
<resultMap type="SysDuty" id="SysDutyResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="parentId" column="parent_id" />
|
||||
<result property="ancestors" column="ancestors" />
|
||||
<result property="code" column="code" />
|
||||
<result property="name" column="name" />
|
||||
<result property="level" column="level" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSysDutyVo">
|
||||
select id, parent_id, ancestors, code, name, level, create_by, del_flag, create_time, update_by, update_time from sys_duty
|
||||
</sql>
|
||||
|
||||
<select id="selectSysDutyList" parameterType="SysDuty" resultMap="SysDutyResult">
|
||||
<include refid="selectSysDutyVo"/>
|
||||
<where>
|
||||
<if test="parentId != null "> and parent_id = #{parentId}</if>
|
||||
<if test="code != null and code != ''"> and code = #{code}</if>
|
||||
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||
<if test="level != null "> and level = #{level}</if>
|
||||
<if test="createTime != null "> and create_time = #{createTime}</if>
|
||||
<if test="updateTime != null "> and update_time = #{updateTime}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectSysDutyById" parameterType="Long" resultMap="SysDutyResult">
|
||||
<include refid="selectSysDutyVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertSysDuty" parameterType="SysDuty">
|
||||
insert into sys_duty
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">id,</if>
|
||||
<if test="parentId != null">parent_id,</if>
|
||||
<if test="ancestors != null">ancestors,</if>
|
||||
<if test="code != null">code,</if>
|
||||
<if test="name != null">name,</if>
|
||||
<if test="level != null">level,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="delFlag != null">del_flag,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
<if test="parentId != null">#{parentId},</if>
|
||||
<if test="ancestors != null">#{ancestors},</if>
|
||||
<if test="code != null">#{code},</if>
|
||||
<if test="name != null">#{name},</if>
|
||||
<if test="level != null">#{level},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="delFlag != null">#{delFlag},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateSysDuty" parameterType="SysDuty">
|
||||
update sys_duty
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="parentId != null">parent_id = #{parentId},</if>
|
||||
<if test="ancestors != null">ancestors = #{ancestors},</if>
|
||||
<if test="code != null">code = #{code},</if>
|
||||
<if test="name != null">name = #{name},</if>
|
||||
<if test="level != null">level = #{level},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="delFlag != null">del_flag = #{delFlag},</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>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteSysDutyById" parameterType="Long">
|
||||
update sys_duty set del_flag = '2' where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteSysDutyByIds" parameterType="String">
|
||||
update sys_duty set del_flag = '2' where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
|
|
@ -9,6 +9,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="postCode" column="post_code" />
|
||||
<result property="postName" column="post_name" />
|
||||
<result property="postSort" column="post_sort" />
|
||||
<result property="dutyId" column="duty_id" />
|
||||
<result property="status" column="status" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
|
|
@ -18,32 +19,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</resultMap>
|
||||
|
||||
<sql id="selectPostVo">
|
||||
select post_id, post_code, post_name, post_sort, status, create_by, create_time, remark
|
||||
from sys_post
|
||||
select a.post_id as postId, a.post_code as postCode, a.post_name as postName, a.post_sort as postSort, a.duty_id as dutyId, b.code as dutyCode, b.name as dutyName, a.status, a.create_by as createBy, a.create_time as createTime, a.remark
|
||||
from sys_post a left join sys_duty b on a.duty_id = b.id
|
||||
</sql>
|
||||
|
||||
<select id="selectPostList" parameterType="SysPost" resultMap="SysPostResult">
|
||||
<select id="selectPostList" parameterType="SysPost" resultType="SysPost">
|
||||
<include refid="selectPostVo"/>
|
||||
<where>
|
||||
<if test="postCode != null and postCode != ''">
|
||||
AND post_code like concat('%', #{postCode}, '%')
|
||||
AND a.post_code like concat('%', #{postCode}, '%')
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
AND status = #{status}
|
||||
AND a.status = #{status}
|
||||
</if>
|
||||
<if test="postName != null and postName != ''">
|
||||
AND post_name like concat('%', #{postName}, '%')
|
||||
AND a.post_name like concat('%', #{postName}, '%')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectPostAll" resultMap="SysPostResult">
|
||||
<select id="selectPostAll" resultType="SysPost">
|
||||
<include refid="selectPostVo"/>
|
||||
</select>
|
||||
|
||||
<select id="selectPostById" parameterType="Long" resultMap="SysPostResult">
|
||||
<select id="selectPostById" parameterType="Long" resultType="SysPost">
|
||||
<include refid="selectPostVo"/>
|
||||
where post_id = #{postId}
|
||||
where a.post_id = #{postId}
|
||||
</select>
|
||||
|
||||
<select id="selectPostListByUserId" parameterType="Long" resultType="Long">
|
||||
|
|
@ -63,13 +64,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</select>
|
||||
|
||||
<select id="checkPostNameUnique" parameterType="String" resultMap="SysPostResult">
|
||||
<include refid="selectPostVo"/>
|
||||
where post_name=#{postName} limit 1
|
||||
select a.post_id, a.post_code, a.post_name, a.post_sort, a.duty_id, a.status, a.create_by, a.create_time, a.remark
|
||||
from sys_post a
|
||||
where a.post_name=#{postName} limit 1
|
||||
</select>
|
||||
|
||||
<select id="checkPostCodeUnique" parameterType="String" resultMap="SysPostResult">
|
||||
<include refid="selectPostVo"/>
|
||||
where post_code=#{postCode} limit 1
|
||||
select a.post_id, a.post_code, a.post_name, a.post_sort, a.duty_id, a.status, a.create_by, a.create_time, a.remark
|
||||
from sys_post a
|
||||
where a.post_code=#{postCode} limit 1
|
||||
</select>
|
||||
|
||||
<update id="updatePost" parameterType="SysPost">
|
||||
|
|
@ -78,6 +81,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="postCode != null and postCode != ''">post_code = #{postCode},</if>
|
||||
<if test="postName != null and postName != ''">post_name = #{postName},</if>
|
||||
<if test="postSort != null">post_sort = #{postSort},</if>
|
||||
<if test="dutyId != null">duty_id = #{dutyId},</if>
|
||||
<if test="status != null and status != ''">status = #{status},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||
|
|
@ -92,6 +96,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="postCode != null and postCode != ''">post_code,</if>
|
||||
<if test="postName != null and postName != ''">post_name,</if>
|
||||
<if test="postSort != null">post_sort,</if>
|
||||
<if test="dutyId != null and dutyId != ''">duty_id,</if>
|
||||
<if test="status != null and status != ''">status,</if>
|
||||
<if test="remark != null and remark != ''">remark,</if>
|
||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
|
|
@ -101,6 +106,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="postCode != null and postCode != ''">#{postCode},</if>
|
||||
<if test="postName != null and postName != ''">#{postName},</if>
|
||||
<if test="postSort != null">#{postSort},</if>
|
||||
<if test="dutyId != null and dutyId != ''">#{dutyId},</if>
|
||||
<if test="status != null and status != ''">#{status},</if>
|
||||
<if test="remark != null and remark != ''">#{remark},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
|
|
|
|||
Loading…
Reference in New Issue