21 changed files with 920 additions and 64 deletions
@ -0,0 +1,13 @@ |
|||
package com.qs.serve.modules.bms.common; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2022/11/11 |
|||
*/ |
|||
public interface MasterUserType { |
|||
|
|||
String Channel = "channel"; |
|||
|
|||
String Point = "point"; |
|||
|
|||
} |
@ -0,0 +1,200 @@ |
|||
package com.qs.serve.modules.bms.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.bms.common.MasterUserType; |
|||
import com.qs.serve.modules.bms.entity.BmsChannel; |
|||
import com.qs.serve.modules.bms.entity.BmsChannelPoint; |
|||
import com.qs.serve.modules.bms.entity.BmsRegionUser; |
|||
import com.qs.serve.modules.bms.entity.vo.BmsMasterUserChannelVo; |
|||
import com.qs.serve.modules.bms.entity.vo.BmsMasterUserPointVo; |
|||
import com.qs.serve.modules.bms.mapper.BmsMasterUserMapper; |
|||
import com.qs.serve.modules.bms.service.BmsChannelPointService; |
|||
import com.qs.serve.modules.bms.service.BmsChannelService; |
|||
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.security.access.prepost.PreAuthorize; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import com.qs.serve.modules.bms.entity.vo.BmsMasterUserVo; |
|||
import com.qs.serve.modules.bms.entity.bo.BmsMasterUserBo; |
|||
import com.qs.serve.modules.bms.entity.BmsMasterUser; |
|||
import com.qs.serve.modules.bms.service.BmsMasterUserService; |
|||
|
|||
import javax.validation.Valid; |
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 基础档案 负责人 |
|||
* @author YenHex |
|||
* @since 2022-11-10 |
|||
*/ |
|||
@Slf4j |
|||
@AllArgsConstructor |
|||
@RestController |
|||
@RequestMapping("bms/masterUser") |
|||
public class BmsMasterUserController { |
|||
|
|||
private BmsChannelService bmsChannelService; |
|||
private BmsChannelPointService bmsChannelPointService; |
|||
private BmsMasterUserService bmsMasterUserService; |
|||
private BmsMasterUserMapper bmsMasterUserMapper; |
|||
private SysUserService sysUserService; |
|||
|
|||
/** |
|||
* 负责人列表(渠道) |
|||
* @param userChannel |
|||
* @return |
|||
*/ |
|||
@GetMapping("/list4Channel") |
|||
@PreAuthorize("hasRole('bms:masterUser:query')") |
|||
public R<List<BmsMasterUserChannelVo>> getList(BmsMasterUserChannelVo userChannel){ |
|||
PageUtil.startPage(); |
|||
List<BmsMasterUserChannelVo> list = bmsMasterUserMapper.selectChannelMasterUserList(userChannel); |
|||
return R.ok(list); |
|||
} |
|||
|
|||
/** |
|||
* 负责人翻页(渠道) |
|||
* @param userChannel |
|||
* @return |
|||
*/ |
|||
@GetMapping("/page4Channel") |
|||
@PreAuthorize("hasRole('bms:masterUser:query')") |
|||
public R<PageVo<BmsMasterUserChannelVo>> getPage(BmsMasterUserChannelVo userChannel){ |
|||
PageUtil.startPage(); |
|||
List<BmsMasterUserChannelVo> list = bmsMasterUserMapper.selectChannelMasterUserList(userChannel); |
|||
return R.byPageHelperList(list); |
|||
} |
|||
|
|||
/** |
|||
* 负责人列表(网点) |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@GetMapping("/list4Point") |
|||
@PreAuthorize("hasRole('bms:masterUser:query')") |
|||
public R<List<BmsMasterUserPointVo>> list4Point(BmsMasterUserPointVo param){ |
|||
PageUtil.startPage(); |
|||
List<BmsMasterUserPointVo> list = bmsMasterUserMapper.selectPointMasterUserList(param); |
|||
return R.ok(list); |
|||
} |
|||
|
|||
/** |
|||
* 负责人翻页(网点) |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@GetMapping("/page4Point") |
|||
@PreAuthorize("hasRole('bms:masterUser:query')") |
|||
public R<PageVo<BmsMasterUserPointVo>> page4Point(BmsMasterUserPointVo param){ |
|||
PageUtil.startPage(); |
|||
List<BmsMasterUserPointVo> list = bmsMasterUserMapper.selectPointMasterUserList(param); |
|||
return R.byPageHelperList(list); |
|||
} |
|||
|
|||
/** |
|||
* ID查询 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@GetMapping("/getById/{id}") |
|||
@SysLog(module = SystemModule.BASE, title = "负责人", biz = BizType.QUERY) |
|||
@PreAuthorize("hasRole('bms:masterUser:query')") |
|||
public R<BmsMasterUser> getById(@PathVariable("id") String id){ |
|||
BmsMasterUser bmsMasterUser = bmsMasterUserService.getById(id); |
|||
SysUser sysUser = sysUserService.getById(bmsMasterUser.getUserId()); |
|||
bmsMasterUser.setUserInfo(sysUser.toSysUserVo()); |
|||
if(bmsMasterUser.getType().equals(MasterUserType.Channel)){ |
|||
BmsChannel channel = bmsChannelService.getById(bmsMasterUser.getTargetId()); |
|||
bmsMasterUser.setObjectInfo(channel); |
|||
}else if(bmsMasterUser.getType().equals(MasterUserType.Point)){ |
|||
BmsChannelPoint point = bmsChannelPointService.getById(bmsMasterUser.getTargetId()); |
|||
bmsMasterUser.setObjectInfo(point); |
|||
} |
|||
return R.ok(bmsMasterUser); |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 新增 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping("/saveBatch") |
|||
@SysLog(module = SystemModule.BASE, title = "负责人", biz = BizType.INSERT) |
|||
@PreAuthorize("hasRole('bms:masterUser:insert')") |
|||
public R<?> save(@RequestBody @Valid BmsMasterUserBo param){ |
|||
String type = param.getType(); |
|||
List<BmsMasterUser> masterUsers = new ArrayList<>(); |
|||
for (String userId : param.getUserIds()) { |
|||
for (String targetId : param.getTargetIds()) { |
|||
BmsMasterUser masterUser = bmsMasterUserService.getByParam(type,targetId,userId); |
|||
if(masterUser == null){ |
|||
masterUser = new BmsMasterUser(); |
|||
masterUser.setType(type); |
|||
masterUser.setTargetId(targetId); |
|||
masterUser.setUserId(userId); |
|||
masterUsers.add(masterUser); |
|||
} |
|||
} |
|||
} |
|||
bmsMasterUserService.saveBatch(masterUsers); |
|||
return R.ok(); |
|||
} |
|||
|
|||
/** |
|||
* 设置为主要负责人 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@PostMapping("/setMaster/{id}") |
|||
@SysLog(module = SystemModule.BASE, title = "区域负责人", biz = BizType.UPDATE) |
|||
@PreAuthorize("hasRole('bms:regionUser:update')") |
|||
public R<?> updateById(@PathVariable("id")Long id){ |
|||
bmsMasterUserService.setMaster(id); |
|||
return R.ok(); |
|||
} |
|||
|
|||
/** |
|||
* 取消主要负责人 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@PostMapping("/cancelMaster/{id}") |
|||
@SysLog(module = SystemModule.BASE, title = "区域负责人", biz = BizType.UPDATE) |
|||
@PreAuthorize("hasRole('bms:masterUser:update')") |
|||
public R<?> cancelMaster(@PathVariable("id")Long id){ |
|||
BmsMasterUser regionUser = new BmsMasterUser(); |
|||
regionUser.setId(id); |
|||
regionUser.setMasterFlag(0); |
|||
bmsMasterUserService.updateById(regionUser); |
|||
return R.ok(); |
|||
} |
|||
|
|||
/** |
|||
* 删除 |
|||
* @param ids |
|||
* @return |
|||
*/ |
|||
@DeleteMapping("/deleteById/{ids}") |
|||
@SysLog(module = SystemModule.BASE, title = "负责人", biz = BizType.DELETE) |
|||
@PreAuthorize("hasRole('bms:masterUser:delete')") |
|||
public R<?> deleteById(@PathVariable("ids") String ids){ |
|||
List<Long> idsLong = StringUtils.splitIdLong(ids); |
|||
boolean result = bmsMasterUserService.removeByIds(idsLong); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,106 @@ |
|||
package com.qs.serve.modules.bms.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 2022-11-10 |
|||
*/ |
|||
@Data |
|||
@TableName("bms_master_user") |
|||
public class BmsMasterUser implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** id */ |
|||
@TableId(type = IdType.AUTO) |
|||
private Long id; |
|||
|
|||
/** 类型:channel、point */ |
|||
@NotBlank(message = "类型不能为空") |
|||
@Length(max = 10,message = "类型长度不能超过10字") |
|||
private String type; |
|||
|
|||
/** 目标id */ |
|||
@NotBlank(message = "目标id不能为空") |
|||
@Length(max = 32,message = "目标id长度不能超过32字") |
|||
private String targetId; |
|||
|
|||
/** 用户id */ |
|||
@NotBlank(message = "用户id不能为空") |
|||
@Length(max = 32,message = "用户id长度不能超过32字") |
|||
private String userId; |
|||
|
|||
/** 主要负责人 */ |
|||
@NotNull(message = "主要负责人不能为空") |
|||
private Integer masterFlag; |
|||
|
|||
/** 拓展字段1 */ |
|||
@Length(max = 255,message = "拓展字段1长度不能超过255字") |
|||
private String sp1; |
|||
|
|||
/** 拓展字段2 */ |
|||
@Length(max = 255,message = "拓展字段2长度不能超过255字") |
|||
private String sp2; |
|||
|
|||
/** 拓展字段3 */ |
|||
@Length(max = 255,message = "拓展字段3长度不能超过255字") |
|||
private String sp3; |
|||
|
|||
/** 备注 */ |
|||
@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; |
|||
|
|||
/** 租户id */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String tenantId; |
|||
|
|||
/** 删除标识 */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private Boolean delFlag; |
|||
|
|||
@TableField(exist = false) |
|||
private Object userInfo; |
|||
|
|||
@TableField(exist = false) |
|||
private Object objectInfo; |
|||
|
|||
} |
|||
|
@ -0,0 +1,39 @@ |
|||
package com.qs.serve.modules.bms.entity.bo; |
|||
|
|||
import java.time.LocalDate; |
|||
import java.io.Serializable; |
|||
import java.math.BigDecimal; |
|||
import java.time.LocalDateTime; |
|||
import java.util.List; |
|||
|
|||
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; |
|||
|
|||
/** |
|||
* 负责人 Bo |
|||
* @author YenHex |
|||
* @since 2022-11-10 |
|||
*/ |
|||
@Data |
|||
public class BmsMasterUserBo implements Serializable { |
|||
|
|||
/** id列表 */ |
|||
private List<String> targetIds; |
|||
|
|||
/** 类型 */ |
|||
@NotNull(message = "类型不能为空") |
|||
private String type; |
|||
|
|||
/** 用户id列表 */ |
|||
@NotNull(message = "用户id不能为空") |
|||
private List<String> userIds; |
|||
|
|||
} |
|||
|
@ -0,0 +1,23 @@ |
|||
package com.qs.serve.modules.bms.entity.bo; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotNull; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2022/11/10 |
|||
*/ |
|||
@Data |
|||
public class BmsSupplierChannelBo { |
|||
|
|||
/** 渠道id */ |
|||
@NotNull(message = "渠道id不能为空") |
|||
private List<Long> channelIds; |
|||
|
|||
/** 客户id */ |
|||
@NotNull(message = "客户id不能为空") |
|||
private List<Long> supplierIds; |
|||
|
|||
} |
@ -0,0 +1,25 @@ |
|||
package com.qs.serve.modules.bms.entity.vo; |
|||
|
|||
import com.qs.serve.modules.bms.entity.BmsMasterUser; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2022/11/11 |
|||
*/ |
|||
@Data |
|||
public class BmsMasterUserChannelVo extends BmsMasterUser { |
|||
|
|||
private String userCode; |
|||
|
|||
private String userName; |
|||
|
|||
private String channelName; |
|||
|
|||
private String channelCode; |
|||
|
|||
private String pointName; |
|||
|
|||
private String pointCode; |
|||
|
|||
} |
@ -0,0 +1,21 @@ |
|||
package com.qs.serve.modules.bms.entity.vo; |
|||
|
|||
import com.qs.serve.modules.bms.entity.BmsMasterUser; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2022/11/11 |
|||
*/ |
|||
@Data |
|||
public class BmsMasterUserPointVo extends BmsMasterUser { |
|||
|
|||
private String userCode; |
|||
|
|||
private String userName; |
|||
|
|||
private String pointName; |
|||
|
|||
private String pointCode; |
|||
|
|||
} |
@ -0,0 +1,80 @@ |
|||
package com.qs.serve.modules.bms.entity.vo; |
|||
|
|||
import java.time.LocalDate; |
|||
import java.io.Serializable; |
|||
import java.math.BigDecimal; |
|||
import java.time.LocalDateTime; |
|||
|
|||
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; |
|||
|
|||
/** |
|||
* 负责人 VO |
|||
* @author YenHex |
|||
* @since 2022-11-10 |
|||
*/ |
|||
@Data |
|||
public class BmsMasterUserVo implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** id */ |
|||
private Long id; |
|||
|
|||
/** 类型 */ |
|||
private String type; |
|||
|
|||
/** 目标id */ |
|||
private String targetId; |
|||
|
|||
/** 用户id */ |
|||
private String userId; |
|||
|
|||
/** 主要负责人 */ |
|||
private Integer masterFlag; |
|||
|
|||
/** 拓展字段1 */ |
|||
private String sp1; |
|||
|
|||
/** 拓展字段2 */ |
|||
private String sp2; |
|||
|
|||
/** 拓展字段3 */ |
|||
private String sp3; |
|||
|
|||
/** 备注 */ |
|||
private String remark; |
|||
|
|||
/** 创建时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
private LocalDateTime createTime; |
|||
|
|||
/** 创建人 */ |
|||
private String createBy; |
|||
|
|||
/** 更新时间 */ |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
private LocalDateTime updateTime; |
|||
|
|||
/** 更新人 */ |
|||
private String updateBy; |
|||
|
|||
/** 租户id */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String tenantId; |
|||
|
|||
/** 删除标识 */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private Boolean delFlag; |
|||
|
|||
} |
|||
|
@ -0,0 +1,33 @@ |
|||
package com.qs.serve.modules.bms.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.qs.serve.modules.bms.entity.BmsMasterUser; |
|||
import com.qs.serve.modules.bms.entity.vo.BmsMasterUserChannelVo; |
|||
import com.qs.serve.modules.bms.entity.vo.BmsMasterUserPointVo; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 负责人 Mapper |
|||
* @author YenHex |
|||
* @date 2022-11-10 |
|||
*/ |
|||
public interface BmsMasterUserMapper extends BaseMapper<BmsMasterUser> { |
|||
|
|||
/** |
|||
* 查询渠道负责人 |
|||
* @param userChannel |
|||
* @return |
|||
*/ |
|||
List<BmsMasterUserChannelVo> selectChannelMasterUserList(@Param("query") BmsMasterUserChannelVo userChannel); |
|||
|
|||
/** |
|||
* 查询站点负责人 |
|||
* @param userChannel |
|||
* @return |
|||
*/ |
|||
List<BmsMasterUserPointVo> selectPointMasterUserList(@Param("query") BmsMasterUserPointVo userChannel); |
|||
|
|||
} |
|||
|
@ -0,0 +1,25 @@ |
|||
package com.qs.serve.modules.bms.service; |
|||
|
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
import com.qs.serve.modules.bms.entity.BmsMasterUser; |
|||
import com.qs.serve.modules.bms.entity.BmsRegionUser; |
|||
|
|||
/** |
|||
* 负责人 服务接口 |
|||
* @author YenHex |
|||
* @date 2022-11-10 |
|||
*/ |
|||
public interface BmsMasterUserService extends IService<BmsMasterUser> { |
|||
|
|||
|
|||
|
|||
BmsMasterUser getByParam(String type, String targetId, String userId); |
|||
|
|||
/** |
|||
* 设置主要负责人 |
|||
* @param id |
|||
*/ |
|||
void setMaster(Long id); |
|||
|
|||
} |
|||
|
@ -0,0 +1,46 @@ |
|||
package com.qs.serve.modules.bms.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import com.qs.serve.modules.bms.entity.BmsRegionUser; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.stereotype.Service; |
|||
import com.qs.serve.modules.bms.entity.BmsMasterUser; |
|||
import com.qs.serve.modules.bms.service.BmsMasterUserService; |
|||
import com.qs.serve.modules.bms.mapper.BmsMasterUserMapper; |
|||
|
|||
/** |
|||
* 负责人 服务实现类 |
|||
* @author YenHex |
|||
* @since 2022-11-10 |
|||
*/ |
|||
@Slf4j |
|||
@Service |
|||
@AllArgsConstructor |
|||
public class BmsMasterUserServiceImpl extends ServiceImpl<BmsMasterUserMapper,BmsMasterUser> implements BmsMasterUserService { |
|||
|
|||
@Override |
|||
public BmsMasterUser getByParam(String type, String targetId, String userId) { |
|||
LambdaQueryWrapper<BmsMasterUser> lqw = new LambdaQueryWrapper<>(); |
|||
lqw.eq(BmsMasterUser::getTenantId,targetId); |
|||
lqw.eq(BmsMasterUser::getType,type); |
|||
lqw.eq(BmsMasterUser::getUserId,userId); |
|||
return this.getOne(lqw,false); |
|||
} |
|||
|
|||
@Override |
|||
public void setMaster(Long id) { |
|||
BmsMasterUser masterUser = this.getById(id); |
|||
LambdaQueryWrapper<BmsMasterUser> lqw = new LambdaQueryWrapper<>(); |
|||
lqw.eq(BmsMasterUser::getTargetId,masterUser.getTargetId()); |
|||
lqw.eq(BmsMasterUser::getType,masterUser.getType()); |
|||
lqw.ne(BmsMasterUser::getUserId,masterUser.getUserId()); |
|||
BmsMasterUser param = new BmsMasterUser(); |
|||
param.setMasterFlag(0); |
|||
this.update(param,lqw); |
|||
masterUser.setMasterFlag(1); |
|||
this.updateById(masterUser); |
|||
} |
|||
} |
|||
|
@ -0,0 +1,18 @@ |
|||
package com.qs.serve.modules.goods.entity.dto; |
|||
|
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2022/11/10 |
|||
*/ |
|||
@Data |
|||
@AllArgsConstructor |
|||
public class TbsCenterDto { |
|||
|
|||
String centerCode; |
|||
|
|||
String centerName; |
|||
|
|||
} |
@ -0,0 +1,115 @@ |
|||
<?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.bms.mapper.BmsMasterUserMapper"> |
|||
|
|||
<resultMap id="bmsMasterUserMap" type="com.qs.serve.modules.bms.entity.BmsMasterUser" > |
|||
<result property="id" column="id"/> |
|||
<result property="type" column="type"/> |
|||
<result property="targetId" column="target_id"/> |
|||
<result property="userId" column="user_id"/> |
|||
<result property="masterFlag" column="master_flag"/> |
|||
<result property="sp1" column="sp1"/> |
|||
<result property="sp2" column="sp2"/> |
|||
<result property="sp3" column="sp3"/> |
|||
<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="tenantId" column="tenant_id"/> |
|||
<result property="delFlag" column="del_flag"/> |
|||
</resultMap> |
|||
|
|||
<resultMap id="bmsMasterUserChannelMap" type="com.qs.serve.modules.bms.entity.vo.BmsMasterUserChannelVo" extends="bmsMasterUserMap"> |
|||
<result property="userCode" column="user_code"/> |
|||
<result property="userName" column="user_name"/> |
|||
<result property="channelName" column="channel_name"/> |
|||
<result property="channelCode" column="channel_code"/> |
|||
</resultMap> |
|||
|
|||
<resultMap id="bmsMasterUserPointMap" type="com.qs.serve.modules.bms.entity.vo.BmsMasterUserChannelVo" extends="bmsMasterUserChannelMap"> |
|||
<result property="pointName" column="point_name"/> |
|||
<result property="pointCode" column="point_code"/> |
|||
</resultMap> |
|||
|
|||
<sql id="bmsMasterUserSql"> |
|||
bms_master_user.`id`, |
|||
bms_master_user.`type`, |
|||
bms_master_user.`target_id`, |
|||
bms_master_user.`user_id`, |
|||
bms_master_user.`master_flag`, |
|||
bms_master_user.`sp1`, |
|||
bms_master_user.`sp2`, |
|||
bms_master_user.`sp3`, |
|||
bms_master_user.`remark`, |
|||
bms_master_user.`create_time`, |
|||
bms_master_user.`create_by`, |
|||
bms_master_user.`update_time`, |
|||
bms_master_user.`update_by`, |
|||
bms_master_user.`tenant_id`, |
|||
bms_master_user.`del_flag` </sql> |
|||
|
|||
<sql id="whereMasterUserBaseCondition"> |
|||
<if test="query.id != null"> and `bms_master_user`.`id` = #{query.id}</if> |
|||
<if test="query.type != null and query.type != ''"> and `bms_master_user`.`type` = #{query.type}</if> |
|||
<if test="query.targetId != null and query.targetId != ''"> and `bms_master_user`.`target_id` = #{query.targetId}</if> |
|||
<if test="query.userId != null and query.userId != ''"> and `bms_master_user`.`user_id` = #{query.userId}</if> |
|||
<if test="query.masterFlag != null"> and `bms_master_user`.`master_flag` = #{query.masterFlag}</if> |
|||
<if test="query.sp1 != null and query.sp1 != ''"> and `bms_master_user`.`sp1` = #{query.sp1}</if> |
|||
<if test="query.sp2 != null and query.sp2 != ''"> and `bms_master_user`.`sp2` = #{query.sp2}</if> |
|||
<if test="query.sp3 != null and query.sp3 != ''"> and `bms_master_user`.`sp3` = #{query.sp3}</if> |
|||
<if test="query.remark != null and query.remark != ''"> and `bms_master_user`.`remark` = #{query.remark}</if> |
|||
<if test="query.createTime != null"> and `bms_master_user`.`create_time` = #{query.createTime}</if> |
|||
<if test="query.createBy != null and query.createBy != ''"> and `bms_master_user`.`create_by` = #{query.createBy}</if> |
|||
<if test="query.updateTime != null"> and `bms_master_user`.`update_time` = #{query.updateTime}</if> |
|||
<if test="query.updateBy != null and query.updateBy != ''"> and `bms_master_user`.`update_by` = #{query.updateBy}</if> |
|||
<if test="query.tenantId != null and query.tenantId != ''"> and `bms_master_user`.`tenant_id` = #{query.tenantId}</if> |
|||
<if test="query.delFlag != null"> and `bms_master_user`.`del_flag` = #{query.delFlag}</if> |
|||
</sql> |
|||
|
|||
<select id="selectChannelMasterUserList" parameterType="com.qs.serve.modules.bms.entity.vo.BmsMasterUserChannelVo" resultMap="bmsMasterUserChannelMap"> |
|||
SELECT |
|||
`sys_user`.`code` user_code, |
|||
`sys_user`.`name` user_name, |
|||
`bms_channel`.`channel_name`, |
|||
`bms_channel`.`channel_code`, |
|||
<include refid="bmsMasterUserSql"/> |
|||
FROM `bms_master_user` `bms_master_user` |
|||
LEFT JOIN `sys_user` ON `sys_user`.`id` = `bms_master_user`.`user_id` |
|||
LEFT JOIN `bms_channel` ON `bms_channel`.`id` = `bms_master_user`.`target_id` |
|||
<where> |
|||
<include refid="whereMasterUserBaseCondition"></include> |
|||
<if test="query.userCode != null and query.userCode != ''"> and `sys_user`.`code` LIKE CONCAT('%',#{query.userCode},'%') </if> |
|||
<if test="query.userName != null and query.userName != ''"> and `sys_user`.`name` LIKE CONCAT('%',#{query.userName},'%') </if> |
|||
<if test="query.channelName != null and query.channelName != ''"> and `bms_channel`.`channel_name` LIKE CONCAT('%',#{query.channelName},'%') </if> |
|||
<if test="query.channelCode != null and query.channelCode != ''"> and `bms_channel`.`channel_code` LIKE CONCAT('%',#{query.channelCode},'%') </if> |
|||
</where> |
|||
</select> |
|||
|
|||
<select id="selectPointMasterUserList" resultType="com.qs.serve.modules.bms.entity.vo.BmsMasterUserPointVo" resultMap="bmsMasterUserPointMap"> |
|||
SELECT |
|||
`sys_user`.`code` user_code, |
|||
`sys_user`.`name` user_name, |
|||
`bms_channel`.`channel_name`, |
|||
`bms_channel`.`channel_code`, |
|||
`bms_channel_point`.`point_name`, |
|||
`bms_channel_point`.`point_code`, |
|||
<include refid="bmsMasterUserSql"/> |
|||
FROM `bms_master_user` `bms_master_user` |
|||
LEFT JOIN `sys_user` ON `sys_user`.`id` = `bms_master_user`.`user_id` |
|||
LEFT JOIN `bms_channel_point` ON `bms_channel_point`.`id` = `bms_master_user`.`target_id` |
|||
LEFT JOIN `bms_channel` ON `bms_channel_point`.`channel_id` = `bms_channel`.`id` |
|||
<where> |
|||
<include refid="whereMasterUserBaseCondition"></include> |
|||
<if test="query.userCode != null and query.userCode != ''"> and `sys_user`.`code` LIKE CONCAT('%',#{query.userCode},'%') </if> |
|||
<if test="query.userName != null and query.userName != ''"> and `sys_user`.`name` LIKE CONCAT('%',#{query.userName},'%') </if> |
|||
<if test="query.channelName != null and query.channelName != ''"> and `bms_channel`.`channel_name` LIKE CONCAT('%',#{query.channelName},'%') </if> |
|||
<if test="query.channelCode != null and query.channelCode != ''"> and `bms_channel`.`channel_code` LIKE CONCAT('%',#{query.channelCode},'%') </if> |
|||
<if test="query.pointName != null and query.pointName != ''"> and `bms_channel_point`.`point_name` LIKE CONCAT('%',#{query.pointName},'%') </if> |
|||
<if test="query.pointCode != null and query.pointCode != ''"> and `bms_channel_point`.`point_code` LIKE CONCAT('%',#{query.pointCode},'%') </if> |
|||
</where> |
|||
</select> |
|||
|
|||
</mapper> |
Loading…
Reference in new issue