26 changed files with 807 additions and 62 deletions
@ -0,0 +1,112 @@ |
|||
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.CopierUtil; |
|||
import com.qs.serve.common.util.PageUtil; |
|||
import com.qs.serve.common.util.TreeUtil; |
|||
import com.qs.serve.modules.bms.entity.vo.BmsRegionTreeVo; |
|||
import com.qs.serve.modules.bms.entity.vo.BmsSubjectTreeVo; |
|||
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.BmsSubject; |
|||
import com.qs.serve.modules.bms.service.BmsSubjectService; |
|||
|
|||
import javax.validation.Valid; |
|||
import java.util.List; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* 基础档案 科目 |
|||
* @author YenHex |
|||
* @since 2022-11-07 |
|||
*/ |
|||
@Slf4j |
|||
@AllArgsConstructor |
|||
@RestController |
|||
@RequestMapping("bms/subject") |
|||
public class BmsSubjectController { |
|||
|
|||
private BmsSubjectService bmsSubjectService; |
|||
|
|||
/** |
|||
* 翻页 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@GetMapping("/tree") |
|||
@PreAuthorize("hasRole('bms:subject:query')") |
|||
public R<List<BmsSubjectTreeVo>> getPage(BmsSubject param){ |
|||
LambdaQueryWrapper<BmsSubject> subjectWrapper = new LambdaQueryWrapper<>(param); |
|||
List<BmsSubject> list = bmsSubjectService.list(subjectWrapper); |
|||
List<BmsSubjectTreeVo> treeVoList = list.stream().map(subject->{ |
|||
BmsSubjectTreeVo treeNode = CopierUtil.copy(subject,new BmsSubjectTreeVo()); |
|||
treeNode.setId(subject.getId().toString()); |
|||
treeNode.setParentId(subject.getPid().toString()); |
|||
treeNode.setSort(0); |
|||
return treeNode; |
|||
}).collect(Collectors.toList()); |
|||
return R.ok(TreeUtil.buildByRecursive(treeVoList,TreeUtil.DEFAULT_PID_STRING)); |
|||
} |
|||
|
|||
/** |
|||
* ID查询 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@GetMapping("/getById/{id}") |
|||
@SysLog(module = SystemModule.BASE, title = "科目", biz = BizType.QUERY) |
|||
@PreAuthorize("hasRole('bms:subject:query')") |
|||
public R<BmsSubject> getById(@PathVariable("id") String id){ |
|||
BmsSubject bmsSubject = bmsSubjectService.getById(id); |
|||
return R.ok(bmsSubject); |
|||
} |
|||
|
|||
/** |
|||
* 更新 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping("/updateById") |
|||
@SysLog(module = SystemModule.BASE, title = "科目", biz = BizType.UPDATE) |
|||
@PreAuthorize("hasRole('bms:subject:update')") |
|||
public R<?> updateById(@RequestBody @Valid BmsSubject param){ |
|||
boolean result = bmsSubjectService.updateById(param); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
/** |
|||
* 新增 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping("/save") |
|||
@SysLog(module = SystemModule.BASE, title = "科目", biz = BizType.INSERT) |
|||
@PreAuthorize("hasRole('bms:subject:insert')") |
|||
public R<?> save(@RequestBody @Valid BmsSubject param){ |
|||
boolean result = bmsSubjectService.save(param); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
/** |
|||
* 删除 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@DeleteMapping("/deleteById/{id}") |
|||
@SysLog(module = SystemModule.BASE, title = "科目", biz = BizType.DELETE) |
|||
@PreAuthorize("hasRole('bms:subject:delete')") |
|||
public R<?> deleteById(@PathVariable("id") Long id){ |
|||
boolean result = bmsSubjectService.removeById(id); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,81 @@ |
|||
package com.qs.serve.modules.bms.entity; |
|||
|
|||
import java.time.LocalDateTime; |
|||
import java.io.Serializable; |
|||
|
|||
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-07 |
|||
*/ |
|||
@Data |
|||
@TableName("bms_subject") |
|||
public class BmsSubject implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** id */ |
|||
@TableId(type = IdType.AUTO) |
|||
private Long id; |
|||
|
|||
/** 科目名称 */ |
|||
@NotBlank(message = "科目名称不能为空") |
|||
@Length(max = 50,message = "科目名称长度不能超过50字") |
|||
private String subjectName; |
|||
|
|||
/** 科目编码 */ |
|||
@NotBlank(message = "科目编码不能为空") |
|||
@Length(max = 50,message = "科目编码长度不能超过50字") |
|||
private String subjectCode; |
|||
|
|||
/** 父级id */ |
|||
@NotNull(message = "父级id不能为空") |
|||
private Long pid; |
|||
|
|||
/** 备注 */ |
|||
@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; |
|||
|
|||
/** 最后更新时间 */ |
|||
@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; |
|||
|
|||
/** 所属租户 */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String tenantId; |
|||
|
|||
/** 逻辑删除标记(0:显示;1:隐藏) */ |
|||
@JsonIgnore |
|||
@JsonProperty |
|||
private String delFlag; |
|||
|
|||
/** 创建人 */ |
|||
@TableField(fill = FieldFill.INSERT) |
|||
private String createBy; |
|||
|
|||
/** 更新人 */ |
|||
@TableField(fill = FieldFill.UPDATE) |
|||
private String updateBy; |
|||
|
|||
} |
|||
|
@ -0,0 +1,65 @@ |
|||
package com.qs.serve.modules.bms.entity.bo; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.IdType; |
|||
import com.baomidou.mybatisplus.annotation.TableId; |
|||
import lombok.Data; |
|||
import org.hibernate.validator.constraints.Length; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import javax.validation.constraints.NotNull; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2022/11/7 |
|||
*/ |
|||
@Data |
|||
public class BmsChannelPointBo { |
|||
|
|||
/** id */ |
|||
@TableId(type = IdType.AUTO) |
|||
private Long id; |
|||
|
|||
/** 渠道名称 */ |
|||
@NotNull(message = "渠道名称不能为空") |
|||
private Long channelId; |
|||
|
|||
/** 站点编码 */ |
|||
@NotBlank(message = "站点编码不能为空") |
|||
@Length(max = 50,message = "站点编码长度不能超过50字") |
|||
private String pointCode; |
|||
|
|||
/** 站点名称 */ |
|||
@NotBlank(message = "站点名称不能为空") |
|||
@Length(max = 30,message = "站点名称长度不能超过30字") |
|||
private String pointName; |
|||
|
|||
/** 店铺面积 */ |
|||
@NotBlank(message = "店铺面积不能为空") |
|||
@Length(max = 255,message = "店铺面积长度不能超过255字") |
|||
private String shopArea; |
|||
|
|||
/** 收银台数量 */ |
|||
@NotNull(message = "收银台数量不能为空") |
|||
private Integer countCheckstand; |
|||
|
|||
/** 站点等级(读取字典值) */ |
|||
@Length(max = 255,message = "站点等级(读取字典值)长度不能超过255字") |
|||
private String pointLevel; |
|||
|
|||
/** 详细地址 */ |
|||
@Length(max = 255,message = "详细地址长度不能超过255字") |
|||
private String address; |
|||
|
|||
/** 销售区域id */ |
|||
@NotNull(message = "销售区域id不能为空") |
|||
private Long saleRegionId; |
|||
|
|||
/** 行政区域id */ |
|||
@NotNull(message = "行政区域id不能为空") |
|||
private Long bizRegionId; |
|||
|
|||
/** 备注 */ |
|||
@Length(max = 255,message = "备注长度不能超过255字") |
|||
private String remark; |
|||
|
|||
} |
@ -0,0 +1,38 @@ |
|||
package com.qs.serve.modules.bms.entity.vo; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.IdType; |
|||
import com.baomidou.mybatisplus.annotation.TableId; |
|||
import com.qs.serve.common.model.dto.TreeNode; |
|||
import lombok.Data; |
|||
import org.hibernate.validator.constraints.Length; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import javax.validation.constraints.NotNull; |
|||
|
|||
/** |
|||
* @author YenHex |
|||
* @since 2022/11/7 |
|||
*/ |
|||
@Data |
|||
public class BmsSubjectTreeVo extends TreeNode { |
|||
|
|||
/** 科目名称 */ |
|||
@NotBlank(message = "科目名称不能为空") |
|||
@Length(max = 50,message = "科目名称长度不能超过50字") |
|||
private String subjectName; |
|||
|
|||
/** 科目编码 */ |
|||
@NotBlank(message = "科目编码不能为空") |
|||
@Length(max = 50,message = "科目编码长度不能超过50字") |
|||
private String subjectCode; |
|||
|
|||
/** 父级id */ |
|||
@NotNull(message = "父级id不能为空") |
|||
private Long pid; |
|||
|
|||
/** 备注 */ |
|||
@Length(max = 255,message = "备注长度不能超过255字") |
|||
private String remark; |
|||
|
|||
|
|||
} |
@ -0,0 +1,14 @@ |
|||
package com.qs.serve.modules.bms.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.qs.serve.modules.bms.entity.BmsSubject; |
|||
|
|||
/** |
|||
* 科目 Mapper |
|||
* @author YenHex |
|||
* @date 2022-11-07 |
|||
*/ |
|||
public interface BmsSubjectMapper extends BaseMapper<BmsSubject> { |
|||
|
|||
} |
|||
|
@ -0,0 +1,14 @@ |
|||
package com.qs.serve.modules.bms.service; |
|||
|
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
import com.qs.serve.modules.bms.entity.BmsSubject; |
|||
|
|||
/** |
|||
* 科目 服务接口 |
|||
* @author YenHex |
|||
* @date 2022-11-07 |
|||
*/ |
|||
public interface BmsSubjectService extends IService<BmsSubject> { |
|||
|
|||
} |
|||
|
@ -0,0 +1,22 @@ |
|||
package com.qs.serve.modules.bms.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.bms.entity.BmsSubject; |
|||
import com.qs.serve.modules.bms.service.BmsSubjectService; |
|||
import com.qs.serve.modules.bms.mapper.BmsSubjectMapper; |
|||
|
|||
/** |
|||
* 科目 服务实现类 |
|||
* @author YenHex |
|||
* @since 2022-11-07 |
|||
*/ |
|||
@Slf4j |
|||
@Service |
|||
@AllArgsConstructor |
|||
public class BmsSubjectServiceImpl extends ServiceImpl<BmsSubjectMapper,BmsSubject> implements BmsSubjectService { |
|||
|
|||
} |
|||
|
@ -0,0 +1,103 @@ |
|||
package com.qs.serve.modules.sys.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 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.sys.entity.SysDictData; |
|||
import com.qs.serve.modules.sys.service.SysDictDataService; |
|||
|
|||
import javax.validation.Valid; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 系统 字典数据 |
|||
* @author YenHex |
|||
* @since 2022-11-04 |
|||
*/ |
|||
@Slf4j |
|||
@AllArgsConstructor |
|||
@RestController |
|||
@RequestMapping("sys/dictData") |
|||
public class SysDictDataController { |
|||
|
|||
private SysDictDataService sysDictDataService; |
|||
|
|||
/** |
|||
* 翻页 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@GetMapping("/page") |
|||
@PreAuthorize("hasRole('sys:dictData:query')") |
|||
public R<PageVo<SysDictData>> getPage(SysDictData param){ |
|||
PageUtil.startPage(); |
|||
LambdaQueryWrapper<SysDictData> dictDataWrapper = new LambdaQueryWrapper<>(param); |
|||
List<SysDictData> list = sysDictDataService.list(dictDataWrapper); |
|||
return R.byPageHelperList(list); |
|||
} |
|||
|
|||
/** |
|||
* ID查询 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@GetMapping("/getById/{id}") |
|||
@SysLog(module = SystemModule.SYSTEM, title = "字典数据", biz = BizType.QUERY) |
|||
@PreAuthorize("hasRole('sys:dictData:query')") |
|||
public R<SysDictData> getById(@PathVariable("id") String id){ |
|||
SysDictData sysDictData = sysDictDataService.getById(id); |
|||
return R.ok(sysDictData); |
|||
} |
|||
|
|||
|
|||
|
|||
/** |
|||
* 更新 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping("/updateById") |
|||
@SysLog(module = SystemModule.SYSTEM, title = "字典数据", biz = BizType.UPDATE) |
|||
@PreAuthorize("hasRole('sys:dictData:update')") |
|||
public R<?> updateById(@RequestBody @Valid SysDictData param){ |
|||
boolean result = sysDictDataService.updateById(param); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
/** |
|||
* 新增 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping("/save") |
|||
@SysLog(module = SystemModule.SYSTEM, title = "字典数据", biz = BizType.INSERT) |
|||
@PreAuthorize("hasRole('sys:dictData:insert')") |
|||
public R<?> save(@RequestBody @Valid SysDictData param){ |
|||
boolean result = sysDictDataService.save(param); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
/** |
|||
* 删除 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@DeleteMapping("/deleteById/{id}") |
|||
@SysLog(module = SystemModule.SYSTEM, title = "字典数据", biz = BizType.DELETE) |
|||
@PreAuthorize("hasRole('sys:dictData:delete')") |
|||
public R<?> deleteById(@PathVariable("id") Long id){ |
|||
boolean result = sysDictDataService.removeById(id); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,85 @@ |
|||
package com.qs.serve.modules.sys.entity; |
|||
|
|||
import java.time.LocalDateTime; |
|||
import java.io.Serializable; |
|||
|
|||
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-04 |
|||
*/ |
|||
@Data |
|||
@TableName("sys_dict_data") |
|||
public class SysDictData implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** id */ |
|||
@TableId(type = IdType.AUTO) |
|||
private Long id; |
|||
|
|||
/** 字典id */ |
|||
private Long dictId; |
|||
|
|||
/** 字典key */ |
|||
@Length(max = 50,message = "字典key长度不能超过50字") |
|||
private String groupKey; |
|||
|
|||
/** 数据值 */ |
|||
@Length(max = 50,message = "数据值长度不能超过50字") |
|||
private String keyVal; |
|||
|
|||
/** 数据标题 */ |
|||
@Length(max = 50,message = "数据标题长度不能超过50字") |
|||
private String label; |
|||
|
|||
/** 排序 */ |
|||
private Integer sort; |
|||
|
|||
/** 备注 */ |
|||
@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; |
|||
|
|||
} |
|||
|
@ -0,0 +1,14 @@ |
|||
package com.qs.serve.modules.sys.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.qs.serve.modules.sys.entity.SysDictData; |
|||
|
|||
/** |
|||
* 字典数据 Mapper |
|||
* @author YenHex |
|||
* @date 2022-11-04 |
|||
*/ |
|||
public interface SysDictDataMapper extends BaseMapper<SysDictData> { |
|||
|
|||
} |
|||
|
@ -0,0 +1,14 @@ |
|||
package com.qs.serve.modules.sys.service; |
|||
|
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
import com.qs.serve.modules.sys.entity.SysDictData; |
|||
|
|||
/** |
|||
* 字典数据 服务接口 |
|||
* @author YenHex |
|||
* @date 2022-11-04 |
|||
*/ |
|||
public interface SysDictDataService extends IService<SysDictData> { |
|||
|
|||
} |
|||
|
@ -0,0 +1,22 @@ |
|||
package com.qs.serve.modules.sys.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.sys.entity.SysDictData; |
|||
import com.qs.serve.modules.sys.service.SysDictDataService; |
|||
import com.qs.serve.modules.sys.mapper.SysDictDataMapper; |
|||
|
|||
/** |
|||
* 字典数据 服务实现类 |
|||
* @author YenHex |
|||
* @since 2022-11-04 |
|||
*/ |
|||
@Slf4j |
|||
@Service |
|||
@AllArgsConstructor |
|||
public class SysDictDataServiceImpl extends ServiceImpl<SysDictDataMapper,SysDictData> implements SysDictDataService { |
|||
|
|||
} |
|||
|
Loading…
Reference in new issue