|
|
@@ -7,21 +7,29 @@ import cn.vber.breeding.domain.Batch;
|
|
|
import cn.vber.breeding.domain.bo.BatchBo;
|
|
|
import cn.vber.breeding.domain.bo.WingTagBo;
|
|
|
import cn.vber.breeding.domain.vo.BatchVo;
|
|
|
+import cn.vber.breeding.domain.vo.FamilyVo;
|
|
|
import cn.vber.breeding.domain.vo.WingTagVo;
|
|
|
import cn.vber.breeding.mapper.BatchMapper;
|
|
|
+import cn.vber.breeding.mapper.WingTagMapper;
|
|
|
import cn.vber.breeding.service.IBatchService;
|
|
|
import cn.vber.breeding.service.IWingTagService;
|
|
|
+import cn.vber.common.core.domain.R;
|
|
|
import cn.vber.common.mybatis.core.page.PageQuery;
|
|
|
import cn.vber.common.mybatis.core.page.TableDataInfo;
|
|
|
import cn.vber.common.web.core.BaseController;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.vber.app.domain.bo.BatchChickenCreateBo;
|
|
|
+import com.vber.app.domain.bo.ChickenChangeCageBo;
|
|
|
+import com.vber.app.domain.bo.ChickenCullBo;
|
|
|
+import com.vber.app.domain.bo.ChickenWightCreateBo;
|
|
|
+import com.vber.app.service.IBreedingService;
|
|
|
+import com.vber.app.service.IGeneralService;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
-import org.springframework.web.bind.annotation.GetMapping;
|
|
|
-import org.springframework.web.bind.annotation.PostMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
|
|
|
@Validated
|
|
|
@RequiredArgsConstructor
|
|
|
@@ -29,35 +37,63 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
@RequestMapping("/app/breeding")
|
|
|
public class BreedingController extends BaseController {
|
|
|
|
|
|
- private final IWingTagService wingTagService;
|
|
|
- private final BatchMapper batchMapper;
|
|
|
+ private IGeneralService generalService;
|
|
|
+ private IBreedingService breedingService;
|
|
|
|
|
|
/**
|
|
|
* 查询批次信息列表
|
|
|
*/
|
|
|
@SaCheckPermission("app:breeding:batch")
|
|
|
- @GetMapping("/listBatch")
|
|
|
- public TableDataInfo<BatchVo> list(BatchBo bo, PageQuery pageQuery) {
|
|
|
- LambdaQueryWrapper<Batch> lqw = new LambdaQueryWrapper<>();
|
|
|
- lqw.and(wrapper->{
|
|
|
- wrapper.eq(Batch::getStatus, BatchStatusEnum.CREATED.getCode());
|
|
|
- wrapper.or().eq(Batch::getStatus, BatchStatusEnum.GROWING.getCode());
|
|
|
- });
|
|
|
- lqw.eq(bo.getBatchType()!=null, Batch::getBatchType, bo.getBatchType());
|
|
|
- Page<BatchVo> result = batchMapper.selectVoPage(pageQuery.build(), lqw);
|
|
|
+ @GetMapping("/listBatch/{keyword}")
|
|
|
+ public TableDataInfo<BatchVo> listBatch(@PathVariable String keyword, PageQuery pageQuery) {
|
|
|
+ Page<BatchVo> result = generalService.queryBatchList(keyword, pageQuery);
|
|
|
return TableDataInfo.build(result);
|
|
|
}
|
|
|
|
|
|
@SaCheckPermission("app:breeding:batch")
|
|
|
- @GetMapping("/listWingTag")
|
|
|
- public TableDataInfo<WingTagVo> listWingTag(WingTagBo bo, PageQuery pageQuery) {
|
|
|
- return wingTagService.queryPageList(bo, pageQuery);
|
|
|
+ @GetMapping("/listWingTagPage/{batchNum}/{keyword}")
|
|
|
+ public TableDataInfo<WingTagVo> listWingTag(@PathVariable String batchNum, @PathVariable String keyword, PageQuery pageQuery) {
|
|
|
+ Page<WingTagVo> wingTagVoPage = generalService.queryWingTagList(batchNum, keyword, pageQuery);
|
|
|
+ return TableDataInfo.build(wingTagVoPage);
|
|
|
+ }
|
|
|
+
|
|
|
+ @SaCheckPermission("app:breeding:batch")
|
|
|
+ @GetMapping("/listWingTag/{batchNum}/{keyword}")
|
|
|
+ public R<List<WingTagVo>> listWingTag(@PathVariable String batchNum, @PathVariable String keyword) {
|
|
|
+ var wingTagVoList = generalService.queryWingTagListNoPage(batchNum, keyword);
|
|
|
+ return R.ok(wingTagVoList);
|
|
|
+ }
|
|
|
+
|
|
|
+ @SaCheckPermission("app:breeding:batch")
|
|
|
+ @GetMapping("/listFamily/{keyword}")
|
|
|
+ public TableDataInfo<FamilyVo> listFamily(@PathVariable String keyword, PageQuery pageQuery) {
|
|
|
+ Page<FamilyVo> familyVoPage = generalService.queryFamilyList(keyword, pageQuery);
|
|
|
+ return TableDataInfo.build(familyVoPage);
|
|
|
}
|
|
|
|
|
|
@SaCheckPermission("app:breeding:batch")
|
|
|
@PostMapping("/addChicken")
|
|
|
- public TableDataInfo<WingTagVo> add(WingTagBo bo, PageQuery pageQuery) {
|
|
|
- return wingTagService.queryPageList(bo, pageQuery);
|
|
|
+ public R<Boolean> addChicken(List<BatchChickenCreateBo> input) {
|
|
|
+ boolean b = breedingService.chickenInsert(input);
|
|
|
+ return R.ok(b);
|
|
|
+ }
|
|
|
+
|
|
|
+ @SaCheckPermission("app:breeding:batch")
|
|
|
+ @PostMapping("/changeCage")
|
|
|
+ public R<Boolean> changeCage(ChickenChangeCageBo input) {
|
|
|
+ return R.ok(breedingService.changeCage(input));
|
|
|
+ }
|
|
|
+
|
|
|
+ @SaCheckPermission("app:breeding:batch")
|
|
|
+ @PostMapping("/cullChicken")
|
|
|
+ public R<Boolean> cullChicken(List<ChickenCullBo> input) {
|
|
|
+ return R.ok(breedingService.cullChicken(input));
|
|
|
+ }
|
|
|
+
|
|
|
+ @SaCheckPermission("app:breeding:batch")
|
|
|
+ @PostMapping("/chickenWeight")
|
|
|
+ public R<Boolean> chickenWeight(List<ChickenWightCreateBo> input) {
|
|
|
+ return R.ok(breedingService.chickenWeight(input));
|
|
|
}
|
|
|
|
|
|
}
|