109 lines
3.9 KiB
Java
109 lines
3.9 KiB
Java
package com.gunshi.project.hsz.controller;
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.gunshi.core.annotation.Get;
|
|
import com.gunshi.core.annotation.Post;
|
|
import com.gunshi.core.result.R;
|
|
import com.gunshi.file.model.FileDescriptor;
|
|
import com.gunshi.project.hsz.entity.so.RescueGoodsPageSo;
|
|
import com.gunshi.project.hsz.model.RescueGoodsB;
|
|
import com.gunshi.project.hsz.model.RescueGoodsFile;
|
|
import com.gunshi.project.hsz.model.RescueGoodsFileAutoDao;
|
|
import com.gunshi.project.hsz.model.RescueGoodsFileAutoMapper;
|
|
import com.gunshi.project.hsz.service.AbstractModelWithAttachService;
|
|
import com.gunshi.project.hsz.service.RescueGoodsService;
|
|
import io.swagger.v3.oas.annotations.media.Schema;
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
import java.io.Serializable;
|
|
import java.util.Date;
|
|
import java.util.List;
|
|
|
|
/**
|
|
* Description:
|
|
* Created by wanyan on 2024/3/18
|
|
*
|
|
* @author wanyan
|
|
* @version 1.0
|
|
*/
|
|
@Tag(name = "抢险物资")
|
|
@RestController
|
|
@RequestMapping("/rescue/goods")
|
|
public class RescueGoodsBController extends AbstractCommonFileController implements
|
|
ICommonInsertWithAttach<RescueGoodsB, com.gunshi.project.hsz.model.RescueGoodsBAutoMapper, com.gunshi.project.hsz.model.RescueGoodsBAutoDao, RescueGoodsFile, RescueGoodsFileAutoMapper, RescueGoodsFileAutoDao>,
|
|
ICommonUpdateByIdWithAttach<RescueGoodsB, com.gunshi.project.hsz.model.RescueGoodsBAutoMapper, com.gunshi.project.hsz.model.RescueGoodsBAutoDao, RescueGoodsFile, RescueGoodsFileAutoMapper, RescueGoodsFileAutoDao>,
|
|
ICommonDeleteByIdWithAttach<RescueGoodsB, com.gunshi.project.hsz.model.RescueGoodsBAutoMapper, com.gunshi.project.hsz.model.RescueGoodsBAutoDao, RescueGoodsFile, RescueGoodsFileAutoMapper, RescueGoodsFileAutoDao>,
|
|
ICommonQueryAttach<RescueGoodsFile, Long, RescueGoodsFileAutoMapper, RescueGoodsFileAutoDao>
|
|
{
|
|
|
|
|
|
@Autowired
|
|
private RescueGoodsFileAutoDao fileAutoDao;
|
|
|
|
@Autowired
|
|
private RescueGoodsService rescueGoodsService;
|
|
|
|
|
|
@Override
|
|
public void customSetFieldForUpdate(RescueGoodsB model) {
|
|
model.setTm(new Date());
|
|
}
|
|
|
|
@Override
|
|
public RescueGoodsFileAutoDao getAttachAutoDao() {
|
|
return fileAutoDao;
|
|
}
|
|
|
|
@Override
|
|
public String getAttachBzIdName() {
|
|
return "goods_id";
|
|
}
|
|
|
|
@Override
|
|
public Long getId(Serializable id) {
|
|
return Long.valueOf(id.toString());
|
|
}
|
|
|
|
@Override
|
|
public AbstractModelWithAttachService<RescueGoodsB, com.gunshi.project.hsz.model.RescueGoodsBAutoMapper, com.gunshi.project.hsz.model.RescueGoodsBAutoDao, RescueGoodsFile, RescueGoodsFileAutoMapper, RescueGoodsFileAutoDao> getModelService() {
|
|
return rescueGoodsService;
|
|
}
|
|
|
|
@Override
|
|
public void customSetFieldForInsert(RescueGoodsB model) {
|
|
long id = IdWorker.getId();
|
|
model.setGoodsId(id);
|
|
model.setTm(new Date());
|
|
}
|
|
|
|
@Override
|
|
public String getGroupId() {
|
|
return "rescueGoodsB";
|
|
}
|
|
|
|
|
|
/**
|
|
* 分页查询
|
|
*/
|
|
@Post(path = "/page/query", summary = "分页查询")
|
|
public R<Page<RescueGoodsB>> pageQuery(@RequestBody @Validated RescueGoodsPageSo RescueGoodsPageSo) {
|
|
return R.ok(rescueGoodsService.pageQuery(RescueGoodsPageSo));
|
|
}
|
|
|
|
/**
|
|
* 详情
|
|
*/
|
|
@Get(path = "/detail", summary = "详情")
|
|
public R<List<FileDescriptor>> detail(@Schema(name = "goodsId",description = "物资id") @RequestParam(name = "goodsId") Long goodsId) {
|
|
return R.ok(rescueGoodsService.detail(goodsId));
|
|
}
|
|
|
|
}
|