feat: 区域管理
This commit is contained in:
@@ -43,4 +43,59 @@ public class UtAreaController extends BaseController<UtArea> {
|
||||
return Result.success(utAreaEOService.getAreaSelList(utAreaEO));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "|UtAreaEO|分页查询")
|
||||
@GetMapping("/page")
|
||||
// @RequiresPermissions("lawssBase:utArea:page")
|
||||
public ResponseMessage<PageInfo<UtArea>> page(UtAreaEOPage page) throws Exception {
|
||||
List<UtArea> rows = utAreaEOService.queryByPage(page);
|
||||
return Result.success(getPageInfo(page.getPager(), rows));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "|UtAreaEO|查询")
|
||||
@GetMapping("/list")
|
||||
// @RequiresPermissions("lawssBase:utArea:list")
|
||||
public ResponseMessage<List<UtArea>> list(UtAreaEOPage page) throws Exception {
|
||||
return Result.success(utAreaEOService.queryByList(page));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "|UtAreaEO|详情")
|
||||
@GetMapping("/getById")
|
||||
// @RequiresPermissions("lawssBase:utArea:get")
|
||||
public ResponseMessage<UtArea> find(@PathVariable String id) throws Exception {
|
||||
return Result.success(utAreaEOService.getById(id));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "|UtAreaEO|新增")
|
||||
@PostMapping("/createUtArea")
|
||||
// @RequiresPermissions("lawssBase:utArea:save")
|
||||
public ResponseMessage<UtArea> create(@RequestBody UtArea utAreaEO) throws Exception {
|
||||
String result = utAreaEOService.createUtArea(utAreaEO);
|
||||
if ("success".equals(result)) {
|
||||
return Result.success("0","新增成功",utAreaEO);
|
||||
} else {
|
||||
return Result.error("0",result,utAreaEO);
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation(value = "|UtAreaEO|修改")
|
||||
@PutMapping("/updateUtArea")
|
||||
// @RequiresPermissions("lawssBase:utArea:update")
|
||||
public ResponseMessage<UtArea> update(@RequestBody UtArea utAreaEO) throws Exception {
|
||||
String result = utAreaEOService.updateUtArea(utAreaEO);
|
||||
if ("success".equals(result)) {
|
||||
return Result.success("0","修改成功",utAreaEO);
|
||||
} else {
|
||||
return Result.error("0",result,utAreaEO);
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation(value = "|UtAreaEO|删除")
|
||||
@DeleteMapping("/deleteById")
|
||||
// @RequiresPermissions("lawssBase:utArea:delete")
|
||||
public ResponseMessage delete(String id) throws Exception {
|
||||
utAreaEOService.removeById(id);
|
||||
logger.info("delete from UT_AREA where id = {}", id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.adc.da.slrs.utArea.dao;
|
||||
|
||||
import com.adc.da.slrs.utArea.entity.UtArea;
|
||||
import com.adc.da.slrs.utArea.page.UtAreaEOPage;
|
||||
import com.adc.da.sys.common.SelectionResult;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
@@ -16,6 +17,15 @@ import java.util.List;
|
||||
*/
|
||||
public interface UtAreaDao extends BaseMapper<UtArea> {
|
||||
|
||||
Integer queryByCount(UtAreaEOPage page);
|
||||
|
||||
List<UtArea> queryByPage(UtAreaEOPage page);
|
||||
|
||||
List<UtArea> queryByList(UtAreaEOPage page);
|
||||
|
||||
|
||||
|
||||
|
||||
List<SelectionResult> getAreaSelList(UtArea utAreaEO);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.adc.da.slrs.utArea.service;
|
||||
|
||||
import com.adc.da.slrs.utArea.entity.UtArea;
|
||||
import com.adc.da.slrs.utArea.page.UtAreaEOPage;
|
||||
import com.adc.da.sys.common.SelectionResult;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
@@ -17,4 +18,12 @@ import java.util.List;
|
||||
public interface IUtAreaService extends IService<UtArea> {
|
||||
|
||||
List<SelectionResult> getAreaSelList(UtArea utAreaEO);
|
||||
|
||||
List<UtArea> queryByPage(UtAreaEOPage page);
|
||||
|
||||
List<UtArea> queryByList(UtAreaEOPage page);
|
||||
|
||||
String createUtArea(UtArea utAreaEO);
|
||||
|
||||
String updateUtArea(UtArea utAreaEO);
|
||||
}
|
||||
|
||||
@@ -2,14 +2,18 @@ package com.adc.da.slrs.utArea.service.impl;
|
||||
|
||||
import com.adc.da.slrs.utArea.entity.UtArea;
|
||||
import com.adc.da.slrs.utArea.dao.UtAreaDao;
|
||||
import com.adc.da.slrs.utArea.page.UtAreaEOPage;
|
||||
import com.adc.da.slrs.utArea.service.IUtAreaService;
|
||||
import com.adc.da.sys.common.SelectionResult;
|
||||
import com.adc.da.util.LoginUserUtil;
|
||||
import com.adc.da.util.UUIDUtils;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -36,4 +40,57 @@ public class UtAreaServiceImpl extends ServiceImpl<UtAreaDao, UtArea> implements
|
||||
return dao.getAreaSelList(utAreaEO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UtArea> queryByPage(UtAreaEOPage page){
|
||||
Integer rowCount = dao.queryByCount(page);
|
||||
page.getPager().setRowCount(rowCount);
|
||||
return dao.queryByPage(page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UtArea> queryByList(UtAreaEOPage page){
|
||||
return dao.queryByList(page);
|
||||
}
|
||||
|
||||
public String createUtArea (UtArea utAreaEO) {
|
||||
// 判断名称是否已存在
|
||||
UtAreaEOPage page = new UtAreaEOPage();
|
||||
page.setAreaName(utAreaEO.getAreaName());
|
||||
page.setSarType(utAreaEO.getSarType());
|
||||
List<UtArea> getList = dao.queryByList(page);
|
||||
if (getList != null && !getList.isEmpty()) {
|
||||
return "新增失败,展示区域名称已存在";
|
||||
}
|
||||
utAreaEO.setId(UUIDUtils.randomUUID20());
|
||||
utAreaEO.setCreationUser(LoginUserUtil.getUserId());
|
||||
utAreaEO.setCreationTime(new Date());
|
||||
utAreaEO.setModifyTime(new Date());
|
||||
utAreaEO.setValidFlag(0);
|
||||
int result = dao.insert(utAreaEO);
|
||||
if (result > 0) {
|
||||
return "success";
|
||||
} else {
|
||||
return "新增失败";
|
||||
}
|
||||
}
|
||||
|
||||
public String updateUtArea (UtArea utAreaEO) {
|
||||
// 判断名称是否已存在
|
||||
UtAreaEOPage page = new UtAreaEOPage();
|
||||
page.setAreaName(utAreaEO.getAreaName());
|
||||
page.setSarType(utAreaEO.getSarType());
|
||||
page.setNotId(utAreaEO.getId());
|
||||
List<UtArea> getList = dao.queryByList(page);
|
||||
if (getList != null && !getList.isEmpty()) {
|
||||
return "修改失败,展示区域名称已存在";
|
||||
}
|
||||
utAreaEO.setModifyTime(new Date());
|
||||
int result = dao.updateById(utAreaEO);
|
||||
if (result > 0) {
|
||||
return "success";
|
||||
} else {
|
||||
return "修改失败";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user