master:档口子角色功能;
parent
9756e5cc23
commit
dcf52e2611
|
|
@ -4,25 +4,18 @@ import cn.hutool.core.bean.BeanUtil;
|
|||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.XktBaseController;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.web.controller.xkt.vo.store.StoreUpdateVO;
|
||||
import com.ruoyi.xkt.domain.Store;
|
||||
import com.ruoyi.xkt.dto.store.StoreCreateDTO;
|
||||
import com.ruoyi.xkt.dto.store.StoreUpdateDTO;
|
||||
import com.ruoyi.xkt.service.IStoreService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 档口Controller
|
||||
*
|
||||
|
|
@ -59,59 +52,4 @@ public class StoreController extends XktBaseController {
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询档口列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:store:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(Store store) {
|
||||
startPage();
|
||||
List<Store> list = storeService.selectStoreList(store);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出档口列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:store:export')")
|
||||
@Log(title = "档口", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, Store store) {
|
||||
List<Store> list = storeService.selectStoreList(store);
|
||||
ExcelUtil<Store> util = new ExcelUtil<Store>(Store.class);
|
||||
util.exportExcel(response, list, "档口数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取档口详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:store:query')")
|
||||
@GetMapping(value = "/{storeId}")
|
||||
public R getInfo(@PathVariable("storeId") Long storeId) {
|
||||
return success(storeService.selectStoreByStoreId(storeId));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 删除档口
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:store:remove')")
|
||||
@Log(title = "档口", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{storeIds}")
|
||||
public R remove(@PathVariable Long[] storeIds) {
|
||||
return success(storeService.deleteStoreByStoreIds(storeIds));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,18 +1,25 @@
|
|||
package com.ruoyi.web.controller.xkt;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.XktBaseController;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.xkt.domain.StoreRole;
|
||||
import com.ruoyi.web.controller.xkt.vo.storeRole.StoreRolePageVO;
|
||||
import com.ruoyi.web.controller.xkt.vo.storeRole.StoreRoleUpdateStatusVO;
|
||||
import com.ruoyi.web.controller.xkt.vo.storeRole.StoreRoleVO;
|
||||
import com.ruoyi.xkt.dto.storeRole.StoreRoleDTO;
|
||||
import com.ruoyi.xkt.dto.storeRole.StoreRolePageDTO;
|
||||
import com.ruoyi.xkt.dto.storeRole.StoreRoleResDTO;
|
||||
import com.ruoyi.xkt.dto.storeRole.StoreRoleUpdateStatusDTO;
|
||||
import com.ruoyi.xkt.service.IStoreRoleService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -21,71 +28,66 @@ import java.util.List;
|
|||
* @author ruoyi
|
||||
* @date 2025-03-26
|
||||
*/
|
||||
@Api(tags = "档口子角色")
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/rest/v1/store-roles")
|
||||
public class StoreRoleController extends XktBaseController {
|
||||
@Autowired
|
||||
private IStoreRoleService storeRoleService;
|
||||
|
||||
final IStoreRoleService storeRoleService;
|
||||
|
||||
/**
|
||||
* 查询档口子角色列表
|
||||
* 新增档口子角色
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:role:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(StoreRole storeRole) {
|
||||
startPage();
|
||||
List<StoreRole> list = storeRoleService.selectStoreRoleList(storeRole);
|
||||
return getDataTable(list);
|
||||
@PreAuthorize("@ss.hasPermi('system:role:add')")
|
||||
@ApiOperation(value = "新增档口子角色", httpMethod = "POST", response = R.class)
|
||||
@Log(title = "新增档口子角色", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public R<Integer> add(@Validated @RequestBody StoreRoleVO storeRoleVO) {
|
||||
return R.ok(storeRoleService.insertStoreRole(BeanUtil.toBean(storeRoleVO, StoreRoleDTO.class)));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导出档口子角色列表
|
||||
* 编辑档口子角色
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:role:export')")
|
||||
@Log(title = "档口子角色", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, StoreRole storeRole) {
|
||||
List<StoreRole> list = storeRoleService.selectStoreRoleList(storeRole);
|
||||
ExcelUtil<StoreRole> util = new ExcelUtil<StoreRole>(StoreRole.class);
|
||||
util.exportExcel(response, list, "档口子角色数据");
|
||||
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
||||
@ApiOperation(value = "编辑档口子角色", httpMethod = "PUT", response = R.class)
|
||||
@Log(title = "编辑档口子角色", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public R<Integer> edit(@Validated @RequestBody StoreRoleVO storeRoleVO) {
|
||||
return R.ok(storeRoleService.update(BeanUtil.toBean(storeRoleVO, StoreRoleDTO.class)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取档口子角色详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:role:query')")
|
||||
@ApiOperation(value = "获取档口子角色详细信息", httpMethod = "GET", response = R.class)
|
||||
@GetMapping(value = "/{storeRoleId}")
|
||||
public R getInfo(@PathVariable("storeRoleId") Long storeRoleId) {
|
||||
return success(storeRoleService.selectStoreRoleByStoreRoleId(storeRoleId));
|
||||
public R<StoreRoleVO> getInfo(@PathVariable("storeRoleId") Long storeRoleId) {
|
||||
return R.ok(BeanUtil.toBean(storeRoleService.selectByStoreRoleId(storeRoleId), StoreRoleVO.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增档口子角色
|
||||
* 获取档口子角色列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:role:add')")
|
||||
@Log(title = "档口子角色", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public R add(@RequestBody StoreRole storeRole) {
|
||||
return success(storeRoleService.insertStoreRole(storeRole));
|
||||
@PreAuthorize("@ss.hasPermi('system:role:list')")
|
||||
@ApiOperation(value = "查询档口销售出库列表", httpMethod = "POST", response = R.class)
|
||||
@PostMapping("/list")
|
||||
public R<List<StoreRoleResDTO>> list(@Validated @RequestBody StoreRolePageVO rolePageVO) {
|
||||
return R.ok(storeRoleService.list(BeanUtil.toBean(rolePageVO, StoreRolePageDTO.class)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改档口子角色
|
||||
* 停用/启用档口子角色
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
||||
@Log(title = "档口子角色", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public R edit(@RequestBody StoreRole storeRole) {
|
||||
return success(storeRoleService.updateStoreRole(storeRole));
|
||||
@ApiOperation(value = "停用/启用档口子角色", httpMethod = "PUT", response = R.class)
|
||||
@Log(title = "停用/启用档口子角色", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/status")
|
||||
public R<Integer> updateRoleStatus(@Validated @RequestBody StoreRoleUpdateStatusVO roleUpdateStatusVO) {
|
||||
return R.ok(storeRoleService.updateRoleStatus(BeanUtil.toBean(roleUpdateStatusVO, StoreRoleUpdateStatusDTO.class)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除档口子角色
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:role:remove')")
|
||||
@Log(title = "档口子角色", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{storeRoleIds}")
|
||||
public R remove(@PathVariable Long[] storeRoleIds) {
|
||||
return success(storeRoleService.deleteStoreRoleByStoreRoleIds(storeRoleIds));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,25 @@
|
|||
package com.ruoyi.web.controller.xkt.vo.storeRole;
|
||||
|
||||
import com.ruoyi.web.controller.xkt.vo.BasePageVO;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* @author liujiang
|
||||
* @version v1.0
|
||||
* @date 2025/3/27 15:12
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel("档口子角色分页查询入参")
|
||||
@Data
|
||||
public class StoreRolePageVO extends BasePageVO {
|
||||
|
||||
@NotNull(message = "档口ID不能为空")
|
||||
@ApiModelProperty(value = "档口ID", required = true)
|
||||
private Long storeId;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
package com.ruoyi.web.controller.xkt.vo.storeRole;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* @author liujiang
|
||||
* @version v1.0
|
||||
* @date 2025/3/27 15:12
|
||||
*/
|
||||
@ApiModel("档口子角色停用启用")
|
||||
@Data
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class StoreRoleUpdateStatusVO {
|
||||
|
||||
@ApiModelProperty(value = "档口子角色ID", required = true)
|
||||
@NotNull(message = "档口子角色ID不能为空!")
|
||||
private Long storeRoleId;
|
||||
@ApiModelProperty(value = "档口子角色状态,启用传:0,停用传:2", required = true)
|
||||
@NotBlank(message = "档口子角色状态不能为空!")
|
||||
private String delFlag;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
package com.ruoyi.web.controller.xkt.vo.storeRole;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author liujiang
|
||||
* @version v1.0
|
||||
* @date 2025/3/27 15:12
|
||||
*/
|
||||
@ApiModel("档口子角色")
|
||||
@Data
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class StoreRoleVO {
|
||||
|
||||
@ApiModelProperty(value = "档口ID", required = true)
|
||||
@NotNull(message = "档口ID不能为空!")
|
||||
private Long storeId;
|
||||
@ApiModelProperty(value = "档口ID,新增为空 编辑必传")
|
||||
private Long storeRoleId;
|
||||
@ApiModelProperty(value = "角色名称")
|
||||
@NotBlank(message = "角色名称不能为空!")
|
||||
@Size(min = 1, max = 30, message = "角色名称长度不能超过30个字!")
|
||||
private String roleName;
|
||||
@ApiModelProperty(value = "档口子角色备注")
|
||||
private String remark;
|
||||
@ApiModelProperty(value = "档口子角色菜单权限名称列表")
|
||||
List<String> menuList;
|
||||
|
||||
}
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
package com.ruoyi.xkt.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.XktBaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
|
@ -28,22 +27,37 @@ public class StoreRole extends XktBaseEntity {
|
|||
/**
|
||||
* store.id
|
||||
*/
|
||||
@Excel(name = "store.id")
|
||||
private Long storeId;
|
||||
|
||||
/**
|
||||
* 档口角色状态(0正常 1停用)
|
||||
* 角色名称
|
||||
*/
|
||||
@Excel(name = "档口角色状态", readConverterExp = "0=正常,1=停用")
|
||||
private String roleStatus;
|
||||
private String roleName;
|
||||
|
||||
/**
|
||||
* 系统角色ID
|
||||
*/
|
||||
private Long roleId;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 操作人ID
|
||||
*/
|
||||
private Long operatorId;
|
||||
/**
|
||||
* 操作人名称
|
||||
*/
|
||||
private String operatorName;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("storeId", getStoreId())
|
||||
.append("roleStatus", getRoleStatus())
|
||||
.append("version", getVersion())
|
||||
.append("delFlag", getDelFlag())
|
||||
.append("createBy", getCreateBy())
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import com.ruoyi.common.annotation.Excel;
|
|||
import com.ruoyi.common.core.domain.XktBaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
|
|
@ -16,6 +17,7 @@ import org.apache.commons.lang3.builder.ToStringStyle;
|
|||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class StoreRoleMenu extends XktBaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
|
@ -43,13 +45,6 @@ public class StoreRoleMenu extends XktBaseEntity {
|
|||
@Excel(name = "菜单名称")
|
||||
private String menuName;
|
||||
|
||||
/**
|
||||
* 菜单使用状态(0正常 1停用)
|
||||
*/
|
||||
@Excel(name = "菜单使用状态", readConverterExp = "0=正常,1=停用")
|
||||
private String menuStatus;
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||
|
|
@ -57,7 +52,6 @@ public class StoreRoleMenu extends XktBaseEntity {
|
|||
.append("storeRoleId", getStoreRoleId())
|
||||
.append("storeId", getStoreId())
|
||||
.append("menuName", getMenuName())
|
||||
.append("menuStatus", getMenuStatus())
|
||||
.append("version", getVersion())
|
||||
.append("delFlag", getDelFlag())
|
||||
.append("createBy", getCreateBy())
|
||||
|
|
|
|||
|
|
@ -0,0 +1,33 @@
|
|||
package com.ruoyi.xkt.dto.storeRole;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author liujiang
|
||||
* @version v1.0
|
||||
* @date 2025/3/27 15:12
|
||||
*/
|
||||
@ApiModel("档口子角色")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class StoreRoleDTO {
|
||||
|
||||
@ApiModelProperty(value = "档口ID")
|
||||
private Long storeId;
|
||||
@ApiModelProperty(value = "档口ID,新增为空 编辑必传")
|
||||
private Long storeRoleId;
|
||||
@ApiModelProperty(value = "角色名称")
|
||||
private String roleName;
|
||||
@ApiModelProperty(value = "档口子角色备注")
|
||||
private String remark;
|
||||
@ApiModelProperty(value = "档口子角色菜单权限名称列表")
|
||||
List<String> menuList;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package com.ruoyi.xkt.dto.storeRole;
|
||||
|
||||
import com.ruoyi.xkt.dto.BasePageDTO;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* @author liujiang
|
||||
* @version v1.0
|
||||
* @date 2025/3/27 15:12
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel("档口子角色分页查询入参")
|
||||
@Data
|
||||
public class StoreRolePageDTO extends BasePageDTO {
|
||||
|
||||
@ApiModelProperty(value = "档口ID")
|
||||
private Long storeId;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
package com.ruoyi.xkt.dto.storeRole;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author liujiang
|
||||
* @version v1.0
|
||||
* @date 2025/3/27 15:12
|
||||
*/
|
||||
@ApiModel("档口子角色列表数据")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class StoreRoleResDTO {
|
||||
|
||||
@ApiModelProperty(value = "档口ID")
|
||||
private Long storeId;
|
||||
@ApiModelProperty(value = "档口ID,新增为空 编辑必传")
|
||||
private Long storeRoleId;
|
||||
@ApiModelProperty(value = "角色名称")
|
||||
private String roleName;
|
||||
@ApiModelProperty(value = "档口子角色备注")
|
||||
private String remark;
|
||||
@ApiModelProperty(value = "停用启用状态")
|
||||
private Integer delFlag;
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date createTime;
|
||||
@ApiModelProperty(value = "操作人名称")
|
||||
private String operatorName;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package com.ruoyi.xkt.dto.storeRole;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author liujiang
|
||||
* @version v1.0
|
||||
* @date 2025/3/27 15:12
|
||||
*/
|
||||
@ApiModel("档口子角色停用启用")
|
||||
@Data
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class StoreRoleUpdateStatusDTO {
|
||||
|
||||
@ApiModelProperty(value = "档口子角色ID")
|
||||
private Long storeRoleId;
|
||||
@ApiModelProperty(value = "档口子角色状态")
|
||||
private String delFlag;
|
||||
|
||||
}
|
||||
|
|
@ -1,6 +1,9 @@
|
|||
package com.ruoyi.xkt.service;
|
||||
|
||||
import com.ruoyi.xkt.domain.StoreRole;
|
||||
import com.ruoyi.xkt.dto.storeRole.StoreRoleDTO;
|
||||
import com.ruoyi.xkt.dto.storeRole.StoreRolePageDTO;
|
||||
import com.ruoyi.xkt.dto.storeRole.StoreRoleResDTO;
|
||||
import com.ruoyi.xkt.dto.storeRole.StoreRoleUpdateStatusDTO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -11,51 +14,45 @@ import java.util.List;
|
|||
* @date 2025-03-26
|
||||
*/
|
||||
public interface IStoreRoleService {
|
||||
/**
|
||||
* 查询档口子角色
|
||||
*
|
||||
* @param storeRoleId 档口子角色主键
|
||||
* @return 档口子角色
|
||||
*/
|
||||
public StoreRole selectStoreRoleByStoreRoleId(Long storeRoleId);
|
||||
|
||||
/**
|
||||
* 查询档口子角色列表
|
||||
*
|
||||
* @param storeRole 档口子角色
|
||||
* @return 档口子角色集合
|
||||
*/
|
||||
public List<StoreRole> selectStoreRoleList(StoreRole storeRole);
|
||||
|
||||
/**
|
||||
* 新增档口子角色
|
||||
*
|
||||
* @param storeRole 档口子角色
|
||||
* @param storeRoleDTO 档口子角色
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertStoreRole(StoreRole storeRole);
|
||||
public int insertStoreRole(StoreRoleDTO storeRoleDTO);
|
||||
|
||||
/**
|
||||
* 修改档口子角色
|
||||
* 更新档口子角色
|
||||
*
|
||||
* @param storeRole 档口子角色
|
||||
* @return 结果
|
||||
* @param storeRoleDTO 档口子角色信息
|
||||
* @return
|
||||
*/
|
||||
public int updateStoreRole(StoreRole storeRole);
|
||||
Integer update(StoreRoleDTO storeRoleDTO);
|
||||
|
||||
/**
|
||||
* 批量删除档口子角色
|
||||
* 查询档口子角色菜单详情
|
||||
*
|
||||
* @param storeRoleIds 需要删除的档口子角色主键集合
|
||||
* @return 结果
|
||||
* @param storeRoleId 档口子角色ID
|
||||
* @return
|
||||
*/
|
||||
public int deleteStoreRoleByStoreRoleIds(Long[] storeRoleIds);
|
||||
StoreRoleDTO selectByStoreRoleId(Long storeRoleId);
|
||||
|
||||
/**
|
||||
* 删除档口子角色信息
|
||||
* 档口子角色分页查询
|
||||
*
|
||||
* @param storeRoleId 档口子角色主键
|
||||
* @return 结果
|
||||
* @param pageDTO 档口子角色分页查询入参
|
||||
* @return
|
||||
*/
|
||||
public int deleteStoreRoleByStoreRoleId(Long storeRoleId);
|
||||
List<StoreRoleResDTO> list(StoreRolePageDTO pageDTO);
|
||||
|
||||
/**
|
||||
* 更新档口子角色状态
|
||||
*
|
||||
* @param updateStatusDTO 子角色状态更新入参
|
||||
* @return
|
||||
*/
|
||||
Integer updateRoleStatus(StoreRoleUpdateStatusDTO updateStatusDTO);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,8 @@
|
|||
package com.ruoyi.xkt.service;
|
||||
|
||||
import com.ruoyi.xkt.domain.Store;
|
||||
import com.ruoyi.xkt.dto.store.StoreCreateDTO;
|
||||
import com.ruoyi.xkt.dto.store.StoreUpdateDTO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 档口Service接口
|
||||
*
|
||||
|
|
@ -16,68 +13,18 @@ public interface IStoreService {
|
|||
|
||||
/**
|
||||
* 更新档口数据
|
||||
*
|
||||
* @param storeUpdateDTO 更新数据入参
|
||||
* @return int
|
||||
*/
|
||||
public int updateStore(StoreUpdateDTO storeUpdateDTO);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public int updateStore(StoreUpdateDTO storeUpdateDTO);
|
||||
|
||||
/**
|
||||
* 注册时新增档口信息
|
||||
*
|
||||
* @param createDTO 新增DTO
|
||||
* @return int
|
||||
*/
|
||||
public int create(StoreCreateDTO createDTO);
|
||||
|
||||
/**
|
||||
* 查询档口
|
||||
*
|
||||
* @param storeId 档口主键
|
||||
* @return 档口
|
||||
*/
|
||||
public Store selectStoreByStoreId(Long storeId);
|
||||
|
||||
/**
|
||||
* 查询档口列表
|
||||
*
|
||||
* @param store 档口
|
||||
* @return 档口集合
|
||||
*/
|
||||
public List<Store> selectStoreList(Store store);
|
||||
|
||||
/**
|
||||
* 新增档口
|
||||
*
|
||||
* @param store 档口
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertStore(Store store);
|
||||
|
||||
|
||||
/**
|
||||
* 批量删除档口
|
||||
*
|
||||
* @param storeIds 需要删除的档口主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteStoreByStoreIds(Long[] storeIds);
|
||||
|
||||
/**
|
||||
* 删除档口信息
|
||||
*
|
||||
* @param storeId 档口主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteStoreByStoreId(Long storeId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,14 +1,32 @@
|
|||
package com.ruoyi.xkt.service.impl;
|
||||
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.constant.HttpStatus;
|
||||
import com.ruoyi.common.core.domain.model.LoginUser;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.xkt.domain.StoreRole;
|
||||
import com.ruoyi.xkt.domain.StoreRoleAccount;
|
||||
import com.ruoyi.xkt.domain.StoreRoleMenu;
|
||||
import com.ruoyi.xkt.dto.storeRole.StoreRoleDTO;
|
||||
import com.ruoyi.xkt.dto.storeRole.StoreRolePageDTO;
|
||||
import com.ruoyi.xkt.dto.storeRole.StoreRoleResDTO;
|
||||
import com.ruoyi.xkt.dto.storeRole.StoreRoleUpdateStatusDTO;
|
||||
import com.ruoyi.xkt.mapper.StoreRoleAccountMapper;
|
||||
import com.ruoyi.xkt.mapper.StoreRoleMapper;
|
||||
import com.ruoyi.xkt.mapper.StoreRoleMenuMapper;
|
||||
import com.ruoyi.xkt.service.IStoreRoleService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 档口子角色Service业务层处理
|
||||
|
|
@ -17,79 +35,146 @@ import java.util.List;
|
|||
* @date 2025-03-26
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class StoreRoleServiceImpl implements IStoreRoleService {
|
||||
@Autowired
|
||||
private StoreRoleMapper storeRoleMapper;
|
||||
|
||||
/**
|
||||
* 查询档口子角色
|
||||
*
|
||||
* @param storeRoleId 档口子角色主键
|
||||
* @return 档口子角色
|
||||
*/
|
||||
@Override
|
||||
public StoreRole selectStoreRoleByStoreRoleId(Long storeRoleId) {
|
||||
return storeRoleMapper.selectStoreRoleByStoreRoleId(storeRoleId);
|
||||
}
|
||||
final StoreRoleMapper storeRoleMapper;
|
||||
final StoreRoleMenuMapper storeRoleMenuMapper;
|
||||
final StoreRoleAccountMapper storeRoleAccMapper;
|
||||
|
||||
/**
|
||||
* 查询档口子角色列表
|
||||
*
|
||||
* @param storeRole 档口子角色
|
||||
* @return 档口子角色
|
||||
*/
|
||||
@Override
|
||||
public List<StoreRole> selectStoreRoleList(StoreRole storeRole) {
|
||||
return storeRoleMapper.selectStoreRoleList(storeRole);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增档口子角色
|
||||
*
|
||||
* @param storeRole 档口子角色
|
||||
* @param storeRoleDTO 档口子角色
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public int insertStoreRole(StoreRole storeRole) {
|
||||
storeRole.setCreateTime(DateUtils.getNowDate());
|
||||
return storeRoleMapper.insertStoreRole(storeRole);
|
||||
public int insertStoreRole(StoreRoleDTO storeRoleDTO) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
StoreRole storeRole = BeanUtil.toBean(storeRoleDTO, StoreRole.class);
|
||||
|
||||
// TODO 暂时列为-1
|
||||
// TODO 暂时列为-1
|
||||
// TODO 暂时列为-1
|
||||
storeRole.setRoleId(1000L);
|
||||
|
||||
|
||||
storeRole.setOperatorId(loginUser.getUserId());
|
||||
storeRole.setOperatorName(loginUser.getUsername());
|
||||
int count = this.storeRoleMapper.insert(storeRole);
|
||||
// 新增档口子角色菜单
|
||||
List<StoreRoleMenu> roleMenuList = storeRoleDTO.getMenuList().stream().map(menuName -> {
|
||||
StoreRoleMenu storeRoleMenu = new StoreRoleMenu();
|
||||
return storeRoleMenu.setStoreId(storeRoleDTO.getStoreId())
|
||||
.setStoreRoleId(storeRole.getId()).setMenuName(menuName);
|
||||
}).collect(Collectors.toList());
|
||||
this.storeRoleMenuMapper.insert(roleMenuList);
|
||||
return count;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改档口子角色
|
||||
* 更新档口子角色
|
||||
*
|
||||
* @param storeRole 档口子角色
|
||||
* @return 结果
|
||||
* @param storeRoleDTO 档口子角色信息
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public int updateStoreRole(StoreRole storeRole) {
|
||||
storeRole.setUpdateTime(DateUtils.getNowDate());
|
||||
return storeRoleMapper.updateStoreRole(storeRole);
|
||||
public Integer update(StoreRoleDTO storeRoleDTO) {
|
||||
Optional.ofNullable(storeRoleDTO.getStoreRoleId()).orElseThrow(() -> new ServiceException("档口角色ID不能为空!", HttpStatus.ERROR));
|
||||
StoreRole storeRole = Optional.ofNullable(this.storeRoleMapper.selectOne(new LambdaQueryWrapper<StoreRole>()
|
||||
.eq(StoreRole::getId, storeRoleDTO.getStoreRoleId()).eq(StoreRole::getDelFlag, Constants.UNDELETED)
|
||||
.eq(StoreRole::getStoreId, storeRoleDTO.getStoreId())))
|
||||
.orElseThrow(() -> new ServiceException("档口角色不存在!", HttpStatus.ERROR));
|
||||
BeanUtil.copyProperties(storeRoleDTO, storeRole);
|
||||
int count = this.storeRoleMapper.updateById(storeRole);
|
||||
// 将旧的子角色菜单置为无效
|
||||
List<StoreRoleMenu> menuList = this.storeRoleMenuMapper.selectList(new LambdaQueryWrapper<StoreRoleMenu>()
|
||||
.eq(StoreRoleMenu::getStoreRoleId, storeRoleDTO.getStoreRoleId()).eq(StoreRoleMenu::getDelFlag, Constants.UNDELETED)
|
||||
.eq(StoreRoleMenu::getStoreId, storeRoleDTO.getStoreId()));
|
||||
if (CollectionUtils.isNotEmpty(menuList)) {
|
||||
menuList.forEach(x -> x.setDelFlag(Constants.DELETED));
|
||||
this.storeRoleMenuMapper.updateById(menuList);
|
||||
}
|
||||
// 新增档口子角色菜单
|
||||
List<StoreRoleMenu> roleMenuList = storeRoleDTO.getMenuList().stream().map(menuName -> {
|
||||
StoreRoleMenu storeRoleMenu = new StoreRoleMenu();
|
||||
return storeRoleMenu.setStoreId(storeRoleDTO.getStoreId())
|
||||
.setStoreRoleId(storeRole.getId()).setMenuName(menuName);
|
||||
}).collect(Collectors.toList());
|
||||
this.storeRoleMenuMapper.insert(roleMenuList);
|
||||
return count;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除档口子角色
|
||||
* 查询档口子角色菜单详情
|
||||
*
|
||||
* @param storeRoleIds 需要删除的档口子角色主键
|
||||
* @return 结果
|
||||
* @param storeRoleId 档口子角色ID
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public int deleteStoreRoleByStoreRoleIds(Long[] storeRoleIds) {
|
||||
return storeRoleMapper.deleteStoreRoleByStoreRoleIds(storeRoleIds);
|
||||
@Transactional(readOnly = true)
|
||||
public StoreRoleDTO selectByStoreRoleId(Long storeRoleId) {
|
||||
StoreRole storeRole = Optional.ofNullable(this.storeRoleMapper.selectOne(new LambdaQueryWrapper<StoreRole>()
|
||||
.eq(StoreRole::getId, storeRoleId).eq(StoreRole::getDelFlag, Constants.UNDELETED)))
|
||||
.orElseThrow(() -> new ServiceException("档口子角色不存在!", HttpStatus.ERROR));
|
||||
// 找到档口子角色菜单
|
||||
List<StoreRoleMenu> menuList = this.storeRoleMenuMapper.selectList(new LambdaQueryWrapper<StoreRoleMenu>()
|
||||
.eq(StoreRoleMenu::getStoreRoleId, storeRoleId).eq(StoreRoleMenu::getDelFlag, Constants.UNDELETED)
|
||||
.eq(StoreRoleMenu::getStoreId, storeRole.getStoreId()));
|
||||
return BeanUtil.toBean(storeRole, StoreRoleDTO.class)
|
||||
.setMenuList(menuList.stream().map(StoreRoleMenu::getMenuName).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除档口子角色信息
|
||||
* 档口子角色分页查询
|
||||
*
|
||||
* @param storeRoleId 档口子角色主键
|
||||
* @return 结果
|
||||
* @param pageDTO 档口子角色分页查询入参
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
public List<StoreRoleResDTO> list(StoreRolePageDTO pageDTO) {
|
||||
List<StoreRole> storeRoleList = this.storeRoleMapper.selectList(new LambdaQueryWrapper<StoreRole>()
|
||||
.eq(StoreRole::getStoreId, pageDTO.getStoreId()).eq(StoreRole::getDelFlag, Constants.UNDELETED));
|
||||
return storeRoleList.stream().map(x -> BeanUtil.toBean(x, StoreRoleResDTO.class).setStoreRoleId(x.getId()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新档口子角色状态
|
||||
*
|
||||
* @param updateStatusDTO 子角色状态更新入参
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public int deleteStoreRoleByStoreRoleId(Long storeRoleId) {
|
||||
return storeRoleMapper.deleteStoreRoleByStoreRoleId(storeRoleId);
|
||||
public Integer updateRoleStatus(StoreRoleUpdateStatusDTO updateStatusDTO) {
|
||||
StoreRole storeRole = Optional.ofNullable(this.storeRoleMapper.selectOne(new LambdaQueryWrapper<StoreRole>()
|
||||
.eq(StoreRole::getId, updateStatusDTO.getStoreRoleId()).eq(StoreRole::getDelFlag, Constants.UNDELETED)))
|
||||
.orElseThrow(() -> new ServiceException("档口角色不存在!", HttpStatus.ERROR));
|
||||
storeRole.setDelFlag(updateStatusDTO.getDelFlag());
|
||||
// 如果是启用变为停用,则还需将子角色菜单置为无效,子角色账号置为无效
|
||||
if (Objects.equals(updateStatusDTO.getDelFlag(), Constants.DELETED)) {
|
||||
List<StoreRoleMenu> menuList = this.storeRoleMenuMapper.selectList(new LambdaQueryWrapper<StoreRoleMenu>()
|
||||
.eq(StoreRoleMenu::getStoreRoleId, updateStatusDTO.getStoreRoleId()).eq(StoreRoleMenu::getDelFlag, Constants.UNDELETED)
|
||||
.eq(StoreRoleMenu::getStoreId, storeRole.getStoreId()));
|
||||
if (CollectionUtils.isNotEmpty(menuList)) {
|
||||
menuList.forEach(x -> x.setDelFlag(Constants.DELETED));
|
||||
this.storeRoleMenuMapper.updateById(menuList);
|
||||
}
|
||||
// 找到子角色账号,并置为无效
|
||||
List<StoreRoleAccount> accountList = this.storeRoleAccMapper.selectList(new LambdaQueryWrapper<StoreRoleAccount>()
|
||||
.eq(StoreRoleAccount::getStoreRoleId, updateStatusDTO.getStoreRoleId()).eq(StoreRoleAccount::getDelFlag, Constants.UNDELETED)
|
||||
.eq(StoreRoleAccount::getStoreId, storeRole.getStoreId()));
|
||||
if (CollectionUtils.isNotEmpty(accountList)) {
|
||||
accountList.forEach(x -> x.setDelFlag(Constants.DELETED));
|
||||
this.storeRoleAccMapper.updateById(accountList);
|
||||
}
|
||||
}
|
||||
return this.storeRoleMapper.updateById(storeRole);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.constant.HttpStatus;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.xkt.domain.Store;
|
||||
import com.ruoyi.xkt.dto.store.StoreCreateDTO;
|
||||
import com.ruoyi.xkt.dto.store.StoreUpdateDTO;
|
||||
|
|
@ -19,7 +18,6 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
|
|
@ -52,7 +50,7 @@ public class StoreServiceImpl implements IStoreService {
|
|||
// 当前时间往后推1年为试用期时间
|
||||
Date oneYearAfter = Date.from(LocalDate.now().plusYears(1).atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
store.setTrialEndTime(oneYearAfter);
|
||||
return this.storeMapper.insert(store);
|
||||
return this.storeMapper.insert(store);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -76,81 +74,4 @@ public class StoreServiceImpl implements IStoreService {
|
|||
return storeMapper.updateById(store);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 新增档口
|
||||
*
|
||||
* @param store 档口
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public int insertStore(Store store) {
|
||||
store.setCreateTime(DateUtils.getNowDate());
|
||||
return storeMapper.insertStore(store);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询档口
|
||||
*
|
||||
* @param storeId 档口主键
|
||||
* @return 档口
|
||||
*/
|
||||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
public Store selectStoreByStoreId(Long storeId) {
|
||||
return storeMapper.selectStoreByStoreId(storeId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询档口列表
|
||||
*
|
||||
* @param store 档口
|
||||
* @return 档口
|
||||
*/
|
||||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
public List<Store> selectStoreList(Store store) {
|
||||
return storeMapper.selectStoreList(store);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 批量删除档口
|
||||
*
|
||||
* @param storeIds 需要删除的档口主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public int deleteStoreByStoreIds(Long[] storeIds) {
|
||||
return storeMapper.deleteStoreByStoreIds(storeIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除档口信息
|
||||
*
|
||||
* @param storeId 档口主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public int deleteStoreByStoreId(Long storeId) {
|
||||
return storeMapper.deleteStoreByStoreId(storeId);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue