package com.nuvole.four.controller.pc;
|
|
|
import com.github.pagehelper.PageHelper;
|
import com.nuvole.common.domain.result.CommonResult;
|
import com.nuvole.common.domain.result.PageBean;
|
import com.nuvole.four.controller.BaseController;
|
import com.nuvole.four.domain.StoreIndustryManage;
|
import com.nuvole.four.domain.query.StoreIndustryManageQuery;
|
import com.nuvole.four.service.StoreIndustryManageService;
|
import com.nuvole.util.CommonUtil;
|
import io.swagger.annotations.*;
|
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
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 java.util.HashMap;
|
import java.util.List;
|
import java.util.Map;
|
|
/**
|
* @Description 行业管理
|
* @Author dqh
|
* @Date 2024-04-12 17:41:29
|
*/
|
@Api(value = "行业管理接口", tags = "行业管理接口")
|
@EnableTransactionManagement
|
@RestController
|
@RequestMapping("/v1/four/pc/store/industry/manage")
|
public class StoreIndustryManageController extends BaseController {
|
|
@Autowired
|
private StoreIndustryManageService storeIndustryManageService;
|
|
/**
|
* 方法描述: 查询行业管理列表
|
*
|
* @date 2024-04-12 17:56
|
**/
|
@ApiOperation(value = "查询列表", notes = "查询列表")
|
@ApiImplicitParams({ @ApiImplicitParam(name = "StoreIndustryManageQuery") })
|
@GetMapping("/getList")
|
public CommonResult<PageBean> getList(@ApiParam(name = "pageNumber", value = "分页页码", required = true) Integer pageNumber,
|
@ApiParam(name = "pageSize", value = "每页展示数", required = true) Integer pageSize) {
|
StoreIndustryManageQuery copy = CommonUtil.getObjFromReq(StoreIndustryManageQuery.class);
|
StoreIndustryManageQuery query = new StoreIndustryManageQuery();
|
BeanUtils.copyProperties(copy, query);
|
PageHelper.startPage(pageNumber, pageSize);
|
|
PageHelper.orderBy("create_time desc");
|
|
List<StoreIndustryManage> list = storeIndustryManageService.getList(query);
|
CommonResult result = new CommonResult<>(new PageBean(list));
|
CommonResult result1 = new CommonResult<>();
|
BeanUtils.copyProperties(result, result1);
|
result = result1;
|
return result;
|
}
|
|
/**
|
* 方法描述: 添加行业管理
|
*
|
* @date 2024-04-12 18:17
|
**/
|
@ApiOperation(value = "添加", notes = "添加")
|
@ApiImplicitParams({ @ApiImplicitParam(name = "StoreIndustryManage") })
|
@PostMapping("/add")
|
public CommonResult<Integer> add() {
|
StoreIndustryManage copy = CommonUtil.getObjFromReq(StoreIndustryManage.class);
|
StoreIndustryManage storeIndustryManage = new StoreIndustryManage();
|
BeanUtils.copyProperties(copy, storeIndustryManage);
|
|
CommonResult result = new CommonResult<>(storeIndustryManageService.addSelective(storeIndustryManage));
|
CommonResult result1 = new CommonResult<>();
|
BeanUtils.copyProperties(result, result1);
|
result = result1;
|
return result;
|
}
|
|
/**
|
* 方法描述: 查询max(sortNo)的序号信息
|
* 返回 = max(sortNo) + 10
|
*
|
* @date 2024-04-12 18:17
|
**/
|
@ApiOperation(value = "查询当前最大序号", notes = "查询当前最大序号")
|
@GetMapping("/getSort")
|
public CommonResult<StoreIndustryManage> getSort() {
|
CommonResult result = new CommonResult<>(storeIndustryManageService.getSort());
|
CommonResult result1 = new CommonResult<>();
|
BeanUtils.copyProperties(result, result1);
|
result = result1;
|
return result;
|
}
|
|
/**
|
* 方法描述: 根据id查询行业管理详情
|
*
|
* @date 2024-04-12 18:32
|
**/
|
@ApiOperation(value = "根据id查询", notes = "根据id查询")
|
@ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "主键id") })
|
@GetMapping("/get")
|
public CommonResult<StoreIndustryManage> get(Long id) {
|
CommonResult result = new CommonResult<>(storeIndustryManageService.get(id));
|
CommonResult result1 = new CommonResult<>();
|
BeanUtils.copyProperties(result, result1);
|
result = result1;
|
return result;
|
}
|
|
/**
|
* 方法描述: 修改行业管理
|
*
|
* @date 2024-04-12 18:32
|
**/
|
@ApiOperation(value = "修改", notes = "修改")
|
@ApiImplicitParams({ @ApiImplicitParam(name = "StoreIndustryManage") })
|
@PostMapping("/upd")
|
public CommonResult<Integer> upd() {
|
StoreIndustryManage copy = CommonUtil.getObjFromReq(StoreIndustryManage.class);
|
StoreIndustryManage storeIndustryManage = new StoreIndustryManage();
|
BeanUtils.copyProperties(copy, storeIndustryManage);
|
|
CommonResult result = new CommonResult<>(storeIndustryManageService.editSelective(storeIndustryManage));
|
CommonResult result1 = new CommonResult<>();
|
BeanUtils.copyProperties(result, result1);
|
result = result1;
|
return result;
|
}
|
|
@ApiOperation(value = "删除", notes = "删除")
|
@ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "主键id") })
|
@PostMapping("/del")
|
public CommonResult<Integer> del(Long id) {
|
CommonResult result = new CommonResult<>(storeIndustryManageService.del(id));
|
CommonResult result1 = new CommonResult<>();
|
BeanUtils.copyProperties(result, result1);
|
result = result1;
|
return result;
|
}
|
|
/**
|
* 方法描述: 查询所有行业树
|
*
|
* @date 2024-04-12 18:43
|
**/
|
@ApiOperation(value = "查询所有行业树", notes = "查询所有行业树")
|
@GetMapping("/getIndustryTree")
|
public CommonResult<List<Map>> getIndustryTree(Integer status) {
|
Map map = new HashMap();
|
if(status != null){
|
map.put("status",status);
|
}
|
List<Map> list = storeIndustryManageService.getIndustryTree(map);
|
return new CommonResult<>(list);
|
}
|
|
}
|