10 changed files with 322 additions and 1 deletions
@ -0,0 +1,19 @@ |
|||||
|
package com.qs.serve.modules.bir.entity.vo; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.math.BigDecimal; |
||||
|
|
||||
|
@Data |
||||
|
public class BudgetPlanVo { |
||||
|
|
||||
|
String budgetYear; |
||||
|
|
||||
|
BigDecimal budgetPlanSaleAmout; |
||||
|
|
||||
|
BigDecimal budgetPlanAmount; |
||||
|
|
||||
|
BigDecimal usedAmout; |
||||
|
|
||||
|
BigDecimal plannedAmount; |
||||
|
} |
@ -0,0 +1,124 @@ |
|||||
|
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.PageUtil; |
||||
|
import com.qs.serve.common.util.CopierUtil; |
||||
|
import com.qs.serve.common.util.StringUtils; |
||||
|
import com.qs.serve.modules.tbs.entity.TbsBudgetPlan; |
||||
|
import com.qs.serve.modules.tbs.service.TbsBudgetPlanService; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.security.access.prepost.PreAuthorize; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
|
||||
|
import javax.validation.Valid; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 预算 预算 |
||||
|
* @author YenHex |
||||
|
* @since 2023-07-10 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@AllArgsConstructor |
||||
|
@RestController |
||||
|
@RequestMapping("tbs/budgetPlan") |
||||
|
public class TbsBudgetPlanController { |
||||
|
|
||||
|
private TbsBudgetPlanService tbsBudgetPlanService; |
||||
|
|
||||
|
/** |
||||
|
* 列表 |
||||
|
* @param param |
||||
|
* @return |
||||
|
*/ |
||||
|
//@GetMapping("/list")
|
||||
|
// @PreAuthorize("hasRole('tbs:budgetPlan:query')")
|
||||
|
public R<List<TbsBudgetPlan>> getList(TbsBudgetPlan param){ |
||||
|
TbsBudgetPlan entity = CopierUtil.copy(param,new TbsBudgetPlan()); |
||||
|
LambdaQueryWrapper<TbsBudgetPlan> lqw = new LambdaQueryWrapper<>(entity); |
||||
|
PageUtil.startPage(); |
||||
|
List<TbsBudgetPlan> list = tbsBudgetPlanService.list(lqw); |
||||
|
return R.ok(list); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 翻页 |
||||
|
* @param param |
||||
|
* @return |
||||
|
*/ |
||||
|
@GetMapping("/page") |
||||
|
// @PreAuthorize("hasRole('tbs:budgetPlan:query')")
|
||||
|
public R<PageVo<TbsBudgetPlan>> getPage(TbsBudgetPlan param){ |
||||
|
TbsBudgetPlan entity = CopierUtil.copy(param,new TbsBudgetPlan()); |
||||
|
LambdaQueryWrapper<TbsBudgetPlan> lqw = new LambdaQueryWrapper<>(entity); |
||||
|
PageUtil.startPage(); |
||||
|
List<TbsBudgetPlan> list = tbsBudgetPlanService.list(lqw); |
||||
|
return R.byPageHelperList(list); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* ID查询 |
||||
|
* @param id |
||||
|
* @return |
||||
|
*/ |
||||
|
@GetMapping("/getById/{id}") |
||||
|
@SysLog(module = SystemModule.Budget, title = "预算", biz = BizType.QUERY) |
||||
|
// @PreAuthorize("hasRole('tbs:budgetPlan:query')")
|
||||
|
public R<TbsBudgetPlan> getById(@PathVariable("id") String id){ |
||||
|
TbsBudgetPlan tbsBudgetPlan = tbsBudgetPlanService.getById(id); |
||||
|
return R.ok(tbsBudgetPlan); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 更新 |
||||
|
* @param param |
||||
|
* @return |
||||
|
*/ |
||||
|
@PostMapping("/updateById") |
||||
|
@SysLog(module = SystemModule.Budget, title = "预算", biz = BizType.UPDATE) |
||||
|
// @PreAuthorize("hasRole('tbs:budgetPlan:update')")
|
||||
|
public R<?> updateById(@RequestBody @Valid TbsBudgetPlan param){ |
||||
|
TbsBudgetPlan entity = CopierUtil.copy(param,new TbsBudgetPlan()); |
||||
|
boolean result = tbsBudgetPlanService.updateById(entity); |
||||
|
return R.isTrue(result); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 新增 |
||||
|
* @param param |
||||
|
* @return |
||||
|
*/ |
||||
|
@PostMapping("/save") |
||||
|
@SysLog(module = SystemModule.Budget, title = "预算", biz = BizType.INSERT) |
||||
|
// @PreAuthorize("hasRole('tbs:budgetPlan:insert')")
|
||||
|
public R<?> save(@RequestBody @Valid TbsBudgetPlan param){ |
||||
|
TbsBudgetPlan entity = CopierUtil.copy(param,new TbsBudgetPlan()); |
||||
|
boolean result = tbsBudgetPlanService.save(entity); |
||||
|
return R.isTrue(result); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 删除 |
||||
|
* @param ids |
||||
|
* @return |
||||
|
*/ |
||||
|
@DeleteMapping("/deleteById/{ids}") |
||||
|
@SysLog(module = SystemModule.Budget, title = "预算", biz = BizType.DELETE) |
||||
|
// @PreAuthorize("hasRole('tbs:budgetPlan:delete')")
|
||||
|
public R<?> deleteById(@PathVariable("ids") String ids){ |
||||
|
List<Long> idsLong = StringUtils.splitIdLong(ids); |
||||
|
boolean result = tbsBudgetPlanService.removeByIds(idsLong); |
||||
|
return R.isTrue(result); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
@ -0,0 +1,99 @@ |
|||||
|
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-07-10 |
||||
|
*/ |
||||
|
@Data |
||||
|
@TableName("tbs_budget_plan") |
||||
|
public class TbsBudgetPlan implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** id */ |
||||
|
@TableId(type = IdType.AUTO) |
||||
|
private Long id; |
||||
|
|
||||
|
/** 年度 */ |
||||
|
@NotBlank(message = "年度不能为空") |
||||
|
@Length(max = 255,message = "年度长度不能超过255字") |
||||
|
private String budgetYear; |
||||
|
|
||||
|
/** 年度规划销售金额 */ |
||||
|
@NotNull(message = "年度规划销售金额不能为空") |
||||
|
private BigDecimal budgetPlanSaleAmout; |
||||
|
|
||||
|
/** 年度规划预算金额 */ |
||||
|
@NotNull(message = "年度规划预算金额不能为空") |
||||
|
private BigDecimal budgetPlanAmount; |
||||
|
|
||||
|
/** 备注 */ |
||||
|
@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; |
||||
|
|
||||
|
/** 创建人 */ |
||||
|
@TableField(fill = FieldFill.INSERT) |
||||
|
private String createBy; |
||||
|
|
||||
|
/** 更新人 */ |
||||
|
@TableField(fill = FieldFill.UPDATE) |
||||
|
private String updateBy; |
||||
|
|
||||
|
/** 逻辑删除标记(0:显示;1:隐藏) */ |
||||
|
@JsonIgnore |
||||
|
@JsonProperty |
||||
|
private String delFlag; |
||||
|
|
||||
|
|
||||
|
public static TbsBudgetPlan toNewObject(TbsBudgetPlan source){ |
||||
|
TbsBudgetPlan budgetPlan = new TbsBudgetPlan(); |
||||
|
budgetPlan.setId(source.getId()); |
||||
|
budgetPlan.setBudgetYear(source.getBudgetYear()); |
||||
|
budgetPlan.setBudgetPlanSaleAmout(source.getBudgetPlanSaleAmout()); |
||||
|
budgetPlan.setBudgetPlanAmount(source.getBudgetPlanAmount()); |
||||
|
budgetPlan.setRemark(source.getRemark()); |
||||
|
budgetPlan.setCreateTime(source.getCreateTime()); |
||||
|
budgetPlan.setUpdateTime(source.getUpdateTime()); |
||||
|
budgetPlan.setTenantId(source.getTenantId()); |
||||
|
budgetPlan.setCreateBy(source.getCreateBy()); |
||||
|
budgetPlan.setUpdateBy(source.getUpdateBy()); |
||||
|
budgetPlan.setDelFlag(source.getDelFlag()); |
||||
|
return budgetPlan; |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
@ -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.TbsBudgetPlan; |
||||
|
|
||||
|
/** |
||||
|
* 预算 Mapper |
||||
|
* @author YenHex |
||||
|
* @date 2023-07-10 |
||||
|
*/ |
||||
|
public interface TbsBudgetPlanMapper extends BaseMapper<TbsBudgetPlan> { |
||||
|
|
||||
|
} |
||||
|
|
@ -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.TbsBudgetPlan; |
||||
|
|
||||
|
/** |
||||
|
* 预算 服务接口 |
||||
|
* @author YenHex |
||||
|
* @date 2023-07-10 |
||||
|
*/ |
||||
|
public interface TbsBudgetPlanService extends IService<TbsBudgetPlan> { |
||||
|
|
||||
|
} |
||||
|
|
@ -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.TbsBudgetPlan; |
||||
|
import com.qs.serve.modules.tbs.service.TbsBudgetPlanService; |
||||
|
import com.qs.serve.modules.tbs.mapper.TbsBudgetPlanMapper; |
||||
|
|
||||
|
/** |
||||
|
* 预算 服务实现类 |
||||
|
* @author YenHex |
||||
|
* @since 2023-07-10 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@Service |
||||
|
@AllArgsConstructor |
||||
|
public class TbsBudgetPlanServiceImpl extends ServiceImpl<TbsBudgetPlanMapper,TbsBudgetPlan> implements TbsBudgetPlanService { |
||||
|
|
||||
|
} |
||||
|
|
Loading…
Reference in new issue