TbCarBlackController.java 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. package com.pj.biz;
  2. import java.util.List;
  3. import com.pj.project.tb_car_black.TbCarBlack;
  4. import com.pj.project.tb_car_black.TbCarBlackService;
  5. import org.springframework.beans.factory.annotation.Autowired;
  6. import org.springframework.transaction.annotation.Transactional;
  7. import org.springframework.web.bind.annotation.*;
  8. import com.pj.utils.sg.*;
  9. import com.pj.utils.so.*;
  10. import com.pj.project4sp.SP;
  11. import com.pj.current.satoken.StpUserUtil;
  12. import cn.dev33.satoken.annotation.SaCheckPermission;
  13. /**
  14. * Controller: tb_car_black -- 车辆黑名单
  15. *
  16. * @author qzyReal
  17. */
  18. @RestController
  19. @RequestMapping("/TbCarBlack/")
  20. public class TbCarBlackController {
  21. /**
  22. * 底层 Service 对象
  23. */
  24. @Autowired
  25. TbCarBlackService tbCarBlackService;
  26. /**
  27. * 增
  28. */
  29. @RequestMapping("add")
  30. @SaCheckPermission(TbCarBlack.PERMISSION_CODE_ADD)
  31. @Transactional(rollbackFor = Exception.class)
  32. public AjaxJson add(TbCarBlack t) {
  33. tbCarBlackService.add(t);
  34. return AjaxJson.getSuccessData(t);
  35. }
  36. /**
  37. * 删
  38. */
  39. @RequestMapping("delete")
  40. @SaCheckPermission(TbCarBlack.PERMISSION_CODE_DEL)
  41. public AjaxJson delete(Long id) {
  42. tbCarBlackService.delete(id);
  43. return AjaxJson.getSuccess();
  44. }
  45. /**
  46. * 删 - 根据id列表
  47. */
  48. @RequestMapping("deleteByIds")
  49. @SaCheckPermission(TbCarBlack.PERMISSION_CODE_DEL)
  50. public AjaxJson deleteByIds() {
  51. List<Long> ids = SoMap.getRequestSoMap().getListByComma("ids", long.class);
  52. int line = SP.publicMapper.deleteByIds(TbCarBlack.TABLE_NAME, ids);
  53. return AjaxJson.getByLine(line);
  54. }
  55. /**
  56. * 改
  57. */
  58. @RequestMapping("update")
  59. @SaCheckPermission(TbCarBlack.PERMISSION_CODE_EDIT)
  60. public AjaxJson update(TbCarBlack t) {
  61. tbCarBlackService.update(t);
  62. return AjaxJson.getSuccess();
  63. }
  64. /**
  65. * 查 - 根据id
  66. */
  67. @RequestMapping("getById")
  68. public AjaxJson getById(Long id) {
  69. TbCarBlack t = tbCarBlackService.getById(id);
  70. return AjaxJson.getSuccessData(t);
  71. }
  72. /**
  73. * 查集合 - 根据条件(参数为空时代表忽略指定条件)
  74. */
  75. @RequestMapping("getList")
  76. public AjaxJson getList() {
  77. SoMap so = SoMap.getRequestSoMap();
  78. long deptId = StpUserUtil.getDeptId();
  79. if (deptId != StpUserUtil.ADMIN_DEPT_ID) {
  80. so.put("deptId", deptId);
  81. }
  82. List<TbCarBlack> list = tbCarBlackService.getList(so.startPage());
  83. return AjaxJson.getPageData(so.getDataCount(), list);
  84. }
  85. }