51 changed files with 1350 additions and 136 deletions
@ -0,0 +1,12 @@ |
|||
package com.qs.serve.modules.biz.consts; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/10/25 |
|||
*/ |
|||
public interface GroupDataType { |
|||
|
|||
String USER = "user"; |
|||
String DEPT = "dept"; |
|||
|
|||
} |
@ -0,0 +1,145 @@ |
|||
package com.qs.serve.modules.biz.controller; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.qs.serve.common.model.dto.PageVo; |
|||
import com.qs.serve.common.model.dto.R; |
|||
import com.qs.serve.common.util.AuthContextUtils; |
|||
import com.qs.serve.common.util.PageUtil; |
|||
import com.qs.serve.common.util.StringUtils; |
|||
import com.qs.serve.modules.biz.entity.BizUserGroupItem; |
|||
import com.qs.serve.modules.biz.entity.bo.BizUserGroupBatchBo; |
|||
import com.qs.serve.modules.biz.service.BizUserGroupItemService; |
|||
import com.qs.serve.modules.biz.service.impl.BizUserGroupApplicationService; |
|||
import com.qs.serve.modules.sys.entity.SysUser; |
|||
import com.qs.serve.modules.sys.service.SysUserService; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import com.qs.serve.modules.biz.entity.BizUserGroup; |
|||
import com.qs.serve.modules.biz.service.BizUserGroupService; |
|||
|
|||
import javax.validation.Valid; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 用户个人数据分组 |
|||
* @author YenHex |
|||
* @since 2023-10-25 |
|||
*/ |
|||
@Slf4j |
|||
@AllArgsConstructor |
|||
@RestController |
|||
@RequestMapping("biz/dataGroup") |
|||
public class BizUserGroupController { |
|||
|
|||
private final BizUserGroupApplicationService bizUserGroupApplicationService; |
|||
private BizUserGroupService bizUserGroupService; |
|||
private BizUserGroupItemService bizUserGroupItemService; |
|||
private SysUserService sysUserService; |
|||
|
|||
/** |
|||
* 列表 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@GetMapping("/list") |
|||
public R<List<BizUserGroup>> getList(BizUserGroup param){ |
|||
LambdaQueryWrapper<BizUserGroup> lqw = new LambdaQueryWrapper<>(param); |
|||
lqw.eq(BizUserGroup::getUserId, AuthContextUtils.getSysUserId()); |
|||
List<BizUserGroup> list = bizUserGroupService.list(lqw); |
|||
return R.ok(list); |
|||
} |
|||
|
|||
/** |
|||
* 翻页 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@GetMapping("/page") |
|||
public R<PageVo<BizUserGroup>> getPage(BizUserGroup param){ |
|||
LambdaQueryWrapper<BizUserGroup> lqw = new LambdaQueryWrapper<>(param); |
|||
lqw.eq(BizUserGroup::getUserId, AuthContextUtils.getSysUserId()); |
|||
PageUtil.startPage(); |
|||
List<BizUserGroup> list = bizUserGroupService.list(lqw); |
|||
return R.byPageHelperList(list); |
|||
} |
|||
|
|||
/** |
|||
* ID查询 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@GetMapping("/getById/{id}") |
|||
public R<BizUserGroup> getById(@PathVariable("id") String id){ |
|||
BizUserGroup bizUserGroup = bizUserGroupService.getById(id); |
|||
if(!bizUserGroup.getUserId().equals(AuthContextUtils.getSysUserId())){ |
|||
return R.error("无相关数据"); |
|||
} |
|||
LambdaQueryWrapper<BizUserGroupItem> itemLqw = new LambdaQueryWrapper<>(); |
|||
itemLqw.eq(BizUserGroupItem::getGroupId,id); |
|||
List<BizUserGroupItem> itemList = bizUserGroupItemService.list(itemLqw); |
|||
bizUserGroup.setGroupItemList(itemList); |
|||
return R.ok(bizUserGroup); |
|||
} |
|||
|
|||
/** |
|||
* 更新 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping("/update") |
|||
public R<?> updateById(@RequestBody @Valid BizUserGroup param){ |
|||
BizUserGroup bizUserGroup = bizUserGroupService.getById(param.getId()); |
|||
if(!bizUserGroup.getUserId().equals(AuthContextUtils.getSysUserId())){ |
|||
return R.error("无相关数据"); |
|||
} |
|||
boolean result = bizUserGroupService.updateById(param); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
/** |
|||
* 新增 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping("/save") |
|||
public R<?> save(@RequestBody @Valid BizUserGroup param){ |
|||
SysUser sysUser = sysUserService.getById(AuthContextUtils.getSysUserId()); |
|||
param.setUserId(sysUser.getId()); |
|||
param.setUserCode(sysUser.getCode()); |
|||
param.setUserName(sysUser.getName()); |
|||
boolean result = bizUserGroupService.save(param); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 编辑 (场景:同时编辑分组数据) |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping("/editWithItem") |
|||
public R<?> editWithItem(@RequestBody @Valid BizUserGroupBatchBo param){ |
|||
param.setEditGroupFlag(1); |
|||
bizUserGroupApplicationService.editWithItem(param); |
|||
return R.ok(); |
|||
} |
|||
|
|||
/** |
|||
* 删除整个组 |
|||
* @param ids |
|||
* @return |
|||
*/ |
|||
@DeleteMapping("/deleteById/{ids}") |
|||
public R<?> deleteById(@PathVariable("ids") String ids){ |
|||
List<Long> idsLong = StringUtils.splitIdLong(ids); |
|||
LambdaQueryWrapper<BizUserGroup> lqw = new LambdaQueryWrapper<>(); |
|||
lqw.in(BizUserGroup::getId,idsLong); |
|||
lqw.eq(BizUserGroup::getUserId,AuthContextUtils.getSysUserId()); |
|||
boolean result = bizUserGroupService.remove(lqw); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,94 @@ |
|||
package com.qs.serve.modules.biz.controller; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.qs.serve.common.model.annotation.SysLog; |
|||
import com.qs.serve.common.model.dto.PageVo; |
|||
import com.qs.serve.common.model.dto.R; |
|||
import com.qs.serve.common.model.enums.BizType; |
|||
import com.qs.serve.common.model.enums.SystemModule; |
|||
import com.qs.serve.common.util.PageUtil; |
|||
import com.qs.serve.common.util.CopierUtil; |
|||
import com.qs.serve.common.util.StringUtils; |
|||
import com.qs.serve.modules.biz.entity.bo.BizUserGroupBatchBo; |
|||
import com.qs.serve.modules.biz.entity.bo.BizUserGroupItemBatchBo; |
|||
import com.qs.serve.modules.biz.service.impl.BizUserGroupApplicationService; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.security.access.prepost.PreAuthorize; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import com.qs.serve.modules.biz.entity.BizUserGroupItem; |
|||
import com.qs.serve.modules.biz.service.BizUserGroupItemService; |
|||
|
|||
import javax.validation.Valid; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 用户个人数据 |
|||
* @author YenHex |
|||
* @since 2023-10-25 |
|||
*/ |
|||
@Slf4j |
|||
@AllArgsConstructor |
|||
@RestController |
|||
@RequestMapping("biz/dataItem") |
|||
public class BizUserGroupItemController { |
|||
|
|||
private final BizUserGroupItemService bizUserGroupItemService; |
|||
private final BizUserGroupApplicationService bizUserGroupApplicationService; |
|||
|
|||
/** |
|||
* 列表 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@GetMapping("/list") |
|||
public R<List<BizUserGroupItem>> getList(BizUserGroupItem param){ |
|||
LambdaQueryWrapper<BizUserGroupItem> lqw = new LambdaQueryWrapper<>(param); |
|||
List<BizUserGroupItem> list = bizUserGroupItemService.list(lqw); |
|||
return R.ok(list); |
|||
} |
|||
|
|||
/** |
|||
* 翻页 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@GetMapping("/page") |
|||
public R<PageVo<BizUserGroupItem>> getPage(BizUserGroupItem param){ |
|||
LambdaQueryWrapper<BizUserGroupItem> lqw = new LambdaQueryWrapper<>(param); |
|||
PageUtil.startPage(); |
|||
List<BizUserGroupItem> list = bizUserGroupItemService.list(lqw); |
|||
return R.byPageHelperList(list); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 新增 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping("/save") |
|||
public R<?> save(@RequestBody @Valid BizUserGroupItemBatchBo param){ |
|||
BizUserGroupBatchBo groupBatchBo = new BizUserGroupBatchBo(); |
|||
groupBatchBo.setEditGroupFlag(0); |
|||
groupBatchBo.setId(param.getGroupId()); |
|||
groupBatchBo.setItems(param.getItems()); |
|||
bizUserGroupApplicationService.editWithItem(groupBatchBo); |
|||
return R.ok(); |
|||
} |
|||
|
|||
/** |
|||
* 删除 |
|||
* @param ids |
|||
* @return |
|||
*/ |
|||
@DeleteMapping("/deleteById/{ids}") |
|||
public R<?> deleteById(@PathVariable("ids") String ids){ |
|||
List<Long> idsLong = StringUtils.splitIdLong(ids); |
|||
boolean result = bizUserGroupItemService.removeByIds(idsLong); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,93 @@ |
|||
package com.qs.serve.modules.biz.entity; |
|||
|
|||
import java.time.LocalDate; |
|||
import java.io.Serializable; |
|||
import java.math.BigDecimal; |
|||
import java.time.LocalDateTime; |
|||
import java.util.List; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.fasterxml.jackson.annotation.JsonIgnore; |
|||
import com.fasterxml.jackson.annotation.JsonProperty; |
|||
import lombok.Data; |
|||
import org.hibernate.validator.constraints.Length; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
|
|||
import javax.validation.constraints.NotNull; |
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
/** |
|||
* 税务信息表 实体类 |
|||
* @author YenHex |
|||
* @since 2023-10-25 |
|||
*/ |
|||
@Data |
|||
@TableName("biz_user_group") |
|||
public class BizUserGroup implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** id */ |
|||
@TableId(type = IdType.AUTO) |
|||
private Long id; |
|||
|
|||
/** 分组名称 */ |
|||
@Length(max = 255,message = "分组名称长度不能超过255字") |
|||
private String groupName; |
|||
|
|||
/** 用户ID */ |
|||
@Length(max = 255,message = "用户ID长度不能超过255字") |
|||
private String userId; |
|||
|
|||
/** 用户编码 */ |
|||
@Length(max = 255,message = "用户编码长度不能超过255字") |
|||
private String userCode; |
|||
|
|||
/** 用户名称 */ |
|||
@Length(max = 255,message = "用户名称长度不能超过255字") |
|||
private String userName; |
|||
|
|||
/** 应用场景 */ |
|||
@Length(max = 255,message = "应用场景长度不能超过255字") |
|||
private String scene; |
|||
|
|||
/** 备注 */ |
|||
@Length(max = 255,message = "备注长度不能超过255字") |
|||
private String remark; |
|||
|
|||
/** 创建时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private LocalDateTime createTime; |
|||
|
|||
/** 创建人 */ |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private String createBy; |
|||
|
|||
/** 更新时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private LocalDateTime updateTime; |
|||
|
|||
/** 更新人 */ |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private String updateBy; |
|||
|
|||
/** 删除标识 */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private Boolean delFlag; |
|||
|
|||
/** */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String tenantId; |
|||
|
|||
@TableField(exist = false) |
|||
List<?> groupItemList; |
|||
|
|||
} |
|||
|
@ -0,0 +1,88 @@ |
|||
package com.qs.serve.modules.biz.entity; |
|||
|
|||
import java.time.LocalDate; |
|||
import java.io.Serializable; |
|||
import java.math.BigDecimal; |
|||
import java.time.LocalDateTime; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.fasterxml.jackson.annotation.JsonIgnore; |
|||
import com.fasterxml.jackson.annotation.JsonProperty; |
|||
import lombok.Data; |
|||
import org.hibernate.validator.constraints.Length; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
|
|||
import javax.validation.constraints.NotNull; |
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
/** |
|||
* 税务信息表 实体类 |
|||
* @author YenHex |
|||
* @since 2023-10-25 |
|||
*/ |
|||
@Data |
|||
@TableName("biz_user_group_item") |
|||
public class BizUserGroupItem implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** id */ |
|||
@TableId(type = IdType.AUTO) |
|||
private Long id; |
|||
|
|||
/** 分组名称 */ |
|||
private Long groupId; |
|||
|
|||
/** 数据类型:user;dept等 */ |
|||
@Length(max = 255,message = "数据类型:user;dept等长度不能超过255字") |
|||
private String targetType; |
|||
|
|||
/** 目标id */ |
|||
@Length(max = 255,message = "目标id长度不能超过255字") |
|||
private String targetId; |
|||
|
|||
/** 目标 */ |
|||
@Length(max = 255,message = "目标长度不能超过255字") |
|||
private String targetName; |
|||
|
|||
/** 目标编码 */ |
|||
@Length(max = 255,message = "目标编码长度不能超过255字") |
|||
private String targetCode; |
|||
|
|||
/** 备注 */ |
|||
@Length(max = 255,message = "备注长度不能超过255字") |
|||
private String remark; |
|||
|
|||
/** 创建时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private LocalDateTime createTime; |
|||
|
|||
/** 创建人 */ |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private String createBy; |
|||
|
|||
/** 更新时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private LocalDateTime updateTime; |
|||
|
|||
/** 更新人 */ |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private String updateBy; |
|||
|
|||
/** 删除标识 */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private Boolean delFlag; |
|||
|
|||
/** */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String tenantId; |
|||
|
|||
} |
|||
|
@ -0,0 +1,41 @@ |
|||
package com.qs.serve.modules.biz.entity.bo; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.IdType; |
|||
import com.baomidou.mybatisplus.annotation.TableId; |
|||
import lombok.Data; |
|||
import org.hibernate.validator.constraints.Length; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/10/25 |
|||
*/ |
|||
@Data |
|||
public class BizUserGroupBatchBo { |
|||
|
|||
/** id */ |
|||
private Long id; |
|||
|
|||
/** 分组名称 */ |
|||
private String groupName; |
|||
|
|||
/** 应用场景 */ |
|||
private String scene; |
|||
|
|||
/** 备注 */ |
|||
private String remark; |
|||
|
|||
private List<Item> items; |
|||
|
|||
private Integer editGroupFlag; |
|||
|
|||
@Data |
|||
public static class Item{ |
|||
|
|||
private String targetType; |
|||
|
|||
private String targetId; |
|||
|
|||
} |
|||
|
|||
} |
@ -0,0 +1,18 @@ |
|||
package com.qs.serve.modules.biz.entity.bo; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/10/25 |
|||
*/ |
|||
@Data |
|||
public class BizUserGroupItemBatchBo { |
|||
|
|||
private Long groupId; |
|||
|
|||
private List<BizUserGroupBatchBo.Item> items; |
|||
|
|||
} |
@ -0,0 +1,14 @@ |
|||
package com.qs.serve.modules.biz.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.qs.serve.modules.biz.entity.BizUserGroupItem; |
|||
|
|||
/** |
|||
* 税务信息表 Mapper |
|||
* @author YenHex |
|||
* @date 2023-10-25 |
|||
*/ |
|||
public interface BizUserGroupItemMapper extends BaseMapper<BizUserGroupItem> { |
|||
|
|||
} |
|||
|
@ -0,0 +1,14 @@ |
|||
package com.qs.serve.modules.biz.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.qs.serve.modules.biz.entity.BizUserGroup; |
|||
|
|||
/** |
|||
* 税务信息表 Mapper |
|||
* @author YenHex |
|||
* @date 2023-10-25 |
|||
*/ |
|||
public interface BizUserGroupMapper extends BaseMapper<BizUserGroup> { |
|||
|
|||
} |
|||
|
@ -0,0 +1,14 @@ |
|||
package com.qs.serve.modules.biz.service; |
|||
|
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
import com.qs.serve.modules.biz.entity.BizUserGroupItem; |
|||
|
|||
/** |
|||
* 税务信息表 服务接口 |
|||
* @author YenHex |
|||
* @date 2023-10-25 |
|||
*/ |
|||
public interface BizUserGroupItemService extends IService<BizUserGroupItem> { |
|||
|
|||
} |
|||
|
@ -0,0 +1,14 @@ |
|||
package com.qs.serve.modules.biz.service; |
|||
|
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
import com.qs.serve.modules.biz.entity.BizUserGroup; |
|||
|
|||
/** |
|||
* 税务信息表 服务接口 |
|||
* @author YenHex |
|||
* @date 2023-10-25 |
|||
*/ |
|||
public interface BizUserGroupService extends IService<BizUserGroup> { |
|||
|
|||
} |
|||
|
@ -0,0 +1,88 @@ |
|||
package com.qs.serve.modules.biz.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.qs.serve.common.util.Assert; |
|||
import com.qs.serve.common.util.AuthContextUtils; |
|||
import com.qs.serve.modules.biz.consts.GroupDataType; |
|||
import com.qs.serve.modules.biz.entity.BizUserGroup; |
|||
import com.qs.serve.modules.biz.entity.BizUserGroupItem; |
|||
import com.qs.serve.modules.biz.entity.bo.BizUserGroupBatchBo; |
|||
import com.qs.serve.modules.biz.service.BizUserGroupItemService; |
|||
import com.qs.serve.modules.biz.service.BizUserGroupService; |
|||
import com.qs.serve.modules.sys.entity.SysDept; |
|||
import com.qs.serve.modules.sys.entity.SysUser; |
|||
import com.qs.serve.modules.sys.service.SysDeptService; |
|||
import com.qs.serve.modules.sys.service.SysUserService; |
|||
import lombok.AllArgsConstructor; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2023/10/25 |
|||
*/ |
|||
@Service |
|||
@AllArgsConstructor |
|||
public class BizUserGroupApplicationService { |
|||
|
|||
private BizUserGroupService bizUserGroupService; |
|||
private BizUserGroupItemService bizUserGroupItemService; |
|||
private SysUserService sysUserService; |
|||
private SysDeptService sysDeptService; |
|||
|
|||
|
|||
/** |
|||
* 编辑 (场景:同时编辑分组数据) |
|||
* @param param |
|||
* @return*/ |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void editWithItem(BizUserGroupBatchBo param){ |
|||
SysUser sysUser = sysUserService.getById(AuthContextUtils.getSysUserId()); |
|||
BizUserGroup bizUserGroup = new BizUserGroup(); |
|||
if(param.getId()!=null){ |
|||
bizUserGroup = bizUserGroupService.getById(param.getId()); |
|||
if(!bizUserGroup.getUserId().equals(AuthContextUtils.getSysUserId())){ |
|||
Assert.throwEx("无相关数据"); |
|||
} |
|||
} |
|||
if(param.getEditGroupFlag().equals(1)){ |
|||
bizUserGroup.setGroupName(param.getGroupName()); |
|||
bizUserGroup.setUserId(sysUser.getId()); |
|||
bizUserGroup.setUserCode(sysUser.getCode()); |
|||
bizUserGroup.setUserName(sysUser.getName()); |
|||
bizUserGroup.setScene(param.getScene()); |
|||
bizUserGroup.setRemark(param.getRemark()); |
|||
bizUserGroupService.saveOrUpdate(bizUserGroup); |
|||
} |
|||
Long groupId = bizUserGroup.getId(); |
|||
//移除历史ITEM
|
|||
LambdaQueryWrapper<BizUserGroupItem> itemLqw = new LambdaQueryWrapper<>(); |
|||
itemLqw.eq(BizUserGroupItem::getGroupId,groupId); |
|||
bizUserGroupItemService.remove(itemLqw); |
|||
//保存item
|
|||
List<BizUserGroupItem> groupItemList = new ArrayList<>(); |
|||
for (BizUserGroupBatchBo.Item item : param.getItems()) { |
|||
BizUserGroupItem groupItem = new BizUserGroupItem(); |
|||
groupItem.setGroupId(groupId); |
|||
groupItem.setTargetType(item.getTargetType()); |
|||
groupItem.setTargetId(item.getTargetId()); |
|||
if(item.getTargetType().equals(GroupDataType.USER)){ |
|||
SysUser user = sysUserService.getById(item.getTargetId()); |
|||
groupItem.setTargetName(user.getName()); |
|||
groupItem.setTargetCode(user.getCode()); |
|||
}else if (item.getTargetType().equals(GroupDataType.DEPT)){ |
|||
SysDept dept = sysDeptService.getById(item.getTargetId()); |
|||
groupItem.setTargetName(dept.getName()); |
|||
groupItem.setTargetCode(dept.getCode()); |
|||
}else { |
|||
continue; |
|||
} |
|||
groupItemList.add(groupItem); |
|||
} |
|||
bizUserGroupItemService.saveBatch(groupItemList); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,22 @@ |
|||
package com.qs.serve.modules.biz.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.stereotype.Service; |
|||
import com.qs.serve.modules.biz.entity.BizUserGroupItem; |
|||
import com.qs.serve.modules.biz.service.BizUserGroupItemService; |
|||
import com.qs.serve.modules.biz.mapper.BizUserGroupItemMapper; |
|||
|
|||
/** |
|||
* 税务信息表 服务实现类 |
|||
* @author YenHex |
|||
* @since 2023-10-25 |
|||
*/ |
|||
@Slf4j |
|||
@Service |
|||
@AllArgsConstructor |
|||
public class BizUserGroupItemServiceImpl extends ServiceImpl<BizUserGroupItemMapper,BizUserGroupItem> implements BizUserGroupItemService { |
|||
|
|||
} |
|||
|
@ -0,0 +1,22 @@ |
|||
package com.qs.serve.modules.biz.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.stereotype.Service; |
|||
import com.qs.serve.modules.biz.entity.BizUserGroup; |
|||
import com.qs.serve.modules.biz.service.BizUserGroupService; |
|||
import com.qs.serve.modules.biz.mapper.BizUserGroupMapper; |
|||
|
|||
/** |
|||
* 税务信息表 服务实现类 |
|||
* @author YenHex |
|||
* @since 2023-10-25 |
|||
*/ |
|||
@Slf4j |
|||
@Service |
|||
@AllArgsConstructor |
|||
public class BizUserGroupServiceImpl extends ServiceImpl<BizUserGroupMapper,BizUserGroup> implements BizUserGroupService { |
|||
|
|||
} |
|||
|
@ -0,0 +1,41 @@ |
|||
package com.qs.serve.modules.goods.entity.bo; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.IdType; |
|||
import com.baomidou.mybatisplus.annotation.TableField; |
|||
import com.baomidou.mybatisplus.annotation.TableId; |
|||
import com.qs.serve.common.framework.mybatis.handler.meta.SplitStringTypeHandler; |
|||
import lombok.Data; |
|||
import org.apache.ibatis.type.JdbcType; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 口味品类 |
|||
* @author YenHex |
|||
* @since 2022/10/10 |
|||
*/ |
|||
@Data |
|||
public class GoodsSpuImportBo { |
|||
|
|||
private List<SpuItem> spuList; |
|||
|
|||
@Data |
|||
public static class SpuItem{ |
|||
/** |
|||
* 操作方式:save,update,delete |
|||
*/ |
|||
private String opt; |
|||
|
|||
/** 商品编码 */ |
|||
private String spuCode; |
|||
|
|||
/** 商品名字 */ |
|||
private String name; |
|||
|
|||
/** 分类名称 */ |
|||
private String categoryName; |
|||
|
|||
private String errMsg; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,57 @@ |
|||
<?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.qs.serve.modules.biz.mapper.BizUserGroupItemMapper"> |
|||
|
|||
<resultMap id="bizUserGroupItemMap" type="com.qs.serve.modules.biz.entity.BizUserGroupItem" > |
|||
<result property="id" column="id"/> |
|||
<result property="groupId" column="group_id"/> |
|||
<result property="targetType" column="target_type"/> |
|||
<result property="targetId" column="target_id"/> |
|||
<result property="targetName" column="target_name"/> |
|||
<result property="targetCode" column="target_code"/> |
|||
<result property="remark" column="remark"/> |
|||
<result property="createTime" column="create_time"/> |
|||
<result property="createBy" column="create_by"/> |
|||
<result property="updateTime" column="update_time"/> |
|||
<result property="updateBy" column="update_by"/> |
|||
<result property="delFlag" column="del_flag"/> |
|||
<result property="tenantId" column="tenant_id"/> |
|||
</resultMap> |
|||
|
|||
<sql id="bizUserGroupItemSql"> |
|||
biz_user_group_item.`id`, |
|||
biz_user_group_item.`group_id`, |
|||
biz_user_group_item.`target_type`, |
|||
biz_user_group_item.`target_id`, |
|||
biz_user_group_item.`target_name`, |
|||
biz_user_group_item.`target_code`, |
|||
biz_user_group_item.`remark`, |
|||
biz_user_group_item.`create_time`, |
|||
biz_user_group_item.`create_by`, |
|||
biz_user_group_item.`update_time`, |
|||
biz_user_group_item.`update_by`, |
|||
biz_user_group_item.`del_flag`, |
|||
biz_user_group_item.`tenant_id` </sql> |
|||
|
|||
<select id="selectBizUserGroupItemList" parameterType="com.qs.serve.modules.biz.entity.BizUserGroupItem" resultMap="bizUserGroupItemMap"> |
|||
SELECT <include refid="bizUserGroupItemSql"/> FROM `biz_user_group_item` `biz_user_group_item` |
|||
<where> |
|||
<if test="query.id != null"> and `biz_user_group_item`.`id` = #{query.id}</if> |
|||
<if test="query.groupId != null"> and `biz_user_group_item`.`group_id` = #{query.groupId}</if> |
|||
<if test="query.targetType != null and query.targetType != ''"> and `biz_user_group_item`.`target_type` = #{query.targetType}</if> |
|||
<if test="query.targetId != null and query.targetId != ''"> and `biz_user_group_item`.`target_id` = #{query.targetId}</if> |
|||
<if test="query.targetName != null and query.targetName != ''"> and `biz_user_group_item`.`target_name` = #{query.targetName}</if> |
|||
<if test="query.targetCode != null and query.targetCode != ''"> and `biz_user_group_item`.`target_code` = #{query.targetCode}</if> |
|||
<if test="query.remark != null and query.remark != ''"> and `biz_user_group_item`.`remark` = #{query.remark}</if> |
|||
<if test="query.createTime != null"> and `biz_user_group_item`.`create_time` = #{query.createTime}</if> |
|||
<if test="query.createBy != null and query.createBy != ''"> and `biz_user_group_item`.`create_by` = #{query.createBy}</if> |
|||
<if test="query.updateTime != null"> and `biz_user_group_item`.`update_time` = #{query.updateTime}</if> |
|||
<if test="query.updateBy != null and query.updateBy != ''"> and `biz_user_group_item`.`update_by` = #{query.updateBy}</if> |
|||
<if test="query.delFlag != null"> and `biz_user_group_item`.`del_flag` = #{query.delFlag}</if> |
|||
<if test="query.tenantId != null and query.tenantId != ''"> and `biz_user_group_item`.`tenant_id` = #{query.tenantId}</if> |
|||
</where> |
|||
</select> |
|||
|
|||
</mapper> |
Loading…
Reference in new issue