| | |
| | | package com.consum.base.controller; |
| | | |
| | | import java.util.List; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import com.consum.base.BaseController; |
| | | import com.consum.base.core.utils.CommonUtil; |
| | | import com.consum.base.pojo.FinSysServerSearchParam; |
| | | import com.consum.base.pojo.FinSysServerVo; |
| | | import com.consum.base.service.FinSysServerImpl; |
| | | import com.consum.base.service.FinSysServerService; |
| | | import com.consum.model.po.FinSysServer; |
| | | import com.iplatform.model.po.S_role; |
| | | import com.walker.db.page.GenericPager; |
| | | import com.walker.db.page.ListPageContext; |
| | | import com.walker.db.page.PageSearch; |
| | | import com.walker.infrastructure.utils.DateUtils; |
| | | import com.walker.infrastructure.utils.NumberGenerator; |
| | | import com.walker.web.ResponseValue; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | import io.swagger.annotations.Api; |
| | | |
| | | @Api(value = "系统服务信息", tags = "系统服务信息") |
| | | @RestController |
| | | @RequestMapping("/pc/fin/sys/server") |
| | | public class FinSysServerController extends BaseController { |
| | | |
| | | private FinSysServerImpl finSysServerImpl; |
| | | private FinSysServerService finSysServerServiceImpl; |
| | | |
| | | @Autowired |
| | | public void setfinSysCategory(FinSysServerImpl finSysServerImpl){ |
| | | this.finSysServerImpl= finSysServerImpl; |
| | | public void setfinSysCategory(FinSysServerService finSysServerServiceImpl) { |
| | | this.finSysServerServiceImpl = finSysServerServiceImpl; |
| | | } |
| | | |
| | | /** |
| | |
| | | * @Date 2023/9/13 9:27 |
| | | */ |
| | | @GetMapping("/selectByDataScope") |
| | | public ResponseValue selectByDataScope(Integer dataScope){ |
| | | return ResponseValue.success(finSysServerImpl.getByDataScope(dataScope)); |
| | | public ResponseValue selectByDataScope(Integer dataScope) { |
| | | List<S_role> roleList = finSysServerServiceImpl.getByDataScope(dataScope); |
| | | // 过滤仓库管理员的显示 |
| | | roleList.removeIf(role -> "仓库管理员".equals(role.getRole_name())); |
| | | return ResponseValue.success(roleList); |
| | | } |
| | | |
| | | /** |
| | | * 查询左侧树 |
| | | * |
| | | * @return |
| | | */ |
| | | @GetMapping("/select/tree") |
| | | public ResponseValue selectFinSysCategoryTree(){ |
| | | public ResponseValue selectFinSysCategoryTree() { |
| | | |
| | | List<FinSysServerVo> finSysCategoryVos = finSysServerImpl.queryAllCategory(); |
| | | if(finSysCategoryVos!=null){ |
| | | List<FinSysServerVo> finSysCategoryVos = finSysServerServiceImpl.queryAllCategory(); |
| | | if (finSysCategoryVos != null) { |
| | | return ResponseValue.success(finSysCategoryVos); |
| | | } |
| | | return ResponseValue.error("未查询到数据!"); |
| | |
| | | } |
| | | |
| | | @GetMapping("/select/detail") |
| | | public ResponseValue selectById(@RequestParam(name = "id") Long Id){ |
| | | FinSysServer finSysServer = this.finSysServerImpl.get(new FinSysServer(Id)); |
| | | if (finSysServer == null) return ResponseValue.error("查询失败!"); |
| | | return ResponseValue.success("查询成功!",finSysServer); |
| | | public ResponseValue selectById(@RequestParam(name = "id") Long Id) { |
| | | FinSysServer finSysServer = this.finSysServerServiceImpl.get(new FinSysServer(Id)); |
| | | if (finSysServer == null) { |
| | | return ResponseValue.error("查询失败!"); |
| | | } |
| | | return ResponseValue.success("查询成功!", finSysServer); |
| | | } |
| | | |
| | | /** |
| | | * 分页查询 |
| | | * @param param |
| | | * |
| | | * @return |
| | | */ |
| | | @RequestMapping("/select/list") |
| | | public ResponseValue finSysServerList(FinSysServerSearchParam param){ |
| | | PageSearch pageSearch = ListPageContext.getPageSearch(); |
| | | public ResponseValue finSysServerList() { |
| | | FinSysServerSearchParam param = CommonUtil.getObjFromReq(FinSysServerSearchParam.class); |
| | | FinSysServerSearchParam param2 = new FinSysServerSearchParam(); |
| | | CommonUtil.copyProperties(param, param2); |
| | | param = param2; |
| | | |
| | | GenericPager<FinSysServer> pager = this.finSysServerImpl.selectServerListByPage(param); |
| | | GenericPager<FinSysServer> pager = this.finSysServerServiceImpl.selectServerListByPage(param); |
| | | return ResponseValue.success(pager); |
| | | } |
| | | |
| | | /** |
| | | * 添加 |
| | | * @param finSysServer |
| | | * |
| | | * @return |
| | | */ |
| | | @PostMapping("/insert") |
| | | public ResponseValue addFinSysServer(@RequestBody FinSysServer finSysServer){ |
| | | if(finSysServer==null) return ResponseValue.error("参数为空"); |
| | | finSysServer.setId(NumberGenerator.getLongSequenceNumber()); |
| | | finSysServer.setCreatedTime(DateUtils.getDateTimeNumber(System.currentTimeMillis())); |
| | | finSysServer.setCreatedBy(this.getCurrentUser().getUser_name()); |
| | | finSysServer.setLv(finSysServer.getParentId()+1); |
| | | int num = this.finSysServerImpl.insert(finSysServer); |
| | | if(num>0) return ResponseValue.success(1); |
| | | public ResponseValue addFinSysServer() { |
| | | FinSysServer param = CommonUtil.getObjFromReqBody(FinSysServer.class); |
| | | FinSysServer finSysServer = new FinSysServer(); |
| | | CommonUtil.copyProperties(param, finSysServer); |
| | | param = finSysServer; |
| | | |
| | | if (param == null) { |
| | | return ResponseValue.error("参数为空"); |
| | | } |
| | | param.setId(NumberGenerator.getLongSequenceNumber()); |
| | | param.setCreatedTime(DateUtils.getDateTimeNumber(System.currentTimeMillis())); |
| | | param.setCreatedBy(this.getCurrentUser().getUser_name()); |
| | | param.setLv(param.getParentId() + 1); |
| | | int num = this.finSysServerServiceImpl.insert(param); |
| | | if (num > 0) { |
| | | return ResponseValue.success(1); |
| | | } |
| | | return ResponseValue.error("插入失败!"); |
| | | } |
| | | |
| | | /** |
| | | * 编辑 |
| | | */ |
| | | @PostMapping("/edit") |
| | | public ResponseValue editFinSysServer(@RequestBody FinSysServer finSysServer){ |
| | | if (finSysServer==null) return ResponseValue.error("参数为空"); |
| | | // if(finSysServer.getLvType()!=null) { |
| | | // finSysServer.setLv(Long.valueOf(finSysServer.getLvType())); |
| | | // } |
| | | int num = this.finSysServerImpl.save(finSysServer); |
| | | return num>0 ? ResponseValue.success(1):ResponseValue.error("编辑失败!"); |
| | | public ResponseValue editFinSysServer() { |
| | | FinSysServer param = CommonUtil.getObjFromReqBody(FinSysServer.class); |
| | | FinSysServer finSysServer = new FinSysServer(); |
| | | CommonUtil.copyProperties(param, finSysServer); |
| | | param = finSysServer; |
| | | |
| | | if (param == null) { |
| | | return ResponseValue.error("参数为空"); |
| | | } |
| | | int num = this.finSysServerServiceImpl.save(param); |
| | | return num > 0 ? ResponseValue.success(1) : ResponseValue.error("编辑失败!"); |
| | | } |
| | | } |