perf: 查询增加type参数

dev
huangfeng 1 year ago
parent 450e462bd3
commit f6a1323c3c

@ -28,8 +28,8 @@ public class UpgradeController extends BaseController {
@GetMapping("listAll") @GetMapping("listAll")
@ApiOperation("查询全部列表") @ApiOperation("查询全部列表")
public ResponseReult<List<MntnUpgrades>> listAll() { public ResponseReult<List<MntnUpgrades>> listAll(Integer type) {
List<MntnUpgrades> result = service.listAll(); List<MntnUpgrades> result = service.listAll(type);
return ResponseReult.success(result); return ResponseReult.success(result);
} }
@ -41,7 +41,8 @@ public class UpgradeController extends BaseController {
if (file == null) { if (file == null) {
throw new ApiException("缺少上传的文件"); throw new ApiException("缺少上传的文件");
} }
if (StringUtils.isBlank(file.getOriginalFilename()) || !file.getOriginalFilename().endsWith(".apk")) { if (StringUtils.isBlank(file.getOriginalFilename()) ||
!file.getOriginalFilename().endsWith(".apk") && !file.getOriginalFilename().endsWith(".zip")) {
throw new ApiException("文件格式不正确"); throw new ApiException("文件格式不正确");
} }
MntnUpgrades record = new MntnUpgrades(); MntnUpgrades record = new MntnUpgrades();

@ -33,9 +33,12 @@ public class UpgradeServiceImpl implements UpgradeService {
MntnUpgradesMapper mapper; MntnUpgradesMapper mapper;
@Override @Override
public List<MntnUpgrades> listAll() { public List<MntnUpgrades> listAll(Integer type) {
MntnUpgradesExample example = new MntnUpgradesExample(); MntnUpgradesExample example = new MntnUpgradesExample();
MntnUpgradesExample.Criteria criteria = example.createCriteria(); MntnUpgradesExample.Criteria criteria = example.createCriteria();
if (type != null) {
criteria.andTypeEqualTo(type);
}
example.setOrderByClause("id desc"); example.setOrderByClause("id desc");
List<MntnUpgrades> list = mapper.selectByExample(example); List<MntnUpgrades> list = mapper.selectByExample(example);
for (MntnUpgrades item : list) { for (MntnUpgrades item : list) {

@ -7,7 +7,7 @@ import java.util.List;
public interface UpgradeService { public interface UpgradeService {
List<MntnUpgrades> listAll(); List<MntnUpgrades> listAll(Integer type);
boolean upload(MntnUpgrades item, MultipartFile file) throws Exception; boolean upload(MntnUpgrades item, MultipartFile file) throws Exception;

Loading…
Cancel
Save