提交修改

This commit is contained in:
quyixiao 2020-09-23 16:52:46 +08:00
commit 8c9ca5f38c
16 changed files with 96 additions and 8 deletions

View File

@ -13,6 +13,7 @@ import com.lz.modules.equipment.service.SpecialApplyInfoService;
import com.lz.modules.sys.controller.AbstractController; import com.lz.modules.sys.controller.AbstractController;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
@ -43,6 +44,7 @@ public class EmployeeController extends AbstractController {
private IEquipmentInfoService iEquipmentInfoService; private IEquipmentInfoService iEquipmentInfoService;
@PostMapping("findEmployeeByName") @PostMapping("findEmployeeByName")
@RequiresPermissions("user:device:pandian")
public R findEmployeeByName(@RequestBody @ApiParam FindByNameModel nameModel){ public R findEmployeeByName(@RequestBody @ApiParam FindByNameModel nameModel){
PageUtils pageUtils = PageUtils.startPage(nameModel.getCurrPage(), nameModel.getPageSize()).doSelect( PageUtils pageUtils = PageUtils.startPage(nameModel.getCurrPage(), nameModel.getPageSize()).doSelect(
page -> staffService.selectBySearchName(page, nameModel) page -> staffService.selectBySearchName(page, nameModel)
@ -52,6 +54,7 @@ public class EmployeeController extends AbstractController {
} }
@PostMapping("findSpecialApplyByName") @PostMapping("findSpecialApplyByName")
@RequiresPermissions("user:device:pandian")
public R findSpecialApplyByName(@RequestBody @ApiParam FindByNameModel nameModel){ public R findSpecialApplyByName(@RequestBody @ApiParam FindByNameModel nameModel){
List<FindEmployeeResModel> data = new ArrayList<>(); List<FindEmployeeResModel> data = new ArrayList<>();
PageUtils pageUtils = PageUtils.startPage(nameModel.getCurrPage(), nameModel.getPageSize()).doSelect( PageUtils pageUtils = PageUtils.startPage(nameModel.getCurrPage(), nameModel.getPageSize()).doSelect(
@ -64,6 +67,7 @@ public class EmployeeController extends AbstractController {
@PostMapping("findUsersEquipmentsByName") @PostMapping("findUsersEquipmentsByName")
@RequiresPermissions("user:device:pandian")
public R findUsersEquipmentsByName(@RequestBody @ApiParam FindEquipmentsByNameModel nameModel){ public R findUsersEquipmentsByName(@RequestBody @ApiParam FindEquipmentsByNameModel nameModel){
PageUtils pageUtils = PageUtils.startPage(nameModel.getCurrPage(), nameModel.getPageSize()).doSelect( PageUtils pageUtils = PageUtils.startPage(nameModel.getCurrPage(), nameModel.getPageSize()).doSelect(

View File

@ -10,6 +10,7 @@ import com.lz.modules.equipment.entity.EquipmentType;
import com.lz.modules.equipment.entity.resp.EquipmentBrandResp; import com.lz.modules.equipment.entity.resp.EquipmentBrandResp;
import com.lz.modules.equipment.service.EquipmentBrandService; import com.lz.modules.equipment.service.EquipmentBrandService;
import com.lz.modules.equipment.service.IEquipmentTypeService; import com.lz.modules.equipment.service.IEquipmentTypeService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
@ -56,6 +57,7 @@ public class EquipmentBrandController {
* @throws Exception 异常 * @throws Exception 异常
*/ */
@RequestMapping("/modules/brand/equipmentBrandAdd") @RequestMapping("/modules/brand/equipmentBrandAdd")
@RequiresPermissions("user:device:brand:save")
public R equipmentBrandAdd(@RequestBody EquipmentBrandReq req) throws Exception { public R equipmentBrandAdd(@RequestBody EquipmentBrandReq req) throws Exception {
EquipmentBrand equipmentBrand = new EquipmentBrand(); EquipmentBrand equipmentBrand = new EquipmentBrand();
BeanUtils.copyProperty(equipmentBrand, req, true); BeanUtils.copyProperty(equipmentBrand, req, true);
@ -84,6 +86,7 @@ public class EquipmentBrandController {
* @throws Exception 异常 * @throws Exception 异常
*/ */
@RequestMapping(value = "/modules/brand/equipmentBrandEdit") @RequestMapping(value = "/modules/brand/equipmentBrandEdit")
@RequiresPermissions("user:device:brand:update")
public R equipmentBrandEdit(@RequestBody EquipmentBrandReq req) throws Exception { public R equipmentBrandEdit(@RequestBody EquipmentBrandReq req) throws Exception {
EquipmentBrand equipmentBrand = equipmentBrandService.selectEquipmentBrandById(req.getId()); EquipmentBrand equipmentBrand = equipmentBrandService.selectEquipmentBrandById(req.getId());
BeanUtils.copyProperty(equipmentBrand, req, true); BeanUtils.copyProperty(equipmentBrand, req, true);
@ -97,6 +100,7 @@ public class EquipmentBrandController {
* @throws Exception 异常 * @throws Exception 异常
*/ */
@RequestMapping(value = "/modules/brand/equipmentBrandDelete") @RequestMapping(value = "/modules/brand/equipmentBrandDelete")
@RequiresPermissions("user:device:brand:delete")
public R equipmentBrandDelete(@RequestBody EquipmentBrandReq req) throws Exception { public R equipmentBrandDelete(@RequestBody EquipmentBrandReq req) throws Exception {
equipmentBrandService.deleteEquipmentBrandById(req.getId()); equipmentBrandService.deleteEquipmentBrandById(req.getId());
return R.ok("删除成功"); return R.ok("删除成功");
@ -120,6 +124,7 @@ public class EquipmentBrandController {
* @throws Exception 异常 * @throws Exception 异常
*/ */
@RequestMapping(value = "/modules/brand/equipmentBrandList") @RequestMapping(value = "/modules/brand/equipmentBrandList")
@RequiresPermissions("user:device:brand:list")
public R equipmentBrandList(@RequestBody EquipmentBrandReq req) throws Exception { public R equipmentBrandList(@RequestBody EquipmentBrandReq req) throws Exception {
PageUtils page = equipmentBrandService.selectByCondition(req); PageUtils page = equipmentBrandService.selectByCondition(req);

View File

@ -13,6 +13,7 @@ import com.lz.modules.sys.controller.AbstractController;
import com.lz.modules.sys.entity.SysUserEntity; import com.lz.modules.sys.entity.SysUserEntity;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
@ -56,6 +57,7 @@ public class EquipmentController extends AbstractController {
private SpecialApplyInfoService specialApplyInfoService; private SpecialApplyInfoService specialApplyInfoService;
@GetMapping("findEquipmentById") @GetMapping("findEquipmentById")
@RequiresPermissions("user:device:pandian")
public R findEquipmentById(@Valid @RequestParam @NotNull(message = "设备标识不能为空") String code){ public R findEquipmentById(@Valid @RequestParam @NotNull(message = "设备标识不能为空") String code){
EquipmentInfo equipmentInfo = iEquipmentInfoService.selectEquipmentInfoByCode(code); EquipmentInfo equipmentInfo = iEquipmentInfoService.selectEquipmentInfoByCode(code);
if(equipmentInfo==null){ if(equipmentInfo==null){
@ -79,7 +81,7 @@ public class EquipmentController extends AbstractController {
model.setSpecId(equipmentSpecs1.getId()); model.setSpecId(equipmentSpecs1.getId());
} }
}); });
// addRecord(equipmentInfo); addRecord(equipmentInfo);
return R.ok().put("data", model); return R.ok().put("data", model);
} }
@ -103,6 +105,7 @@ public class EquipmentController extends AbstractController {
}*/ }*/
@PostMapping("changeEquipmentInfo") @PostMapping("changeEquipmentInfo")
@RequiresPermissions("user:device:pandian")
public R changeEquipmentState(@RequestBody @Valid ChangeEquipmentModel model){ public R changeEquipmentState(@RequestBody @Valid ChangeEquipmentModel model){
EquipmentDto dto = new EquipmentDto(); EquipmentDto dto = new EquipmentDto();
BeanUtils.copyProperties(model,dto); BeanUtils.copyProperties(model,dto);
@ -118,6 +121,7 @@ public class EquipmentController extends AbstractController {
@GetMapping("findRrBySpec") @GetMapping("findRrBySpec")
@RequiresPermissions("user:device:pandian")
public R getRrBySpec(@Valid @RequestParam @NotNull(message = "规格不能为空") Long specId){ public R getRrBySpec(@Valid @RequestParam @NotNull(message = "规格不能为空") Long specId){
List<EquipmentQr> rrBySpec = equipmentQrService.findRrBySpec(specId); List<EquipmentQr> rrBySpec = equipmentQrService.findRrBySpec(specId);
if(CollectionUtils.isEmpty(rrBySpec)){ if(CollectionUtils.isEmpty(rrBySpec)){
@ -151,6 +155,7 @@ public class EquipmentController extends AbstractController {
@PostMapping("findEquipmentType") @PostMapping("findEquipmentType")
@RequiresPermissions("user:device:pandian")
public R findEquipmentType(@RequestBody @ApiParam FindEquipmentTypeModel model){ public R findEquipmentType(@RequestBody @ApiParam FindEquipmentTypeModel model){
String[] split = null; String[] split = null;
int length = 0; int length = 0;

View File

@ -9,6 +9,7 @@ import com.lz.modules.equipment.service.EquipmentBrandService;
import com.lz.modules.equipment.service.IEquipmentInfoService; import com.lz.modules.equipment.service.IEquipmentInfoService;
import com.lz.modules.equipment.service.IEquipmentTypeService; import com.lz.modules.equipment.service.IEquipmentTypeService;
import com.lz.modules.equipment.service.TCountService; import com.lz.modules.equipment.service.TCountService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
@ -102,6 +103,7 @@ public class EquipmentInfoController {
* @throws Exception 异常 * @throws Exception 异常
*/ */
@RequestMapping(value = "/modules/usereq/equipmentInfoEdit") @RequestMapping(value = "/modules/usereq/equipmentInfoEdit")
@RequiresPermissions("user:device:update")
public R equipmentInfoEdit(@RequestBody EquipmentInfoReq req) throws Exception { public R equipmentInfoEdit(@RequestBody EquipmentInfoReq req) throws Exception {
EquipmentInfo equipmentInfo = equipmentInfoService.selectEquipmentInfoById(req.getId()); EquipmentInfo equipmentInfo = equipmentInfoService.selectEquipmentInfoById(req.getId());
BeanUtils.copyProperty(equipmentInfo, req, true); BeanUtils.copyProperty(equipmentInfo, req, true);
@ -122,6 +124,7 @@ public class EquipmentInfoController {
* @throws Exception 异常 * @throws Exception 异常
*/ */
@RequestMapping(value = "/modules/usereq/equipmentInfoDelete") @RequestMapping(value = "/modules/usereq/equipmentInfoDelete")
@RequiresPermissions("user:device:delete")
public R equipmentInfoDelete(@RequestBody EquipmentInfoReq req) throws Exception { public R equipmentInfoDelete(@RequestBody EquipmentInfoReq req) throws Exception {
equipmentInfoService.deleteEquipmentInfoById(req.getId()); equipmentInfoService.deleteEquipmentInfoById(req.getId());
return R.ok("删除成功"); return R.ok("删除成功");
@ -149,9 +152,10 @@ public class EquipmentInfoController {
* @throws Exception 异常 * @throws Exception 异常
*/ */
@RequestMapping(value = "/modules/usereq/equipmentInfoList") @RequestMapping(value = "/modules/usereq/equipmentInfoList")
@RequiresPermissions("user:device:list")
public R equipmentInfoList(@RequestBody EquipmentInfoReq req) throws Exception { public R equipmentInfoList(@RequestBody EquipmentInfoReq req) throws Exception {
List<EquipmentType> types = equipmentTypeService.selectAll(); List<EquipmentType> types = equipmentTypeService.selectAll();
List<TCount> tcounts = tCountService.selectListLimit(10); List<TCount> tcounts = tCountService.selectListLimit(100);
EquipmentType type = new EquipmentType(); EquipmentType type = new EquipmentType();
type.setId(null); type.setId(null);
type.setType("全部"); type.setType("全部");

View File

@ -11,6 +11,7 @@ import com.lz.modules.equipment.entity.resp.EquipmentSpecsResp;
import com.lz.modules.equipment.service.EquipmentBrandService; import com.lz.modules.equipment.service.EquipmentBrandService;
import com.lz.modules.equipment.service.EquipmentSpecsService; import com.lz.modules.equipment.service.EquipmentSpecsService;
import com.lz.modules.equipment.service.IEquipmentTypeService; import com.lz.modules.equipment.service.IEquipmentTypeService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
@ -59,6 +60,7 @@ public class EquipmentSpecsController {
* @throws Exception 异常 * @throws Exception 异常
*/ */
@RequestMapping("/modules/specs/equipmentSpecsAdd") @RequestMapping("/modules/specs/equipmentSpecsAdd")
@RequiresPermissions("user:device:specs:save")
public R equipmentSpecsAdd(@RequestBody EquipmentSpecsReq req) throws Exception { public R equipmentSpecsAdd(@RequestBody EquipmentSpecsReq req) throws Exception {
EquipmentSpecs equipmentSpecs = new EquipmentSpecs(); EquipmentSpecs equipmentSpecs = new EquipmentSpecs();
BeanUtils.copyProperty(equipmentSpecs, req, true); BeanUtils.copyProperty(equipmentSpecs, req, true);
@ -88,6 +90,7 @@ public class EquipmentSpecsController {
* @throws Exception 异常 * @throws Exception 异常
*/ */
@RequestMapping(value = "/modules/specs/equipmentSpecsEdit") @RequestMapping(value = "/modules/specs/equipmentSpecsEdit")
@RequiresPermissions("user:device:specs:update")
public R equipmentSpecsEdit(@RequestBody EquipmentSpecsReq req) throws Exception { public R equipmentSpecsEdit(@RequestBody EquipmentSpecsReq req) throws Exception {
EquipmentSpecs equipmentSpecs = equipmentSpecsService.selectEquipmentSpecsById(req.getId()); EquipmentSpecs equipmentSpecs = equipmentSpecsService.selectEquipmentSpecsById(req.getId());
BeanUtils.copyProperty(equipmentSpecs, req, true); BeanUtils.copyProperty(equipmentSpecs, req, true);
@ -103,6 +106,7 @@ public class EquipmentSpecsController {
* @throws Exception 异常 * @throws Exception 异常
*/ */
@RequestMapping(value = "/modules/specs/equipmentSpecsDelete") @RequestMapping(value = "/modules/specs/equipmentSpecsDelete")
@RequiresPermissions("user:device:specs:delete")
public R equipmentSpecsDelete(@RequestBody EquipmentSpecsReq req) throws Exception { public R equipmentSpecsDelete(@RequestBody EquipmentSpecsReq req) throws Exception {
equipmentSpecsService.deleteEquipmentSpecsById(req.getId()); equipmentSpecsService.deleteEquipmentSpecsById(req.getId());
return R.ok("删除成功"); return R.ok("删除成功");
@ -144,6 +148,7 @@ public class EquipmentSpecsController {
* @throws Exception 异常 * @throws Exception 异常
*/ */
@RequestMapping(value = "/modules/specs/equipmentSpecsList") @RequestMapping(value = "/modules/specs/equipmentSpecsList")
@RequiresPermissions("user:device:specs:list")
public R equipmentSpecsList(@RequestBody EquipmentSpecsReq req) throws Exception { public R equipmentSpecsList(@RequestBody EquipmentSpecsReq req) throws Exception {
PageUtils page = equipmentSpecsService.selectByCondition(req); PageUtils page = equipmentSpecsService.selectByCondition(req);
List<EquipmentSpecs> specsList = page.getList(); List<EquipmentSpecs> specsList = page.getList();

View File

@ -7,6 +7,7 @@ import com.lz.modules.app.utils.BeanUtils;
import com.lz.modules.equipment.entity.EquipmentType; import com.lz.modules.equipment.entity.EquipmentType;
import com.lz.modules.equipment.entity.EquipmentTypeReq; import com.lz.modules.equipment.entity.EquipmentTypeReq;
import com.lz.modules.equipment.service.IEquipmentTypeService; import com.lz.modules.equipment.service.IEquipmentTypeService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
@ -47,6 +48,7 @@ public class EquipmentTypeController {
* @throws Exception 异常 * @throws Exception 异常
*/ */
@RequestMapping("/modules/type/equipmentTypeAdd") @RequestMapping("/modules/type/equipmentTypeAdd")
@RequiresPermissions("user:device:type:save")
public R equipmentTypeAdd(@RequestBody EquipmentTypeReq req) throws Exception { public R equipmentTypeAdd(@RequestBody EquipmentTypeReq req) throws Exception {
EquipmentType equipmentType = new EquipmentType(); EquipmentType equipmentType = new EquipmentType();
BeanUtils.copyProperty(equipmentType,req,true); BeanUtils.copyProperty(equipmentType,req,true);
@ -72,6 +74,7 @@ public class EquipmentTypeController {
* @throws Exception 异常 * @throws Exception 异常
*/ */
@RequestMapping(value = "/modules/type/equipmentTypeEdit") @RequestMapping(value = "/modules/type/equipmentTypeEdit")
@RequiresPermissions("user:device:type:update")
public R equipmentTypeEdit(@RequestBody EquipmentTypeReq req) throws Exception { public R equipmentTypeEdit(@RequestBody EquipmentTypeReq req) throws Exception {
EquipmentType equipmentType = equipmentTypeService.selectEquipmentTypeById(req.getId()); EquipmentType equipmentType = equipmentTypeService.selectEquipmentTypeById(req.getId());
BeanUtils.copyProperty(equipmentType,req,true); BeanUtils.copyProperty(equipmentType,req,true);
@ -84,6 +87,7 @@ public class EquipmentTypeController {
* @throws Exception 异常 * @throws Exception 异常
*/ */
@RequestMapping(value = "/modules/type/equipmentTypeDelete") @RequestMapping(value = "/modules/type/equipmentTypeDelete")
@RequiresPermissions("user:device:type:delete")
public R equipmentTypeDelete(@RequestBody EquipmentTypeReq req) throws Exception { public R equipmentTypeDelete(@RequestBody EquipmentTypeReq req) throws Exception {
equipmentTypeService.deleteEquipmentTypeById(req.getId()); equipmentTypeService.deleteEquipmentTypeById(req.getId());
return R.ok("删除成功"); return R.ok("删除成功");
@ -104,6 +108,7 @@ public class EquipmentTypeController {
* @throws Exception 异常 * @throws Exception 异常
*/ */
@RequestMapping(value = "/modules/type/equipmentTypeList") @RequestMapping(value = "/modules/type/equipmentTypeList")
@RequiresPermissions("user:device:type:list")
public R equipmentTypeList(@RequestBody EquipmentTypeReq req) throws Exception { public R equipmentTypeList(@RequestBody EquipmentTypeReq req) throws Exception {
PageUtils page = equipmentTypeService.selectByCondition(req); PageUtils page = equipmentTypeService.selectByCondition(req);
return R.ok().put("total", page.getTotalCount()) return R.ok().put("total", page.getTotalCount())

View File

@ -7,6 +7,7 @@ import com.lz.common.utils.StringUtil;
import com.lz.modules.equipment.entity.OneCode; import com.lz.modules.equipment.entity.OneCode;
import com.lz.modules.equipment.entity.OneCodeReq; import com.lz.modules.equipment.entity.OneCodeReq;
import com.lz.modules.equipment.service.OneCodeService; import com.lz.modules.equipment.service.OneCodeService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
@ -30,6 +31,7 @@ public class OneCodeController {
* 获取code编码 * 获取code编码
* */ * */
@RequestMapping("/get/getPrints") @RequestMapping("/get/getPrints")
@RequiresPermissions("user:device:code:list")
public R getPrints(@RequestBody OneCodeReq req) { public R getPrints(@RequestBody OneCodeReq req) {
PageUtils pageUtils = oneCodeService.selectByReq(req); PageUtils pageUtils = oneCodeService.selectByReq(req);
@ -41,6 +43,7 @@ public class OneCodeController {
* 批量生成指定数量编码 * 批量生成指定数量编码
* */ * */
@RequestMapping("/new/prints") @RequestMapping("/new/prints")
@RequiresPermissions("user:device:code:save")
public R prints(@RequestParam int counts) { public R prints(@RequestParam int counts) {
List<String> codes = new ArrayList<>(); List<String> codes = new ArrayList<>();
@ -56,6 +59,7 @@ public class OneCodeController {
* 重打印一个编码该编码已经在数据库中存在 * 重打印一个编码该编码已经在数据库中存在
* */ * */
@RequestMapping("/re/print") @RequestMapping("/re/print")
@RequiresPermissions("user:device:code:update")
public R prints(@RequestParam String code) { public R prints(@RequestParam String code) {
OneCode oneCode = oneCodeService.selectByCode(code); OneCode oneCode = oneCodeService.selectByCode(code);
if(oneCode != null){ if(oneCode != null){

View File

@ -1,10 +1,14 @@
package com.lz.modules.equipment.controller; package com.lz.modules.equipment.controller;
import com.lz.common.utils.PageUtils;
import com.lz.common.utils.R; import com.lz.common.utils.R;
import com.lz.modules.app.utils.BeanUtils; import com.lz.modules.app.utils.BeanUtils;
import com.lz.modules.equipment.entity.EquipmentInfo;
import com.lz.modules.equipment.entity.TCount; import com.lz.modules.equipment.entity.TCount;
import com.lz.modules.equipment.entity.TCountReq; import com.lz.modules.equipment.entity.TCountReq;
import com.lz.modules.equipment.service.IEquipmentInfoService;
import com.lz.modules.equipment.service.TCountService; import com.lz.modules.equipment.service.TCountService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
@ -26,6 +30,9 @@ public class TCountController {
@Resource @Resource
private TCountService tCountService; private TCountService tCountService;
@Resource
private IEquipmentInfoService equipmentInfoService;
/** /**
* 添加盘点页面 * 添加盘点页面
* *
@ -83,9 +90,17 @@ public class TCountController {
* @throws Exception 异常 * @throws Exception 异常
*/ */
@RequestMapping(value = "/modules/count/tCountDelete") @RequestMapping(value = "/modules/count/tCountDelete")
@RequiresPermissions("user:device:count:delete")
public R tCountDelete(@RequestBody TCountReq req) throws Exception { public R tCountDelete(@RequestBody TCountReq req) throws Exception {
tCountService.deleteTCountById(req.getId()); TCount tcount = tCountService.selectTCountById(req.getId());
return R.ok("删除成功");
EquipmentInfo equipmentInfo = equipmentInfoService.selectEquipmentInfoByCount(tcount.getNum());
if(equipmentInfo == null){
tCountService.deleteTCountById(req.getId());
return R.ok("删除成功");
}
return R.error("改次盘点下面有盘点设备,无法删除");
} }
@ -96,6 +111,7 @@ public class TCountController {
* @throws Exception 异常 * @throws Exception 异常
*/ */
@RequestMapping(value = "/modules/count/newStart") @RequestMapping(value = "/modules/count/newStart")
@RequiresPermissions("user:device:count:save")
public R newStart() throws Exception { public R newStart() throws Exception {
TCount tCount = tCountService.selectMaxTCount(); TCount tCount = tCountService.selectMaxTCount();
int count = 1 ; int count = 1 ;
@ -127,8 +143,10 @@ public class TCountController {
* @throws Exception 异常 * @throws Exception 异常
*/ */
@RequestMapping(value = "/modules/count/tCountList") @RequestMapping(value = "/modules/count/tCountList")
@RequiresPermissions("user:device:count:list")
public R tCountList(@RequestBody TCountReq req) throws Exception { public R tCountList(@RequestBody TCountReq req) throws Exception {
PageUtils page = tCountService.selectByReq(req);
return R.ok().put("total", 1) return R.ok().put("total", 1)
.put("rows", new ArrayList<>()); .put("rows", page);
} }
} }

View File

@ -42,4 +42,6 @@ public interface EquipmentInfoMapper extends BaseMapper<EquipmentInfo> {
List<EquipmentInfo> selectByCondition(@Param("page") IPage page, @Param("req") EquipmentInfoReq req); List<EquipmentInfo> selectByCondition(@Param("page") IPage page, @Param("req") EquipmentInfoReq req);
List<EquipmentInfo> selectByStaffIdOrDepId(@Param("page") IPage page, @Param("nameModel") FindEquipmentsByNameModel nameModel); List<EquipmentInfo> selectByStaffIdOrDepId(@Param("page") IPage page, @Param("nameModel") FindEquipmentsByNameModel nameModel);
EquipmentInfo selectEquipmentInfoByCount(Integer count);
} }

View File

@ -8,7 +8,9 @@ package com.lz.modules.equipment.dao;
* @since 2020-08-10 * @since 2020-08-10
*/ */
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.lz.modules.equipment.entity.TCount; import com.lz.modules.equipment.entity.TCount;
import com.lz.modules.equipment.entity.TCountReq;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -36,4 +38,6 @@ public interface TCountMapper extends BaseMapper<TCount> {
TCount selectMaxCount(); TCount selectMaxCount();
List<TCount> selectListLimit(@Param("limit") int limit); List<TCount> selectListLimit(@Param("limit") int limit);
List selectByReq(@Param("page") IPage page, @Param("req") TCountReq req);
} }

View File

@ -49,4 +49,6 @@ public interface IEquipmentInfoService extends IService<EquipmentInfo> {
PageUtils selectByCondition(EquipmentInfoReq req); PageUtils selectByCondition(EquipmentInfoReq req);
List<EquipmentInfo> selectByStaffIdOrDepId(IPage page, FindEquipmentsByNameModel nameModel); List<EquipmentInfo> selectByStaffIdOrDepId(IPage page, FindEquipmentsByNameModel nameModel);
EquipmentInfo selectEquipmentInfoByCount(Integer count);
} }

View File

@ -2,7 +2,9 @@ package com.lz.modules.equipment.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.lz.common.utils.PageUtils;
import com.lz.modules.equipment.entity.TCount; import com.lz.modules.equipment.entity.TCount;
import com.lz.modules.equipment.entity.TCountReq;
import java.util.List; import java.util.List;
@ -36,4 +38,6 @@ public interface TCountService extends IService<TCount> {
TCount selectMaxTCount(); TCount selectMaxTCount();
List<TCount> selectListLimit(int limit); List<TCount> selectListLimit(int limit);
PageUtils selectByReq(TCountReq req);
} }

View File

@ -267,4 +267,9 @@ public class EquipmentInfoServiceImpl extends ServiceImpl<EquipmentInfoMapper, E
public List<EquipmentInfo> selectByStaffIdOrDepId(IPage page, FindEquipmentsByNameModel nameModel){ public List<EquipmentInfo> selectByStaffIdOrDepId(IPage page, FindEquipmentsByNameModel nameModel){
return equipmentInfoMapper.selectByStaffIdOrDepId(page, nameModel); return equipmentInfoMapper.selectByStaffIdOrDepId(page, nameModel);
} }
@Override
public EquipmentInfo selectEquipmentInfoByCount(Integer count){
return equipmentInfoMapper.selectEquipmentInfoByCount(count);
}
} }

View File

@ -1,9 +1,12 @@
package com.lz.modules.equipment.service.impl; package com.lz.modules.equipment.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lz.common.utils.PageUtils;
import com.lz.modules.equipment.dao.TCountMapper; import com.lz.modules.equipment.dao.TCountMapper;
import com.lz.modules.equipment.entity.TCount; import com.lz.modules.equipment.entity.TCount;
import com.lz.modules.equipment.entity.TCountReq;
import com.lz.modules.equipment.service.TCountService; import com.lz.modules.equipment.service.TCountService;
import lombok.Builder;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -70,5 +73,13 @@ public class TCountServiceImpl extends ServiceImpl<TCountMapper, TCount> impleme
return tCountMapper.selectListLimit(limit); return tCountMapper.selectListLimit(limit);
} }
@Override
public PageUtils selectByReq(TCountReq req){
PageUtils page = PageUtils.startPage(req.getPage(), req.getRows()).doSelect(
page1 -> tCountMapper.selectByReq(page1, req)
);
return page;
}
} }

View File

@ -243,5 +243,11 @@
</if> </if>
</select> </select>
<select id="selectEquipmentInfoByCount" resultType="EquipmentInfo">
select * from equipment_info where is_delete = 0 and count=#{count} limit 1
</select>
</mapper> </mapper>

View File

@ -66,14 +66,18 @@
<update id="deleteTCountById" parameterType="java.lang.Long"> <update id="deleteTCountById" parameterType="java.lang.Long">
update equipment_t_count set is_delete = 1 where id=#{id} limit 1 update equipment_t_count set is_delete = 1 where id=#{id} and is_delete = 0 limit 1
</update> </update>
<select id="selectMaxCount" resultType="com.lz.modules.equipment.entity.TCount"> <select id="selectMaxCount" resultType="com.lz.modules.equipment.entity.TCount">
select * from equipment_t_count order by id desc limit 1 select * from equipment_t_count where is_delete = 0 order by id desc limit 1
</select> </select>
<select id="selectListLimit" resultType="com.lz.modules.equipment.entity.TCount"> <select id="selectListLimit" resultType="com.lz.modules.equipment.entity.TCount">
select * from equipment_t_count order by id desc limit #{limit} select * from equipment_t_count where is_delete = 0 order by id desc limit #{limit}
</select>
<select id="selectByReq" resultType="com.lz.modules.equipment.entity.TCount">
select * from equipment_t_count where is_delete = 0 order by id desc
</select> </select>