|
@@ -187,8 +187,14 @@ public class TjController {
|
|
|
return SendUtil.send(false, ConstStr.RESULT_FAILED);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 保存部门信息
|
|
|
+ *
|
|
|
+ * @param department
|
|
|
+ * @return
|
|
|
+ */
|
|
|
@PostMapping("/saveDept")
|
|
|
- public Map<String,Object> saveDept(Department department){
|
|
|
+ public Map<String, Object> saveDept(Department department) {
|
|
|
try {
|
|
|
return tjService.saveDept(department);
|
|
|
} catch (Exception e) {
|
|
@@ -197,6 +203,12 @@ public class TjController {
|
|
|
return SendUtil.send(false, ConstStr.RESULT_FAILED);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 通过部门id查询部门信息
|
|
|
+ *
|
|
|
+ * @param deptid
|
|
|
+ * @return
|
|
|
+ */
|
|
|
@GetMapping("/getDeptById")
|
|
|
public Map<String, Object> getDeptById(Integer deptid) {
|
|
|
try {
|
|
@@ -210,13 +222,159 @@ public class TjController {
|
|
|
return SendUtil.send(false, ConstStr.DATA_NOT_FOUND);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 修改部门信息
|
|
|
+ *
|
|
|
+ * @param department
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping("/updateDeptById")
|
|
|
+ public Map<String, Object> updateDeptById(Department department) {
|
|
|
+ try {
|
|
|
+ if (Blank.isEmpty(department.getDeptid())) {
|
|
|
+ return SendUtil.send(false, ConstStr.REQUEST_WRONGPARAMS, "部门id不能为空");
|
|
|
+ }
|
|
|
+ return tjService.updateDeptById(department);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return SendUtil.send(false, ConstStr.RESULT_FAILED);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 通过部门id,逻辑删除部门信息
|
|
|
+ *
|
|
|
+ * @param deptid
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping("/deleteDeptById")
|
|
|
+ public Map<String, Object> deleteDeptById(Integer deptid) {
|
|
|
+ try {
|
|
|
+ if (Blank.isEmpty(deptid)) {
|
|
|
+ return SendUtil.send(false, ConstStr.REQUEST_WRONGPARAMS, "部门id不能为空");
|
|
|
+ }
|
|
|
+ return tjService.deleteDeptById(deptid);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return SendUtil.send(false, ConstStr.RESULT_FAILED);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 通过部门id,分页查询对应的栏目信息
|
|
|
+ *
|
|
|
+ * @param page
|
|
|
+ * @param limit
|
|
|
+ * @param deptid
|
|
|
+ * @return
|
|
|
+ */
|
|
|
@GetMapping("/getChnlidListByDeptid")
|
|
|
public Map<String, Object> getChnlidListByDeptid(Integer page, Integer limit, Integer deptid) {
|
|
|
try {
|
|
|
- if (Blank.isNotEmpty(deptid)) {
|
|
|
+ if (Blank.isNotEmpty(page) && Blank.isNotEmpty(limit) && page > 0 && limit > 0 && Blank.isNotEmpty(deptid)) {
|
|
|
return SendUtil.send(true, null, tjService.getChnlidListByDeptid(page, limit, deptid));
|
|
|
}
|
|
|
- return SendUtil.send(true, ConstStr.REQUEST_WRONGPARAMS, "deptid不能为空");
|
|
|
+ return SendUtil.send(true, ConstStr.REQUEST_WRONGPARAMS, "page和limit不能为空,且要大于0,deptid不能为空");
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return SendUtil.send(false, ConstStr.RESULT_FAILED);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 分页查询所有的栏目信息
|
|
|
+ *
|
|
|
+ * @param page
|
|
|
+ * @param limit
|
|
|
+ * @param deptName
|
|
|
+ * @param chnlid
|
|
|
+ * @param chnlidName
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping("/getChnlidListPage")
|
|
|
+ public Map<String, Object> getChnlidListPage(Integer page, Integer limit, String deptName, Integer chnlid, String chnlidName) {
|
|
|
+ try {
|
|
|
+ if (Blank.isNotEmpty(page) && Blank.isNotEmpty(limit) && page > 0 && limit > 0) {
|
|
|
+ return SendUtil.send(true, null, tjService.getChnlidListPage(page, limit, deptName, chnlid, chnlidName));
|
|
|
+ }
|
|
|
+ return SendUtil.send(true, ConstStr.REQUEST_WRONGPARAMS, "page和limit不能为空,且要大于0,deptid不能为空");
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return SendUtil.send(false, ConstStr.RESULT_FAILED);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询未分配归属的栏目
|
|
|
+ *
|
|
|
+ * @param chnlid
|
|
|
+ * @param chnlidName
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping("/getNotVestedChnlid")
|
|
|
+ public Map<String, Object> getNotVestedChnlid(Integer page, Integer limit, Integer chnlid, String chnlidName) {
|
|
|
+ try {
|
|
|
+ if (Blank.isNotEmpty(page) && Blank.isNotEmpty(limit) && page > 0 && limit > 0) {
|
|
|
+ return tjService.getNotVestedChnlid(page, limit, chnlid, chnlidName);
|
|
|
+ }
|
|
|
+ return SendUtil.send(true, ConstStr.REQUEST_WRONGPARAMS, "page和limit不能为空,且要大于0");
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return SendUtil.send(false, ConstStr.RESULT_FAILED);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 这里作的保存,一个栏目只能存在与一个部门下
|
|
|
+ *
|
|
|
+ * @param chnlid
|
|
|
+ * @param deptid
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping("/saveChnlid")
|
|
|
+ public Map<String, Object> saveChnlid(Integer chnlid, Integer deptid) {
|
|
|
+ try {
|
|
|
+ if (Blank.isEmpty(chnlid) || Blank.isEmpty(deptid)) {
|
|
|
+ return SendUtil.send(false, ConstStr.REQUEST_WRONGPARAMS, "部门不能为空.栏目也不能为空");
|
|
|
+ }
|
|
|
+ return tjService.saveChnlid(chnlid, deptid);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return SendUtil.send(false, ConstStr.RESULT_FAILED);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @param id
|
|
|
+ * @param deptid
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping("/updateChnlidBelong")
|
|
|
+ public Map<String, Object> updateChnlidBelong(Integer id, Integer deptid) {
|
|
|
+ try {
|
|
|
+ if (Blank.isEmpty(id) || Blank.isEmpty(deptid)) {
|
|
|
+ return SendUtil.send(false, ConstStr.REQUEST_WRONGPARAMS, "部门不能为空.id也不能为空");
|
|
|
+ }
|
|
|
+ return tjService.updateChnlidBelong(id, deptid);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return SendUtil.send(false, ConstStr.RESULT_FAILED);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 通过id逻辑删除栏目
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping("/deleteChnlidById")
|
|
|
+ public Map<String, Object> deleteChnlidById(Integer id) {
|
|
|
+ try {
|
|
|
+ if (Blank.isEmpty(id)) {
|
|
|
+ return SendUtil.send(false, ConstStr.REQUEST_WRONGPARAMS, "id不能为空");
|
|
|
+ }
|
|
|
+ return tjService.deleteChnlidById(id);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|