6 changed files with 320 additions and 0 deletions
@ -0,0 +1,128 @@ |
|||
package com.qs.serve.modules.tbs.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.AuthContextUtils; |
|||
import com.qs.serve.common.util.PageUtil; |
|||
import com.qs.serve.common.util.CopierUtil; |
|||
import com.qs.serve.common.util.StringUtils; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import com.qs.serve.modules.tbs.entity.bo.TbsCostTodoBo; |
|||
import com.qs.serve.modules.tbs.entity.TbsCostTodo; |
|||
import com.qs.serve.modules.tbs.service.TbsCostTodoService; |
|||
|
|||
import javax.validation.Valid; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 预算 费用申请代办 |
|||
* @author YenHex |
|||
* @since 2023-02-17 |
|||
*/ |
|||
@Slf4j |
|||
@AllArgsConstructor |
|||
@RestController |
|||
@RequestMapping("tbs/costTodo") |
|||
public class TbsCostTodoController { |
|||
|
|||
private TbsCostTodoService tbsCostTodoService; |
|||
|
|||
/** |
|||
* 列表 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@GetMapping("/list") |
|||
public R<List<TbsCostTodo>> getList(TbsCostTodo param){ |
|||
param.setCreateBy(AuthContextUtils.getSysUserId()); |
|||
LambdaQueryWrapper<TbsCostTodo> lqw = new LambdaQueryWrapper<>(param); |
|||
PageUtil.startPage(); |
|||
List<TbsCostTodo> list = tbsCostTodoService.list(lqw); |
|||
return R.ok(list); |
|||
} |
|||
|
|||
/** |
|||
* 翻页 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@GetMapping("/page") |
|||
public R<PageVo<TbsCostTodo>> getPage(TbsCostTodo param){ |
|||
param.setCreateBy(AuthContextUtils.getSysUserId()); |
|||
LambdaQueryWrapper<TbsCostTodo> lqw = new LambdaQueryWrapper<>(param); |
|||
PageUtil.startPage(); |
|||
List<TbsCostTodo> list = tbsCostTodoService.list(lqw); |
|||
return R.byPageHelperList(list); |
|||
} |
|||
|
|||
/** |
|||
* ID查询 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@GetMapping("/getById/{id}") |
|||
public R<TbsCostTodo> getById(@PathVariable("id") String id){ |
|||
TbsCostTodo tbsCostTodo = tbsCostTodoService.getById(id); |
|||
String userId = AuthContextUtils.getSysUserId(); |
|||
if(!tbsCostTodo.getCreateBy().equals(userId)){ |
|||
return R.ok(); |
|||
} |
|||
return R.ok(tbsCostTodo); |
|||
} |
|||
|
|||
|
|||
|
|||
/** |
|||
* 更新 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping("/updateById") |
|||
public R<?> updateById(@RequestBody @Valid TbsCostTodoBo param){ |
|||
TbsCostTodo entity = CopierUtil.copy(param,new TbsCostTodo()); |
|||
String userId = AuthContextUtils.getSysUserId(); |
|||
TbsCostTodo tbsCostTodo = tbsCostTodoService.getById(param.getId()); |
|||
if(!tbsCostTodo.getCreateBy().equals(userId)){ |
|||
return R.ok(); |
|||
} |
|||
boolean result = tbsCostTodoService.updateById(entity); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
/** |
|||
* 新增 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping("/save") |
|||
public R<?> save(@RequestBody @Valid TbsCostTodoBo param){ |
|||
TbsCostTodo entity = CopierUtil.copy(param,new TbsCostTodo()); |
|||
boolean result = tbsCostTodoService.save(entity); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
/** |
|||
* 删除 |
|||
* @param ids |
|||
* @return |
|||
*/ |
|||
@DeleteMapping("/deleteById/{ids}") |
|||
public R<?> deleteById(@PathVariable("ids") String ids){ |
|||
List<Long> idsLong = StringUtils.splitIdLong(ids); |
|||
String userId = AuthContextUtils.getSysUserId(); |
|||
LambdaQueryWrapper<TbsCostTodo> lqw = new LambdaQueryWrapper<>(); |
|||
lqw.in(TbsCostTodo::getId,idsLong); |
|||
lqw.eq(TbsCostTodo::getCreateBy,userId); |
|||
boolean result = tbsCostTodoService.remove(lqw); |
|||
return R.isTrue(result); |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,85 @@ |
|||
package com.qs.serve.modules.tbs.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-02-17 |
|||
*/ |
|||
@Data |
|||
@TableName("tbs_cost_todo") |
|||
public class TbsCostTodo implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** id */ |
|||
@TableId(type = IdType.AUTO) |
|||
private Long id; |
|||
|
|||
/** 费用申请id */ |
|||
@NotNull(message = "费用申请id不能为空") |
|||
private Long costApplyId; |
|||
|
|||
/** 涉及品牌 */ |
|||
@NotBlank(message = "涉及品牌不能为空") |
|||
@Length(max = 255,message = "涉及品牌长度不能超过255字") |
|||
private String brands; |
|||
|
|||
/** 描述 */ |
|||
@NotBlank(message = "描述不能为空") |
|||
@Length(max = 255,message = "描述长度不能超过255字") |
|||
private String descr; |
|||
|
|||
/** 对应价值 */ |
|||
private BigDecimal amount; |
|||
|
|||
/** 完成状态 */ |
|||
@NotNull(message = "完成状态不能为空") |
|||
private Integer finishedFlag; |
|||
|
|||
/** 备注 */ |
|||
@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; |
|||
|
|||
} |
|||
|
@ -0,0 +1,57 @@ |
|||
package com.qs.serve.modules.tbs.entity.bo; |
|||
|
|||
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; |
|||
|
|||
/** |
|||
* 费用申请代办 Bo |
|||
* @author YenHex |
|||
* @since 2023-02-17 |
|||
*/ |
|||
@Data |
|||
public class TbsCostTodoBo implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** id */ |
|||
private Long id; |
|||
|
|||
/** 费用申请id */ |
|||
@NotNull(message = "费用申请id不能为空") |
|||
private Long costApplyId; |
|||
|
|||
/** 涉及品牌 */ |
|||
@NotBlank(message = "涉及品牌不能为空") |
|||
@Length(max = 255,message = "涉及品牌长度不能超过255字") |
|||
private String brands; |
|||
|
|||
/** 描述 */ |
|||
@NotBlank(message = "描述不能为空") |
|||
@Length(max = 255,message = "描述长度不能超过255字") |
|||
private String descr; |
|||
|
|||
/** 对应价值 */ |
|||
private BigDecimal amount; |
|||
|
|||
/** 完成状态 0-否、1-是 */ |
|||
@NotNull(message = "完成状态不能为空") |
|||
private Integer finishedFlag; |
|||
|
|||
/** 备注 */ |
|||
@Length(max = 255,message = "备注长度不能超过255字") |
|||
private String remark; |
|||
|
|||
} |
|||
|
@ -0,0 +1,14 @@ |
|||
package com.qs.serve.modules.tbs.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.qs.serve.modules.tbs.entity.TbsCostTodo; |
|||
|
|||
/** |
|||
* 费用申请代办 Mapper |
|||
* @author YenHex |
|||
* @date 2023-02-17 |
|||
*/ |
|||
public interface TbsCostTodoMapper extends BaseMapper<TbsCostTodo> { |
|||
|
|||
} |
|||
|
@ -0,0 +1,14 @@ |
|||
package com.qs.serve.modules.tbs.service; |
|||
|
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
import com.qs.serve.modules.tbs.entity.TbsCostTodo; |
|||
|
|||
/** |
|||
* 费用申请代办 服务接口 |
|||
* @author YenHex |
|||
* @date 2023-02-17 |
|||
*/ |
|||
public interface TbsCostTodoService extends IService<TbsCostTodo> { |
|||
|
|||
} |
|||
|
@ -0,0 +1,22 @@ |
|||
package com.qs.serve.modules.tbs.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.tbs.entity.TbsCostTodo; |
|||
import com.qs.serve.modules.tbs.service.TbsCostTodoService; |
|||
import com.qs.serve.modules.tbs.mapper.TbsCostTodoMapper; |
|||
|
|||
/** |
|||
* 费用申请代办 服务实现类 |
|||
* @author YenHex |
|||
* @since 2023-02-17 |
|||
*/ |
|||
@Slf4j |
|||
@Service |
|||
@AllArgsConstructor |
|||
public class TbsCostTodoServiceImpl extends ServiceImpl<TbsCostTodoMapper,TbsCostTodo> implements TbsCostTodoService { |
|||
|
|||
} |
|||
|
Loading…
Reference in new issue