huliguo
3 天以前 11ec7ac8f4832c4274cf61a19cc35cda3de9e0e5
src/main/java/com/linghu/controller/TypeController.java
@@ -24,7 +24,6 @@
    @PostMapping
    @ApiOperation(value = "添加类型")
    public ResponseResult<Type> add(@RequestBody Type type) {
        type.setDel_flag(0);
        boolean success = typeService.save(type);
        if (success) {
            return ResponseResult.success(type);
@@ -35,8 +34,6 @@
    @PostMapping("/batch")
    @ApiOperation(value = "批量添加类型")
    public ResponseResult<Void> batchAdd(@RequestBody List<Type> types) {
        types.forEach(type -> type.setDel_flag(0));
        boolean success = typeService.saveBatch(types);
        if (success) {
            return ResponseResult.success();
@@ -49,7 +46,6 @@
    public ResponseResult<Void> delete(@PathVariable Integer typeId) {
        Type type = new Type();
        type.setType_id(typeId);
        type.setDel_flag(1);
        boolean success = typeService.updateById(type);
        if (success) {
            return ResponseResult.success();
@@ -81,7 +77,7 @@
    @ApiOperation(value = "根据ID查询类型")
    public ResponseResult<Type> getById(@PathVariable Integer typeId) {
        Type type = typeService.getById(typeId);
        if (type != null && type.getDel_flag() != 1) {
        if (type != null ) {
            return ResponseResult.success(type);
        }
        return ResponseResult.error("类型不存在");
@@ -93,7 +89,6 @@
        List<Type> types = typeIds.stream().map(id -> {
            Type type = new Type();
            type.setType_id(id);
            type.setDel_flag(1);
            return type;
        }).collect(java.util.stream.Collectors.toList());
        boolean success = typeService.updateBatchById(types);
@@ -109,7 +104,6 @@
            @RequestParam(required = false) Integer page,
            @RequestParam(required = false) Integer pageSize) {
        LambdaQueryWrapper<Type> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(Type::getDel_flag, 0);
        if (page != null && pageSize != null) {
            Page<Type> pageInfo = new Page<>(page, pageSize);