成套机具代码提交
This commit is contained in:
parent
3ac38557af
commit
d293399415
|
|
@ -1,6 +1,7 @@
|
|||
package com.bonus.sgzb.app.controller;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.bonus.sgzb.app.domain.StorageStatus;
|
||||
import com.bonus.sgzb.app.service.HoldingLedgerService;
|
||||
import com.bonus.sgzb.base.api.domain.LeaseOutDetails;
|
||||
import com.bonus.sgzb.common.core.web.controller.BaseController;
|
||||
|
|
@ -30,9 +31,8 @@ public class CompositeQueryController extends BaseController {
|
|||
*/
|
||||
@Log(title = "抱杆台账查询", businessType = BusinessType.UPDATE)
|
||||
@GetMapping("/getHoldingLedger")
|
||||
public AjaxResult getHoldingLedger() {
|
||||
public AjaxResult getHoldingLedger(StorageStatus storageStatus) {
|
||||
startPage();
|
||||
return AjaxResult.success(getDataTable(holdingLedgerService.getHoldingLedger()));
|
||||
return AjaxResult.success(getDataTable(holdingLedgerService.getHoldingLedger(storageStatus)));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,210 @@
|
|||
package com.bonus.sgzb.app.domain;
|
||||
|
||||
import com.bonus.sgzb.common.core.annotation.Excel;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description 综合查询--成套抱杆查询
|
||||
* @author hay
|
||||
* @date 2024/2/26 14:51
|
||||
*/
|
||||
@ApiModel(description = "成套抱杆查询")
|
||||
@Data
|
||||
public class StorageStatus {
|
||||
|
||||
private static final long serialVersionUID = 2227217051604273598L;
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 协议号
|
||||
*/
|
||||
@ApiModelProperty(value = "协议号")
|
||||
private String agreementCode;
|
||||
|
||||
|
||||
/**
|
||||
* 类型名称
|
||||
*/
|
||||
@ApiModelProperty(value = "类型名称")
|
||||
@Excel(name = "机具名称")
|
||||
private String typeName;
|
||||
|
||||
/**
|
||||
* 规格ID
|
||||
*/
|
||||
@ApiModelProperty(value = "规格ID")
|
||||
private Integer typeId;
|
||||
|
||||
/**
|
||||
* 规格型号
|
||||
*/
|
||||
@ApiModelProperty(value = "规格型号")
|
||||
@Excel(name = "规格名称")
|
||||
private String typeModelName;
|
||||
|
||||
/**
|
||||
* 计量单位
|
||||
*/
|
||||
@ApiModelProperty(value = "计量单位")
|
||||
@Excel(name = "单位")
|
||||
private String unit;
|
||||
|
||||
/**
|
||||
* 在库数量
|
||||
*/
|
||||
@ApiModelProperty(value = "在库数量")
|
||||
@Excel(name = "在库数量",cellType = Excel.ColumnType.NUMERIC)
|
||||
private Double num;
|
||||
|
||||
/**
|
||||
* 在用数量
|
||||
*/
|
||||
@ApiModelProperty(value = "在用数量")
|
||||
@Excel(name = "在用数量",cellType = Excel.ColumnType.NUMERIC)
|
||||
private Double usNum;
|
||||
|
||||
/**
|
||||
* 在修数量
|
||||
*/
|
||||
@ApiModelProperty(value = "在修数量")
|
||||
@Excel(name = "在修数量",cellType = Excel.ColumnType.NUMERIC)
|
||||
private Double repairNum;
|
||||
|
||||
/**
|
||||
* 修试后待入库
|
||||
*/
|
||||
@ApiModelProperty(value = "修试后待入库")
|
||||
@Excel(name = "修试后待入库",cellType = Excel.ColumnType.NUMERIC)
|
||||
private Double repairInputNum;
|
||||
|
||||
/**
|
||||
* 新购待入库
|
||||
*/
|
||||
@ApiModelProperty(value = "新购待入库")
|
||||
@Excel(name = "新购待入库",cellType = Excel.ColumnType.NUMERIC)
|
||||
private Double inputNum;
|
||||
|
||||
/**
|
||||
* 总保有量
|
||||
*/
|
||||
@ApiModelProperty(value = "总保有量")
|
||||
@Excel(name = "总保有量",cellType = Excel.ColumnType.NUMERIC)
|
||||
private Double allNum;
|
||||
|
||||
/**
|
||||
* 是否计数
|
||||
*/
|
||||
@ApiModelProperty(value = "是否计数")
|
||||
@Excel(name = "是否计数")
|
||||
private String manageType;
|
||||
|
||||
|
||||
/**
|
||||
* 租赁数量
|
||||
*/
|
||||
@ApiModelProperty(value = "租赁数量")
|
||||
@Excel(name = "租赁数量",cellType = Excel.ColumnType.NUMERIC)
|
||||
private Double outNum;
|
||||
|
||||
/**
|
||||
* 归还数量
|
||||
*/
|
||||
@ApiModelProperty(value = "归还数量")
|
||||
@Excel(name = "归还数量",cellType = Excel.ColumnType.NUMERIC)
|
||||
private Double backNum;
|
||||
|
||||
|
||||
/**
|
||||
* 在用总价值
|
||||
*/
|
||||
@ApiModelProperty(value = "在用总价值")
|
||||
private Double usPrice;
|
||||
|
||||
/**
|
||||
* 投入总价值
|
||||
*/
|
||||
@ApiModelProperty(value = "投入总价值")
|
||||
private Double totalPrice;
|
||||
|
||||
/**
|
||||
* 退料人
|
||||
*/
|
||||
@ApiModelProperty(value = "退料人")
|
||||
private String backPerson;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 创建者
|
||||
*/
|
||||
@ApiModelProperty(value = "创建者")
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新者
|
||||
*/
|
||||
@ApiModelProperty(value = "更新者")
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@ApiModelProperty(value = "更新时间 ")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 关键字
|
||||
*/
|
||||
@ApiModelProperty(value = "关键字")
|
||||
private String keyWord;
|
||||
|
||||
@ApiModelProperty(value="开始时间")
|
||||
private String startTime;
|
||||
|
||||
@ApiModelProperty(value="结束时间")
|
||||
private String endTime;
|
||||
|
||||
|
||||
/**
|
||||
* 设备所属类型
|
||||
*/
|
||||
@ApiModelProperty(value = "数据所属组织")
|
||||
private Integer companyId;
|
||||
|
||||
|
||||
/**
|
||||
* 装备管理方式(0编号 1计数)
|
||||
*/
|
||||
@ApiModelProperty(value = "装备管理方式名称")
|
||||
private String manageTypeName;
|
||||
|
||||
@ApiModelProperty(value = "成套机具配件详细")
|
||||
private List<MachinePart> wholeSetDetails;
|
||||
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
package com.bonus.sgzb.app.mapper;
|
||||
|
||||
import com.bonus.sgzb.app.domain.MachinePart;
|
||||
import com.bonus.sgzb.app.domain.StorageStatus;
|
||||
import com.bonus.sgzb.app.domain.TmTask;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
|
|
@ -12,9 +13,7 @@ import java.util.List;
|
|||
*/
|
||||
@Mapper
|
||||
public interface HoldingLedgerMapper {
|
||||
List<TmTask> getHoldingLedger();
|
||||
List<StorageStatus> getHoldingLedger(StorageStatus storageStatus);
|
||||
|
||||
List<TmTask> getHoldingLedgerDetail(TmTask tmTask);
|
||||
|
||||
MachinePart getMachineParts(TmTask typeId);
|
||||
List<MachinePart> getWholeSetDetails(StorageStatus storageStatus);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.bonus.sgzb.app.service;
|
||||
|
||||
import com.bonus.sgzb.app.domain.StorageStatus;
|
||||
import com.bonus.sgzb.app.domain.TmTask;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -9,5 +10,5 @@ import java.util.List;
|
|||
* @date:2024/4/19 - 17:48
|
||||
*/
|
||||
public interface HoldingLedgerService{
|
||||
List<TmTask> getHoldingLedger();
|
||||
List<StorageStatus> getHoldingLedger(StorageStatus storageStatus);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.bonus.sgzb.app.service.impl;
|
||||
|
||||
import com.bonus.sgzb.app.domain.MachinePart;
|
||||
import com.bonus.sgzb.app.domain.StorageStatus;
|
||||
import com.bonus.sgzb.app.domain.TmTask;
|
||||
import com.bonus.sgzb.app.mapper.HoldingLedgerMapper;
|
||||
import com.bonus.sgzb.app.service.HoldingLedgerService;
|
||||
|
|
@ -21,17 +22,14 @@ public class HoldingLedgerImpl implements HoldingLedgerService {
|
|||
private HoldingLedgerMapper holdingLedgerMapper;
|
||||
|
||||
@Override
|
||||
public List<TmTask> getHoldingLedger() {
|
||||
/*List<TmTask> holdingLedger = holdingLedgerMapper.getHoldingLedger();
|
||||
for (TmTask tmTask : holdingLedger) {
|
||||
List<TmTask> holdingLedgerDetail = holdingLedgerMapper.getHoldingLedgerDetail(tmTask);
|
||||
holdingLedgerDetail.removeIf(item -> item == null);
|
||||
for (TmTask typeId : holdingLedgerDetail) {
|
||||
MachinePart machinePart = holdingLedgerMapper.getMachineParts(typeId);
|
||||
machinePart.setPartNum((int) (typeId.getPartNum() * leaseApplyDetail.getPreNum()));
|
||||
machineParts.add(machinePart);
|
||||
public List<StorageStatus> getHoldingLedger(StorageStatus storageStatus) {
|
||||
List<StorageStatus> holdingLedger = holdingLedgerMapper.getHoldingLedger(storageStatus);
|
||||
if (holdingLedger.size() > 0) {
|
||||
for (StorageStatus bean : holdingLedger) {
|
||||
List<MachinePart> wholeSetDetails = holdingLedgerMapper.getWholeSetDetails(bean);
|
||||
bean.setWholeSetDetails(wholeSetDetails);
|
||||
}
|
||||
}*/
|
||||
return null;
|
||||
}
|
||||
return holdingLedger;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,39 +3,144 @@
|
|||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bonus.sgzb.app.mapper.HoldingLedgerMapper">
|
||||
|
||||
<select id="getHoldingLedger" resultType="com.bonus.sgzb.app.domain.TmTask">
|
||||
SELECT
|
||||
mt.type_id as typeId,
|
||||
mt.type_name as typeModelName,
|
||||
mt2.type_name as typeName
|
||||
FROM
|
||||
ma_type mt
|
||||
LEFT JOIN ma_type mt2 on mt.parent_id = mt2.type_id
|
||||
WHERE
|
||||
mt.manage_type = 2
|
||||
AND mt.LEVEL = 4
|
||||
</select>
|
||||
<select id="getHoldingLedgerDetail" resultType="com.bonus.sgzb.app.domain.TmTask">
|
||||
SELECT
|
||||
mws2.type_id AS typeId,
|
||||
mws2.part_num AS partNum
|
||||
FROM
|
||||
ma_type mt1
|
||||
LEFT JOIN ma_whole_set mws2 ON mt1.type_id = mws2.parent_id
|
||||
WHERE
|
||||
mt1.type_id = #{typeId}
|
||||
</select>
|
||||
<select id="getMachineParts" resultType="com.bonus.sgzb.app.domain.MachinePart">
|
||||
<select id="getHoldingLedger" resultType="com.bonus.sgzb.app.domain.StorageStatus">
|
||||
SELECT
|
||||
mt2.type_name AS typeName,
|
||||
mt.type_name AS typeModelName,
|
||||
mt.type_id as modelId,
|
||||
mt.unit_name as unitName,
|
||||
m2.type_name As typeName
|
||||
mt.unit_name AS unit,
|
||||
mt.type_id AS typeId,
|
||||
IFNULL( mt.num, 0 ) AS num,
|
||||
IFNULL( subquery1.usNum, 0 ) AS usNum,
|
||||
IFNULL( subquery2.repairNum, 0 ) AS repairNum,
|
||||
IFNULL( subquery3.repairInputNum, 0 ) AS repairInputNum,
|
||||
IFNULL( subquery4.inputNum, 0 ) AS inputNum,
|
||||
IFNULL( mt.num, 0 ) + IFNULL( subquery1.usNum, 0 ) + IFNULL( subquery2.repairNum, 0 ) + IFNULL( subquery3.repairInputNum, 0 ) AS allNum,
|
||||
CASE
|
||||
mt.manage_type
|
||||
WHEN 0 THEN
|
||||
'否' ELSE '是'
|
||||
END manageType
|
||||
FROM
|
||||
ma_type mt
|
||||
LEFT JOIN ma_type m2 ON mt.parent_id = m2.type_id
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
subquery1.type_id,
|
||||
subquery1.typeName,
|
||||
subquery1.typeModelName,
|
||||
IFNULL( subquery1.outNum, 0 ) AS outNum,
|
||||
IFNULL( subquery2.backNum, 0 ) AS backNum,
|
||||
CASE
|
||||
|
||||
WHEN IFNULL( subquery1.outNum, 0 ) - IFNULL( subquery2.backNum, 0 ) > 0 THEN
|
||||
IFNULL( subquery1.outNum, 0 ) - IFNULL( subquery2.backNum, 0 ) ELSE 0
|
||||
END AS usNum
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
mt.type_id,
|
||||
mt2.type_name AS typeName,
|
||||
mt.type_name AS typeModelName,
|
||||
SUM(
|
||||
IFNULL( lod.out_num, 0 )) AS outNum
|
||||
FROM
|
||||
lease_out_details lod
|
||||
LEFT JOIN ma_type mt ON mt.type_id = lod.type_id
|
||||
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
|
||||
GROUP BY
|
||||
mt.type_id
|
||||
) AS subquery1
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
mt.type_id,
|
||||
mt2.type_name AS typeName,
|
||||
mt.type_name AS typeModelName,
|
||||
SUM(
|
||||
IFNULL( bcd.back_num, 0 )) backNum
|
||||
FROM
|
||||
back_check_details bcd
|
||||
LEFT JOIN ma_type mt ON mt.type_id = bcd.type_id
|
||||
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
|
||||
LEFT JOIN ma_machine mm ON mm.ma_id = bcd.ma_id
|
||||
GROUP BY
|
||||
mt.type_id
|
||||
) AS subquery2 ON subquery1.type_id = subquery2.type_id
|
||||
) AS subquery1 ON mt.type_id = subquery1.type_id
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
mt.type_id,
|
||||
mt2.type_name AS typeName,
|
||||
mt.type_name AS typeModelName,
|
||||
SUM(
|
||||
IFNULL( rad.repair_num, 0 ) - IFNULL( rad.repaired_num, 0 ) - IFNULL( rad.scrap_num, 0 )) AS repairNum
|
||||
FROM
|
||||
repair_apply_details rad
|
||||
LEFT JOIN ma_type mt ON mt.type_id = rad.type_id
|
||||
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
|
||||
WHERE
|
||||
IFNULL( rad.repair_num, 0 ) - IFNULL( rad.repaired_num, 0 ) - IFNULL( rad.scrap_num, 0 ) > 0
|
||||
GROUP BY
|
||||
mt.type_id
|
||||
) AS subquery2 ON subquery2.type_id = mt.type_id
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
mt.type_id,
|
||||
mt2.type_name AS typeName,
|
||||
mt.type_name AS typeModelName,
|
||||
SUM(
|
||||
IFNULL( rid.repair_num, 0 ) - IFNULL( rid.input_num, 0 )) AS repairInputNum
|
||||
FROM
|
||||
repair_input_details rid
|
||||
LEFT JOIN ma_type mt ON mt.type_id = rid.type_id
|
||||
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
|
||||
WHERE
|
||||
IFNULL( rid.repair_num, 0 ) - IFNULL( rid.input_num, 0 ) > 0
|
||||
GROUP BY
|
||||
mt.type_id
|
||||
) AS subquery3 ON subquery3.type_id = mt.type_id
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
mt.type_id,
|
||||
mt2.type_name AS typeName,
|
||||
mt.type_name AS typeModelName,
|
||||
SUM(
|
||||
IFNULL( pcd.check_num, 0 ) - IFNULL( pcd.input_num, 0 )) AS inputNum
|
||||
FROM
|
||||
purchase_check_details pcd
|
||||
LEFT JOIN ma_type mt ON mt.type_id = pcd.type_id
|
||||
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
|
||||
WHERE
|
||||
IFNULL( pcd.check_num, 0 ) - IFNULL( pcd.input_num, 0 ) > 0
|
||||
GROUP BY
|
||||
mt.type_id
|
||||
) AS subquery4 ON subquery4.type_id = mt.type_id
|
||||
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
|
||||
WHERE
|
||||
mt.type_id = #{typeId}
|
||||
mt.`level` = 4
|
||||
AND mt.del_flag = '0'
|
||||
AND mt.manage_type = 2
|
||||
<if test="typeId != null and typeId != ''">
|
||||
and mt.type_id = #{typeId}
|
||||
</if>
|
||||
</select>
|
||||
<select id="getWholeSetDetails" resultType="com.bonus.sgzb.app.domain.MachinePart">
|
||||
SELECT
|
||||
mt2.type_name AS typeModelName,
|
||||
mt2.type_id AS typeId,
|
||||
mt3.type_name AS typeName,
|
||||
aa.part_num AS partNum,
|
||||
mt2.unit_name AS unitName
|
||||
FROM
|
||||
ma_type mt2
|
||||
LEFT JOIN ma_type mt3 ON mt2.parent_id = mt3.type_id
|
||||
INNER JOIN (
|
||||
SELECT
|
||||
mws.type_id,
|
||||
mws.part_num
|
||||
FROM
|
||||
ma_type mt
|
||||
LEFT JOIN ma_whole_set mws ON mt.type_id = mws.parent_id
|
||||
WHERE
|
||||
mt.type_id = #{typeId}
|
||||
) aa ON aa.type_id = mt2.type_id
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -39,8 +39,7 @@ import com.bonus.sgzb.system.service.ISysUserService;
|
|||
*/
|
||||
@RestController
|
||||
@RequestMapping("/role")
|
||||
public class SysRoleController extends BaseController
|
||||
{
|
||||
public class SysRoleController extends BaseController {
|
||||
@Autowired
|
||||
private ISysRoleService roleService;
|
||||
|
||||
|
|
@ -52,8 +51,7 @@ public class SysRoleController extends BaseController
|
|||
|
||||
@RequiresPermissions("system:role:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysRole role)
|
||||
{
|
||||
public TableDataInfo list(SysRole role) {
|
||||
startPage();
|
||||
List<SysRole> list = roleService.selectRoleList(role);
|
||||
return getDataTable(list);
|
||||
|
|
@ -62,8 +60,7 @@ public class SysRoleController extends BaseController
|
|||
@Log(title = "角色管理", businessType = BusinessType.EXPORT)
|
||||
@RequiresPermissions("system:role:export")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, SysRole role)
|
||||
{
|
||||
public void export(HttpServletResponse response, SysRole role) {
|
||||
List<SysRole> list;
|
||||
list = roleService.selectRoleList(role);
|
||||
//根据前端列表选中选择性列表导出
|
||||
|
|
@ -80,8 +77,7 @@ public class SysRoleController extends BaseController
|
|||
*/
|
||||
@RequiresPermissions("system:role:query")
|
||||
@GetMapping(value = "/{roleId}")
|
||||
public AjaxResult getInfo(@PathVariable Long roleId)
|
||||
{
|
||||
public AjaxResult getInfo(@PathVariable Long roleId) {
|
||||
roleService.checkRoleDataScope(roleId);
|
||||
return success(roleService.selectRoleById(roleId));
|
||||
}
|
||||
|
|
@ -92,14 +88,10 @@ public class SysRoleController extends BaseController
|
|||
@RequiresPermissions("system:role:add")
|
||||
@Log(title = "角色管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody SysRole role)
|
||||
{
|
||||
if (!roleService.checkRoleNameUnique(role))
|
||||
{
|
||||
public AjaxResult add(@Validated @RequestBody SysRole role) {
|
||||
if (!roleService.checkRoleNameUnique(role)) {
|
||||
return error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在");
|
||||
}
|
||||
else if (!roleService.checkRoleKeyUnique(role))
|
||||
{
|
||||
} else if (!roleService.checkRoleKeyUnique(role)) {
|
||||
return error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在");
|
||||
}
|
||||
role.setCreateBy(SecurityUtils.getUsername());
|
||||
|
|
@ -113,16 +105,12 @@ public class SysRoleController extends BaseController
|
|||
@RequiresPermissions("system:role:edit")
|
||||
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody SysRole role)
|
||||
{
|
||||
public AjaxResult edit(@Validated @RequestBody SysRole role) {
|
||||
roleService.checkRoleAllowed(role);
|
||||
roleService.checkRoleDataScope(role.getRoleId());
|
||||
if (!roleService.checkRoleNameUnique(role))
|
||||
{
|
||||
if (!roleService.checkRoleNameUnique(role)) {
|
||||
return error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在");
|
||||
}
|
||||
else if (!roleService.checkRoleKeyUnique(role))
|
||||
{
|
||||
} else if (!roleService.checkRoleKeyUnique(role)) {
|
||||
return error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在");
|
||||
}
|
||||
role.setUpdateBy(SecurityUtils.getUsername());
|
||||
|
|
@ -135,8 +123,7 @@ public class SysRoleController extends BaseController
|
|||
@RequiresPermissions("system:role:edit")
|
||||
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/dataScope")
|
||||
public AjaxResult dataScope(@RequestBody SysRole role)
|
||||
{
|
||||
public AjaxResult dataScope(@RequestBody SysRole role) {
|
||||
roleService.checkRoleAllowed(role);
|
||||
roleService.checkRoleDataScope(role.getRoleId());
|
||||
return toAjax(roleService.authDataScope(role));
|
||||
|
|
@ -148,8 +135,7 @@ public class SysRoleController extends BaseController
|
|||
@RequiresPermissions("system:role:edit")
|
||||
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/changeStatus")
|
||||
public AjaxResult changeStatus(@RequestBody SysRole role)
|
||||
{
|
||||
public AjaxResult changeStatus(@RequestBody SysRole role) {
|
||||
roleService.checkRoleAllowed(role);
|
||||
roleService.checkRoleDataScope(role.getRoleId());
|
||||
role.setUpdateBy(SecurityUtils.getUsername());
|
||||
|
|
@ -162,8 +148,7 @@ public class SysRoleController extends BaseController
|
|||
@RequiresPermissions("system:role:remove")
|
||||
@Log(title = "角色管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{roleIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] roleIds)
|
||||
{
|
||||
public AjaxResult remove(@PathVariable Long[] roleIds) {
|
||||
return toAjax(roleService.deleteRoleByIds(roleIds));
|
||||
}
|
||||
|
||||
|
|
@ -172,17 +157,16 @@ public class SysRoleController extends BaseController
|
|||
*/
|
||||
@RequiresPermissions("system:role:query")
|
||||
@GetMapping("/optionselect")
|
||||
public AjaxResult optionselect()
|
||||
{
|
||||
public AjaxResult optionselect() {
|
||||
return success(roleService.selectRoleAll());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询已分配用户角色列表
|
||||
*/
|
||||
@RequiresPermissions("system:role:list")
|
||||
@GetMapping("/authUser/allocatedList")
|
||||
public TableDataInfo allocatedList(SysUser user)
|
||||
{
|
||||
public TableDataInfo allocatedList(SysUser user) {
|
||||
startPage();
|
||||
List<SysUser> list = userService.selectAllocatedList(user);
|
||||
return getDataTable(list);
|
||||
|
|
@ -193,8 +177,7 @@ public class SysRoleController extends BaseController
|
|||
*/
|
||||
@RequiresPermissions("system:role:list")
|
||||
@GetMapping("/authUser/unallocatedList")
|
||||
public TableDataInfo unallocatedList(SysUser user)
|
||||
{
|
||||
public TableDataInfo unallocatedList(SysUser user) {
|
||||
startPage();
|
||||
List<SysUser> list = userService.selectUnallocatedList(user);
|
||||
return getDataTable(list);
|
||||
|
|
@ -206,8 +189,7 @@ public class SysRoleController extends BaseController
|
|||
@RequiresPermissions("system:role:edit")
|
||||
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
||||
@PutMapping("/authUser/cancel")
|
||||
public AjaxResult cancelAuthUser(@RequestBody SysUserRole userRole)
|
||||
{
|
||||
public AjaxResult cancelAuthUser(@RequestBody SysUserRole userRole) {
|
||||
return toAjax(roleService.deleteAuthUser(userRole));
|
||||
}
|
||||
|
||||
|
|
@ -217,8 +199,7 @@ public class SysRoleController extends BaseController
|
|||
@RequiresPermissions("system:role:edit")
|
||||
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
||||
@PutMapping("/authUser/cancelAll")
|
||||
public AjaxResult cancelAuthUserAll(Long roleId, Long[] userIds)
|
||||
{
|
||||
public AjaxResult cancelAuthUserAll(Long roleId, Long[] userIds) {
|
||||
return toAjax(roleService.deleteAuthUsers(roleId, userIds));
|
||||
}
|
||||
|
||||
|
|
@ -228,8 +209,7 @@ public class SysRoleController extends BaseController
|
|||
@RequiresPermissions("system:role:edit")
|
||||
@Log(title = "角色管理", businessType = BusinessType.GRANT)
|
||||
@PutMapping("/authUser/selectAll")
|
||||
public AjaxResult selectAuthUserAll(Long roleId, Long[] userIds)
|
||||
{
|
||||
public AjaxResult selectAuthUserAll(Long roleId, Long[] userIds) {
|
||||
roleService.checkRoleDataScope(roleId);
|
||||
return toAjax(roleService.insertAuthUsers(roleId, userIds));
|
||||
}
|
||||
|
|
@ -239,8 +219,7 @@ public class SysRoleController extends BaseController
|
|||
*/
|
||||
@RequiresPermissions("system:role:query")
|
||||
@GetMapping(value = "/deptTree/{roleId}")
|
||||
public AjaxResult deptTree(@PathVariable("roleId") Long roleId)
|
||||
{
|
||||
public AjaxResult deptTree(@PathVariable("roleId") Long roleId) {
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId));
|
||||
ajax.put("depts", deptService.selectDeptTreeList(new SysDept()));
|
||||
|
|
|
|||
Loading…
Reference in New Issue