33 changed files with 962 additions and 32 deletions
@ -0,0 +1,103 @@ |
|||||
|
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 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.BmsCostCenter; |
||||
|
import com.qs.serve.modules.bms.service.BmsCostCenterService; |
||||
|
|
||||
|
import javax.validation.Valid; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 基础档案 成本中心 |
||||
|
* @author YenHex |
||||
|
* @since 2022-10-13 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@AllArgsConstructor |
||||
|
@RestController |
||||
|
@RequestMapping("bms/costCenter") |
||||
|
public class BmsCostCenterController { |
||||
|
|
||||
|
private BmsCostCenterService bmsCostCenterService; |
||||
|
|
||||
|
/** |
||||
|
* 翻页查询 |
||||
|
* @param param |
||||
|
* @return |
||||
|
*/ |
||||
|
@GetMapping("/page") |
||||
|
@PreAuthorize("hasRole('bms:costCenter:query')") |
||||
|
public R<PageVo<BmsCostCenter>> getPage(BmsCostCenter param){ |
||||
|
PageUtil.startPage(); |
||||
|
LambdaQueryWrapper<BmsCostCenter> costCenterWrapper = new LambdaQueryWrapper<>(param); |
||||
|
List<BmsCostCenter> list = bmsCostCenterService.list(costCenterWrapper); |
||||
|
return R.byPageHelperList(list); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 根据ID查询 |
||||
|
* @param id |
||||
|
* @return |
||||
|
*/ |
||||
|
@GetMapping("/getById/{id}") |
||||
|
@SysLog(module = SystemModule.BASE, title = "成本中心", biz = BizType.QUERY) |
||||
|
@PreAuthorize("hasRole('bms:costCenter:query')") |
||||
|
public R<BmsCostCenter> getById(@PathVariable("id") String id){ |
||||
|
BmsCostCenter bmsCostCenter = bmsCostCenterService.getById(id); |
||||
|
return R.ok(bmsCostCenter); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 根据ID更新 |
||||
|
* @param param |
||||
|
* @return |
||||
|
*/ |
||||
|
@PostMapping("/updateById") |
||||
|
@SysLog(module = SystemModule.BASE, title = "成本中心", biz = BizType.UPDATE) |
||||
|
@PreAuthorize("hasRole('bms:costCenter:update')") |
||||
|
public R<?> updateById(@RequestBody @Valid BmsCostCenter param){ |
||||
|
boolean result = bmsCostCenterService.updateById(param); |
||||
|
return R.isTrue(result); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 新增成本中心 |
||||
|
* @param param |
||||
|
* @return |
||||
|
*/ |
||||
|
@PostMapping("/save") |
||||
|
@SysLog(module = SystemModule.BASE, title = "成本中心", biz = BizType.INSERT) |
||||
|
@PreAuthorize("hasRole('bms:costCenter:insert')") |
||||
|
public R<?> save(@RequestBody @Valid BmsCostCenter param){ |
||||
|
boolean result = bmsCostCenterService.save(param); |
||||
|
return R.isTrue(result); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 删除成本中心 |
||||
|
* @param id |
||||
|
* @return |
||||
|
*/ |
||||
|
@DeleteMapping("/deleteById/{id}") |
||||
|
@SysLog(module = SystemModule.BASE, title = "成本中心", biz = BizType.DELETE) |
||||
|
@PreAuthorize("hasRole('bms:costCenter:delete')") |
||||
|
public R<?> deleteById(@PathVariable("id") String id){ |
||||
|
boolean result = bmsCostCenterService.removeById(id); |
||||
|
return R.isTrue(result); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
@ -0,0 +1,103 @@ |
|||||
|
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 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.BmsErpInfo; |
||||
|
import com.qs.serve.modules.bms.service.BmsErpInfoService; |
||||
|
|
||||
|
import javax.validation.Valid; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 基础档案 ERP信息 |
||||
|
* @author YenHex |
||||
|
* @since 2022-10-13 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@AllArgsConstructor |
||||
|
@RestController |
||||
|
@RequestMapping("bms/erpInfo") |
||||
|
public class BmsErpInfoController { |
||||
|
|
||||
|
private BmsErpInfoService bmsErpInfoService; |
||||
|
|
||||
|
/** |
||||
|
* 翻页查询 |
||||
|
* @param param |
||||
|
* @return |
||||
|
*/ |
||||
|
@GetMapping("/page") |
||||
|
@PreAuthorize("hasRole('bms:erpInfo:query')") |
||||
|
public R<PageVo<BmsErpInfo>> getPage(BmsErpInfo param){ |
||||
|
PageUtil.startPage(); |
||||
|
LambdaQueryWrapper<BmsErpInfo> erpInfoWrapper = new LambdaQueryWrapper<>(param); |
||||
|
List<BmsErpInfo> list = bmsErpInfoService.list(erpInfoWrapper); |
||||
|
return R.byPageHelperList(list); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 根据ID查询 |
||||
|
* @param id |
||||
|
* @return |
||||
|
*/ |
||||
|
@GetMapping("/getById/{id}") |
||||
|
@SysLog(module = SystemModule.BASE, title = "ERP信息", biz = BizType.QUERY) |
||||
|
@PreAuthorize("hasRole('bms:erpInfo:query')") |
||||
|
public R<BmsErpInfo> getById(@PathVariable("id") String id){ |
||||
|
BmsErpInfo bmsErpInfo = bmsErpInfoService.getById(id); |
||||
|
return R.ok(bmsErpInfo); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 根据ID更新 |
||||
|
* @param param |
||||
|
* @return |
||||
|
*/ |
||||
|
@PostMapping("/updateById") |
||||
|
@SysLog(module = SystemModule.BASE, title = "ERP信息", biz = BizType.UPDATE) |
||||
|
@PreAuthorize("hasRole('bms:erpInfo:update')") |
||||
|
public R<?> updateById(@RequestBody @Valid BmsErpInfo param){ |
||||
|
boolean result = bmsErpInfoService.updateById(param); |
||||
|
return R.isTrue(result); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 新增ERP信息 |
||||
|
* @param param |
||||
|
* @return |
||||
|
*/ |
||||
|
@PostMapping("/save") |
||||
|
@SysLog(module = SystemModule.BASE, title = "ERP信息", biz = BizType.INSERT) |
||||
|
@PreAuthorize("hasRole('bms:erpInfo:insert')") |
||||
|
public R<?> save(@RequestBody @Valid BmsErpInfo param){ |
||||
|
boolean result = bmsErpInfoService.save(param); |
||||
|
return R.isTrue(result); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 删除ERP信息 |
||||
|
* @param id |
||||
|
* @return |
||||
|
*/ |
||||
|
@DeleteMapping("/deleteById/{id}") |
||||
|
@SysLog(module = SystemModule.BASE, title = "ERP信息", biz = BizType.DELETE) |
||||
|
@PreAuthorize("hasRole('bms:erpInfo:delete')") |
||||
|
public R<?> deleteById(@PathVariable("id") String id){ |
||||
|
boolean result = bmsErpInfoService.removeById(id); |
||||
|
return R.isTrue(result); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
@ -0,0 +1,77 @@ |
|||||
|
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-10-13 |
||||
|
*/ |
||||
|
@Data |
||||
|
@TableName("bms_cost_center") |
||||
|
public class BmsCostCenter implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** id */ |
||||
|
@TableId(type = IdType.AUTO) |
||||
|
private Long id; |
||||
|
|
||||
|
/** 编码 */ |
||||
|
@NotBlank(message = "编码不能为空") |
||||
|
@Length(max = 20,message = "编码长度不能超过20字") |
||||
|
private String code; |
||||
|
|
||||
|
/** 名称 */ |
||||
|
@NotBlank(message = "名称不能为空") |
||||
|
@Length(max = 20,message = "名称长度不能超过20字") |
||||
|
private String name; |
||||
|
|
||||
|
/** 备注 */ |
||||
|
@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,77 @@ |
|||||
|
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; |
||||
|
|
||||
|
/** |
||||
|
* ERP信息 实体类 |
||||
|
* @author YenHex |
||||
|
* @since 2022-10-13 |
||||
|
*/ |
||||
|
@Data |
||||
|
@TableName("bms_erp_info") |
||||
|
public class BmsErpInfo implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** id */ |
||||
|
@TableId(type = IdType.AUTO) |
||||
|
private Long id; |
||||
|
|
||||
|
/** ERP编码 */ |
||||
|
@NotBlank(message = "ERP编码不能为空") |
||||
|
@Length(max = 20,message = "ERP编码长度不能超过20字") |
||||
|
private String code; |
||||
|
|
||||
|
/** ERP名称 */ |
||||
|
@NotBlank(message = "ERP名称不能为空") |
||||
|
@Length(max = 20,message = "ERP名称长度不能超过20字") |
||||
|
private String name; |
||||
|
|
||||
|
/** 备注 */ |
||||
|
@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,47 @@ |
|||||
|
package com.qs.serve.modules.bms.entity.vo; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
import org.hibernate.validator.constraints.Length; |
||||
|
|
||||
|
import javax.validation.constraints.NotBlank; |
||||
|
import javax.validation.constraints.NotNull; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @author YenHex |
||||
|
* @since 2022/10/13 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class BmsSupplierBatchBo { |
||||
|
|
||||
|
@NotNull |
||||
|
private List<BmsSupplierDto> supplierList; |
||||
|
|
||||
|
@Data |
||||
|
public static class BmsSupplierDto{ |
||||
|
/** id */ |
||||
|
private Long id; |
||||
|
|
||||
|
/** 区域ID */ |
||||
|
private Long regionId; |
||||
|
|
||||
|
/** 详细地址 */ |
||||
|
private String address; |
||||
|
|
||||
|
/** 名称 */ |
||||
|
@NotBlank(message = "名称不能为空") |
||||
|
@Length(max = 20,message = "名称长度不能超过20字") |
||||
|
private String name; |
||||
|
|
||||
|
/** 客户编码 */ |
||||
|
@NotBlank(message = "客户编码不能为空") |
||||
|
@Length(max = 20,message = "客户编码长度不能超过20字") |
||||
|
private String code; |
||||
|
|
||||
|
/** 父级编码,空表无父级 */ |
||||
|
private String parentCode; |
||||
|
|
||||
|
} |
||||
|
|
||||
|
} |
@ -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.BmsCostCenter; |
||||
|
|
||||
|
/** |
||||
|
* 成本中心 Mapper |
||||
|
* @author YenHex |
||||
|
* @date 2022-10-13 |
||||
|
*/ |
||||
|
public interface BmsCostCenterMapper extends BaseMapper<BmsCostCenter> { |
||||
|
|
||||
|
} |
||||
|
|
@ -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.BmsErpInfo; |
||||
|
|
||||
|
/** |
||||
|
* ERP信息 Mapper |
||||
|
* @author YenHex |
||||
|
* @date 2022-10-13 |
||||
|
*/ |
||||
|
public interface BmsErpInfoMapper extends BaseMapper<BmsErpInfo> { |
||||
|
|
||||
|
} |
||||
|
|
@ -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.BmsCostCenter; |
||||
|
|
||||
|
/** |
||||
|
* 成本中心 服务接口 |
||||
|
* @author YenHex |
||||
|
* @date 2022-10-13 |
||||
|
*/ |
||||
|
public interface BmsCostCenterService extends IService<BmsCostCenter> { |
||||
|
|
||||
|
} |
||||
|
|
@ -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.BmsErpInfo; |
||||
|
|
||||
|
/** |
||||
|
* ERP信息 服务接口 |
||||
|
* @author YenHex |
||||
|
* @date 2022-10-13 |
||||
|
*/ |
||||
|
public interface BmsErpInfoService extends IService<BmsErpInfo> { |
||||
|
|
||||
|
} |
||||
|
|
@ -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.BmsCostCenter; |
||||
|
import com.qs.serve.modules.bms.service.BmsCostCenterService; |
||||
|
import com.qs.serve.modules.bms.mapper.BmsCostCenterMapper; |
||||
|
|
||||
|
/** |
||||
|
* 成本中心 服务实现类 |
||||
|
* @author YenHex |
||||
|
* @since 2022-10-13 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@Service |
||||
|
@AllArgsConstructor |
||||
|
public class BmsCostCenterServiceImpl extends ServiceImpl<BmsCostCenterMapper,BmsCostCenter> implements BmsCostCenterService { |
||||
|
|
||||
|
} |
||||
|
|
@ -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.BmsErpInfo; |
||||
|
import com.qs.serve.modules.bms.service.BmsErpInfoService; |
||||
|
import com.qs.serve.modules.bms.mapper.BmsErpInfoMapper; |
||||
|
|
||||
|
/** |
||||
|
* ERP信息 服务实现类 |
||||
|
* @author YenHex |
||||
|
* @since 2022-10-13 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@Service |
||||
|
@AllArgsConstructor |
||||
|
public class BmsErpInfoServiceImpl extends ServiceImpl<BmsErpInfoMapper,BmsErpInfo> implements BmsErpInfoService { |
||||
|
|
||||
|
} |
||||
|
|
@ -0,0 +1,103 @@ |
|||||
|
package com.qs.serve.modules.goods.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.goods.entity.GoodsUnit; |
||||
|
import com.qs.serve.modules.goods.service.GoodsUnitService; |
||||
|
|
||||
|
import javax.validation.Valid; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 商品 单位 后台接口 |
||||
|
* @author YenHex |
||||
|
* @since 2022-10-13 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@AllArgsConstructor |
||||
|
@RestController |
||||
|
@RequestMapping("goods/unit") |
||||
|
public class GoodsUnitController { |
||||
|
|
||||
|
private GoodsUnitService goodsUnitService; |
||||
|
|
||||
|
/** |
||||
|
* 翻页查询 |
||||
|
* @param param |
||||
|
* @return |
||||
|
*/ |
||||
|
@GetMapping("/page") |
||||
|
@PreAuthorize("hasRole('goods:unit:query')") |
||||
|
public R<PageVo<GoodsUnit>> getPage(GoodsUnit param){ |
||||
|
PageUtil.startPage(); |
||||
|
LambdaQueryWrapper<GoodsUnit> unitWrapper = new LambdaQueryWrapper<>(param); |
||||
|
List<GoodsUnit> list = goodsUnitService.list(unitWrapper); |
||||
|
return R.byPageHelperList(list); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 根据ID查询 |
||||
|
* @param id |
||||
|
* @return |
||||
|
*/ |
||||
|
@GetMapping("/getById/{id}") |
||||
|
@SysLog(module = SystemModule.GOODS, title = "单位", biz = BizType.QUERY) |
||||
|
@PreAuthorize("hasRole('goods:unit:query')") |
||||
|
public R<GoodsUnit> getById(@PathVariable("id") String id){ |
||||
|
GoodsUnit goodsUnit = goodsUnitService.getById(id); |
||||
|
return R.ok(goodsUnit); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 根据ID更新 |
||||
|
* @param param |
||||
|
* @return |
||||
|
*/ |
||||
|
@PostMapping("/updateById") |
||||
|
@SysLog(module = SystemModule.GOODS, title = "单位", biz = BizType.UPDATE) |
||||
|
@PreAuthorize("hasRole('goods:unit:update')") |
||||
|
public R<?> updateById(@RequestBody @Valid GoodsUnit param){ |
||||
|
boolean result = goodsUnitService.updateById(param); |
||||
|
return R.isTrue(result); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 新增单位 |
||||
|
* @param param |
||||
|
* @return |
||||
|
*/ |
||||
|
@PostMapping("/save") |
||||
|
@SysLog(module = SystemModule.GOODS, title = "单位", biz = BizType.INSERT) |
||||
|
@PreAuthorize("hasRole('goods:unit:insert')") |
||||
|
public R<?> save(@RequestBody @Valid GoodsUnit param){ |
||||
|
boolean result = goodsUnitService.save(param); |
||||
|
return R.isTrue(result); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 删除单位 |
||||
|
* @param id |
||||
|
* @return |
||||
|
*/ |
||||
|
@DeleteMapping("/deleteById/{id}") |
||||
|
@SysLog(module = SystemModule.GOODS, title = "单位", biz = BizType.DELETE) |
||||
|
@PreAuthorize("hasRole('goods:unit:delete')") |
||||
|
public R<?> deleteById(@PathVariable("id") String id){ |
||||
|
boolean result = goodsUnitService.removeById(id); |
||||
|
return R.isTrue(result); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
@ -0,0 +1,71 @@ |
|||||
|
package com.qs.serve.modules.goods.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-10-13 |
||||
|
*/ |
||||
|
@Data |
||||
|
@TableName("goods_unit") |
||||
|
public class GoodsUnit implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** PK */ |
||||
|
@TableId(type = IdType.AUTO) |
||||
|
private Long id; |
||||
|
|
||||
|
/** 名称 */ |
||||
|
@Length(max = 16,message = "名称长度不能超过16字") |
||||
|
private String name; |
||||
|
|
||||
|
/** 描述 */ |
||||
|
@Length(max = 255,message = "描述长度不能超过255字") |
||||
|
private String description; |
||||
|
|
||||
|
/** 创建时间 */ |
||||
|
@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,14 @@ |
|||||
|
package com.qs.serve.modules.goods.mapper; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
import com.qs.serve.modules.goods.entity.GoodsUnit; |
||||
|
|
||||
|
/** |
||||
|
* 单位 Mapper |
||||
|
* @author YenHex |
||||
|
* @date 2022-10-13 |
||||
|
*/ |
||||
|
public interface GoodsUnitMapper extends BaseMapper<GoodsUnit> { |
||||
|
|
||||
|
} |
||||
|
|
@ -0,0 +1,16 @@ |
|||||
|
package com.qs.serve.modules.goods.service; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||
|
import com.qs.serve.modules.goods.entity.GoodsUnit; |
||||
|
|
||||
|
/** |
||||
|
* 单位 服务接口 |
||||
|
* @author YenHex |
||||
|
* @date 2022-10-13 |
||||
|
*/ |
||||
|
public interface GoodsUnitService extends IService<GoodsUnit> { |
||||
|
|
||||
|
GoodsUnit getByName(String name); |
||||
|
|
||||
|
} |
||||
|
|
@ -0,0 +1,30 @@ |
|||||
|
package com.qs.serve.modules.goods.service.impl; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
|
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.goods.entity.GoodsUnit; |
||||
|
import com.qs.serve.modules.goods.service.GoodsUnitService; |
||||
|
import com.qs.serve.modules.goods.mapper.GoodsUnitMapper; |
||||
|
|
||||
|
/** |
||||
|
* 单位 服务实现类 |
||||
|
* @author YenHex |
||||
|
* @since 2022-10-13 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@Service |
||||
|
@AllArgsConstructor |
||||
|
public class GoodsUnitServiceImpl extends ServiceImpl<GoodsUnitMapper,GoodsUnit> implements GoodsUnitService { |
||||
|
|
||||
|
@Override |
||||
|
public GoodsUnit getByName(String name) { |
||||
|
LambdaQueryWrapper<GoodsUnit> lqw = new LambdaQueryWrapper<>(); |
||||
|
lqw.eq(GoodsUnit::getName,name); |
||||
|
return getOne(lqw,false); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
Loading…
Reference in new issue