package com.stylefeng.guns.modular.system.controller; import com.baomidou.mybatisplus.plugins.Page; import com.stylefeng.guns.core.base.controller.BaseController; import com.stylefeng.guns.modular.system.model.TGroupVo; import com.stylefeng.guns.modular.system.utils.tips.SuccessTip; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; import org.springframework.beans.factory.annotation.Autowired; import com.stylefeng.guns.modular.system.model.TGroup; import com.stylefeng.guns.modular.system.service.ITGroupService; import java.util.Date; /** * 控制器 * * @author fengshuonan * @Date 2022-12-30 09:44:10 */ @Controller @Api(tags = "分组") @RequestMapping("/api/tGroup") public class TGroupController extends BaseController { @Autowired private ITGroupService tGroupService; /** * 获取列表 */ @ApiOperation(value = "分组列表",notes="分组列表") @ApiImplicitParams({ @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), @ApiImplicitParam(name = "pageNumber", value = "pageNumber", required = true, dataType = "int",paramType = "query"), @ApiImplicitParam(name = "pageSize", value = "pageSize", required = true, dataType = "int",paramType = "query"), @ApiImplicitParam(name = "name", value = "分组名称", required = false, dataType = "String"), @ApiImplicitParam(name = "departmentId", value = "sales group", required = false, dataType = "Integer"), @ApiImplicitParam(name = "sales", value = "sales", required = false, dataType = "Integer"), }) @GetMapping(value = "/list") @ResponseBody public Object list(int pageNumber,int pageSize,String name,Integer departmentId,Integer sales) { Page tGroupVoPage = new Page<>(pageNumber, pageSize); tGroupVoPage.setRecords(tGroupService.getList(tGroupVoPage,name,departmentId,sales)); return new SuccessTip(tGroupVoPage); } /** * 新增 */ @ApiOperation(value = "新增分组",notes="新增分组") @ApiImplicitParams({ @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), }) @PostMapping(value = "/add") @ResponseBody public Object add(TGroup tGroup) { tGroup.setCreateTime(new Date()); tGroupService.insert(tGroup); return SUCCESS_TIP; } /** * 删除 */ @ApiOperation(value = "删除分组",notes="删除分组") @ApiImplicitParams({ @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), @ApiImplicitParam(name = "tGroupId", value = "分组Id", required = true, dataType = "int"), }) @DeleteMapping(value = "/delete") @ResponseBody public Object delete(@RequestParam Integer tGroupId) { TGroup tGroup = tGroupService.selectById(tGroupId); tGroup.setRemove(1); tGroupService.updateById(tGroup); return SUCCESS_TIP; } /** * 修改 */ @ApiOperation(value = "修改分组",notes="修改分组") @ApiImplicitParams({ @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), }) @PostMapping(value = "/update") @ResponseBody public Object update(TGroup tGroup) { tGroup.setUpdateTime(new Date()); tGroupService.updateById(tGroup); return SUCCESS_TIP; } /** * 详情 */ @ApiOperation(value = "分组详情",notes="分组详情") @ApiImplicitParams({ @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), @ApiImplicitParam(name = "tGroupId", value = "分组id", required = true, dataType = "Integer"), }) @GetMapping(value = "/detail") @ResponseBody public Object detail(@RequestParam Integer tGroupId) { return new SuccessTip(tGroupService.selectById(tGroupId)); } }