dev:代码优化,该切计划和业务员
This commit is contained in:
@@ -1,68 +0,0 @@
|
||||
package org.nl.modules.system.rest;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
import org.nl.modules.system.service.GridService;
|
||||
import org.nl.modules.system.service.dto.GridDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 系统表格管理
|
||||
* @Date: 2022-08-01
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "系统表格管理")
|
||||
@RequestMapping("/api/grid")
|
||||
@Slf4j
|
||||
public class GridController {
|
||||
private final GridService gridService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询系统表格")
|
||||
@ApiOperation("查询系统表格")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page){
|
||||
return new ResponseEntity<>(gridService.queryAll(whereJson,page),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增系统表格")
|
||||
@ApiOperation("新增系统表格")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody GridDto dto){
|
||||
gridService.create(dto);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改系统表格")
|
||||
@ApiOperation("修改系统表格")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody GridDto dto){
|
||||
gridService.update(dto);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除系统表格")
|
||||
@ApiOperation("删除系统表格")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody String[] ids) {
|
||||
gridService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/selectList")
|
||||
@Log("下拉框获取表格数据")
|
||||
@ApiOperation("下拉框获取表格数据")
|
||||
public ResponseEntity<Object> getGridList(){
|
||||
return new ResponseEntity<>(gridService.getGridList(),HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
package org.nl.modules.system.rest;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
import org.nl.modules.system.service.GridFieldService;
|
||||
import org.nl.modules.system.service.dto.GridFieldDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 系统表格字段管理
|
||||
* @Date: 2022-08-01
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "系统表格字段管理")
|
||||
@RequestMapping("/api/gridField")
|
||||
@Slf4j
|
||||
public class GridFieldController {
|
||||
private final GridFieldService gridFieldService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询系统表格")
|
||||
@ApiOperation("查询系统表格")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page){
|
||||
return new ResponseEntity<>(gridFieldService.queryAll(whereJson,page),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("单个新增表格字段")
|
||||
@ApiOperation("单个新增表格字段")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody GridFieldDto dto){
|
||||
gridFieldService.create(dto);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改表格字段")
|
||||
@ApiOperation("修改表格字段")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody GridFieldDto dto){
|
||||
gridFieldService.update(dto);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除表格字段")
|
||||
@ApiOperation("删除表格字段")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody String[] ids) {
|
||||
gridFieldService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/batchAdd")
|
||||
@Log("批量新增表格字段")
|
||||
@ApiOperation("批量新增表格字段")
|
||||
public ResponseEntity<Object> batchAdd(@RequestBody JSONObject json){
|
||||
// log.info("json{}",json);
|
||||
gridFieldService.batchAdd(json);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PostMapping("/getGridFields")
|
||||
@Log("根据gridId获取所有字段")
|
||||
@ApiOperation("根据gridId获取所有字段")
|
||||
public ResponseEntity<Object> getGridFieldsById(@RequestBody String id){
|
||||
log.info("dto:{}",id);
|
||||
return new ResponseEntity<>(gridFieldService.getGridFieldsById(id),HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PostMapping("/getGridFieldsByCode")
|
||||
@Log("根据gridCode获取所有字段")
|
||||
@ApiOperation("根据gridCode获取所有字段")
|
||||
public ResponseEntity<Object> getGridFieldsByCode(@RequestBody String grid_code){
|
||||
log.info("dto:{}",grid_code);
|
||||
return new ResponseEntity<>(gridFieldService.getGridFieldsByCode(grid_code),HttpStatus.CREATED);
|
||||
}
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
package org.nl.modules.system.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.modules.system.service.dto.GridFieldDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 表格字段服务
|
||||
* @Date: 2022-08-01
|
||||
*/
|
||||
public interface GridFieldService {
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String,Object>
|
||||
*/
|
||||
Map<String,Object> queryAll(Map whereJson, Pageable page);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param dto
|
||||
*/
|
||||
void create(GridFieldDto dto);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
* @param id ID
|
||||
* @return Param
|
||||
*/
|
||||
GridFieldDto findById(String id);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param dto
|
||||
*/
|
||||
void update(GridFieldDto dto);
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
* @param ids
|
||||
*/
|
||||
void deleteAll(String[] ids);
|
||||
|
||||
/**
|
||||
* 批量添加数据
|
||||
* @param json
|
||||
*/
|
||||
void batchAdd(JSONObject json);
|
||||
|
||||
/**
|
||||
* 根据grid_id获取所有字段信息
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
JSONArray getGridFieldsById(String id);
|
||||
|
||||
/**
|
||||
* 根据grid_code获取所有字段信息
|
||||
* @param grid_code
|
||||
* @return
|
||||
*/
|
||||
JSONArray getGridFieldsByCode(String grid_code);
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
package org.nl.modules.system.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import org.nl.modules.system.service.dto.GridDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 表格服务接口
|
||||
* @Date: 2022-08-01
|
||||
*/
|
||||
public interface GridService {
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String,Object>
|
||||
*/
|
||||
Map<String,Object> queryAll(Map whereJson, Pageable page);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param dto
|
||||
*/
|
||||
void create(GridDto dto);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
* @param id ID
|
||||
* @return Param
|
||||
*/
|
||||
GridDto findById(String id);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param dto
|
||||
*/
|
||||
void update(GridDto dto);
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
* @param ids
|
||||
*/
|
||||
void deleteAll(String[] ids);
|
||||
|
||||
/**
|
||||
* 下拉选择表格
|
||||
* @return
|
||||
*/
|
||||
JSONArray getGridList();
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
package org.nl.modules.system.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 系统表格dto
|
||||
* @Date: 2022-08-01
|
||||
*/
|
||||
@Data
|
||||
public class GridDto {
|
||||
/**
|
||||
* 标识id
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 编码
|
||||
*/
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 创建人id
|
||||
*/
|
||||
private String create_id;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String create_name;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String create_time;
|
||||
|
||||
/**
|
||||
* 更新人id
|
||||
*/
|
||||
private String update_optid;
|
||||
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
private String update_optname;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private String update_time;
|
||||
}
|
||||
@@ -1,96 +0,0 @@
|
||||
package org.nl.modules.system.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 表格字段dto
|
||||
* @Date: 2022-08-01
|
||||
*/
|
||||
@Data
|
||||
public class GridFieldDto {
|
||||
/**
|
||||
* 标识id
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 编码
|
||||
*/
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 宽度
|
||||
*/
|
||||
private Integer width;
|
||||
|
||||
/**
|
||||
* 对齐
|
||||
*/
|
||||
private String align;
|
||||
|
||||
/**
|
||||
* 格式
|
||||
*/
|
||||
private String format;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort_num;
|
||||
|
||||
/**
|
||||
* 是否隐藏
|
||||
*/
|
||||
private String is_hidden;
|
||||
|
||||
/**
|
||||
* 创建人id
|
||||
*/
|
||||
private String create_id;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String create_name;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String create_time;
|
||||
|
||||
/**
|
||||
* 更新人id
|
||||
*/
|
||||
private String update_optid;
|
||||
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
private String update_optname;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private String update_time;
|
||||
|
||||
/**
|
||||
* 表格id
|
||||
*/
|
||||
private String grid_id;
|
||||
|
||||
/**
|
||||
* 表格名称
|
||||
*/
|
||||
private String grid_name;
|
||||
}
|
||||
@@ -1,94 +0,0 @@
|
||||
///*
|
||||
// * Copyright 2019-2020 Zheng Jie
|
||||
// *
|
||||
// * Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// * you may not use this file except in compliance with the License.
|
||||
// * You may obtain a copy of the License at
|
||||
// *
|
||||
// * http://www.apache.org/licenses/LICENSE-2.0
|
||||
// *
|
||||
// * Unless required by applicable law or agreed to in writing, software
|
||||
// * distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// * See the License for the specific language governing permissions and
|
||||
// * limitations under the License.
|
||||
// */
|
||||
//package org.nl.modules.system.service.impl;
|
||||
//
|
||||
//import cn.hutool.core.util.ObjectUtil;
|
||||
//import lombok.RequiredArgsConstructor;
|
||||
//import org.nl.modules.common.utils.enums.DataScopeEnum;
|
||||
//import org.nl.modules.system.domain.Dept;
|
||||
//import org.nl.modules.system.service.DataService;
|
||||
//import org.nl.system.service.dept.ISysDeptService;
|
||||
//import org.nl.system.service.role.ISysRoleService;
|
||||
//import org.nl.system.service.user.dto.UserDto;
|
||||
//import org.springframework.cache.annotation.CacheConfig;
|
||||
//import org.springframework.cache.annotation.Cacheable;
|
||||
//import org.springframework.stereotype.Service;
|
||||
//
|
||||
//import java.util.*;
|
||||
//
|
||||
///**
|
||||
// * @author Zheng Jie
|
||||
// * @website https://el-admin.vip
|
||||
// * @description 数据权限服务实现
|
||||
// * @date 2020-05-07
|
||||
// **/
|
||||
//@Service
|
||||
//@RequiredArgsConstructor
|
||||
//@CacheConfig(cacheNames = "data")
|
||||
//public class DataServiceImpl implements DataService {
|
||||
//
|
||||
// private final ISysRoleService roleService;
|
||||
// private final ISysDeptService deptService;
|
||||
//
|
||||
// /**
|
||||
// * 用户角色改变时需清理缓存
|
||||
// * @param user /
|
||||
// * @return /
|
||||
// */
|
||||
// @Override
|
||||
// @Cacheable(key = "'user:' + #p0.id")
|
||||
// public List<Long> getDeptIds(UserDto user) {
|
||||
// // 用于存储部门id
|
||||
// Set<Long> deptIds = new HashSet<>();
|
||||
// // 查询用户角色
|
||||
// List<RoleSmallDto> roleSet = roleService.findByUsersId(user.getId());
|
||||
// // 获取对应的部门ID
|
||||
// for (RoleSmallDto role : roleSet) {
|
||||
// DataScopeEnum dataScopeEnum = DataScopeEnum.find(role.getDataScope());
|
||||
// switch (Objects.requireNonNull(dataScopeEnum)) {
|
||||
// case THIS_LEVEL:
|
||||
// if (ObjectUtil.isNotEmpty(user.getDept())){
|
||||
// deptIds.add(user.getDept().getId());
|
||||
// }
|
||||
// break;
|
||||
// case CUSTOMIZE:
|
||||
// deptIds.addAll(getCustomize(deptIds, role));
|
||||
// break;
|
||||
// default:
|
||||
// return new ArrayList<>(deptIds);
|
||||
// }
|
||||
// }
|
||||
// return new ArrayList<>(deptIds);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 获取自定义的数据权限
|
||||
// * @param deptIds 部门ID
|
||||
// * @param role 角色
|
||||
// * @return 数据权限ID
|
||||
// */
|
||||
// public Set<Long> getCustomize(Set<Long> deptIds, RoleSmallDto role){
|
||||
// Set<Dept> depts = deptService.findByRoleId(role.getId());
|
||||
// for (Dept dept : depts) {
|
||||
// deptIds.add(dept.getId());
|
||||
// List<Dept> deptChildren = deptService.findByPid(dept.getId());
|
||||
// if (deptChildren != null && deptChildren.size() != 0) {
|
||||
// deptIds.addAll(deptService.getDeptChildren(deptChildren));
|
||||
// }
|
||||
// }
|
||||
// return deptIds;
|
||||
// }
|
||||
//}
|
||||
@@ -1,147 +0,0 @@
|
||||
package org.nl.modules.system.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.modules.system.service.GridFieldService;
|
||||
import org.nl.modules.system.service.dto.GridFieldDto;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.WqlUtil;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 表格字段实现类
|
||||
* @Date: 2022-08-01
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class GridFieldServiceImpl implements GridFieldService {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||
HashMap<String,String> map = new HashMap<>();
|
||||
String grid_name = (String) whereJson.get("name");
|
||||
map.put("flag","1");
|
||||
if (StrUtil.isNotEmpty(grid_name)){
|
||||
map.put("grid_name","%" + grid_name + "%");
|
||||
}
|
||||
JSONObject json = WQL.getWO("GRIDFIELD").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "sys_grid_field.sort_num");
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(GridFieldDto dto) {
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
String uid = SecurityUtils.getCurrentUserId();
|
||||
String now = DateUtil.now();
|
||||
|
||||
dto.setId(IdUtil.simpleUUID());
|
||||
dto.setCreate_id(uid.toString());
|
||||
dto.setUpdate_optid(uid.toString());
|
||||
dto.setCreate_name(currentUsername);
|
||||
dto.setUpdate_optname(currentUsername);
|
||||
dto.setUpdate_time(now);
|
||||
dto.setCreate_time(now);
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("sys_grid_field");
|
||||
JSONObject json = JSONObject.parseObject( JSONObject.toJSONString(dto));
|
||||
wo.insert(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GridFieldDto findById(String id) {
|
||||
WQLObject wo = WQLObject.getWQLObject("sys_grid_field");
|
||||
JSONObject json = wo.query("id ='" + id + "' AND is_delete = '0'").uniqueResult(0);
|
||||
final GridFieldDto obj = json.toJavaObject(GridFieldDto.class);;
|
||||
return obj;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(GridFieldDto dto) {
|
||||
GridFieldDto entity = this.findById(dto.getId());
|
||||
if (entity == null) {
|
||||
throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
}
|
||||
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
String now = DateUtil.now();
|
||||
dto.setUpdate_time(now);
|
||||
dto.setUpdate_optid(SecurityUtils.getCurrentUserId().toString());
|
||||
dto.setUpdate_optname(currentUsername);
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("sys_grid_field");
|
||||
JSONObject json = JSONObject.parseObject( JSONObject.toJSONString(dto));
|
||||
wo.update(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteAll(String[] ids) {
|
||||
WQLObject wo = WQLObject.getWQLObject("sys_grid_field");
|
||||
for (String id : ids) {
|
||||
// GridFieldDto gridFieldDto = this.findById(id);
|
||||
// gridFieldDto.setIs_delete("1");
|
||||
// JSONObject json = JSONObject.parseObject( JSONObject.toJSONString(gridFieldDto));
|
||||
// wo.update(json);
|
||||
wo.delete("grid_id = '" + id + "'");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void batchAdd(JSONObject json) {
|
||||
String grid_id = json.getString("grid_id");
|
||||
JSONArray fieldDatas = json.getJSONArray("gridFieldData");
|
||||
WQLObject wo = WQLObject.getWQLObject("sys_grid_field");
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
// 先删除原先所有的数据
|
||||
wo.delete("grid_id = '" + grid_id + "'");
|
||||
// 然后添加
|
||||
for (int i=0; i<fieldDatas.size(); i++) {
|
||||
String now = DateUtil.now();
|
||||
JSONObject fieldData = fieldDatas.getJSONObject(i);
|
||||
fieldData.put("grid_id", grid_id);
|
||||
fieldData.put("id", IdUtil.simpleUUID());
|
||||
fieldData.put("create_id", currentUserId);
|
||||
fieldData.put("update_optid", currentUserId);
|
||||
fieldData.put("create_name", currentUsername);
|
||||
fieldData.put("update_optname", currentUsername);
|
||||
fieldData.put("create_time", now);
|
||||
fieldData.put("update_time", now);
|
||||
wo.insert(fieldData);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONArray getGridFieldsById(String id) {
|
||||
JSONArray arr = WQLObject.getWQLObject("sys_grid_field").query("grid_id = '"+ id +"' AND is_delete= '0'", "sort_num").getResultJSONArray(0);
|
||||
return arr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONArray getGridFieldsByCode(String grid_code) {
|
||||
// 获取得到id
|
||||
WQLObject wo = WQLObject.getWQLObject("sys_grid");
|
||||
JSONObject json = wo.query("code ='" + grid_code + "'").uniqueResult(0);
|
||||
String grid_id = json.getString("id");
|
||||
JSONArray arr = WQLObject.getWQLObject("sys_grid_field").query("grid_id = '"+ grid_id +"'", "sort_num").getResultJSONArray(0);
|
||||
return arr;
|
||||
}
|
||||
}
|
||||
@@ -1,116 +0,0 @@
|
||||
package org.nl.modules.system.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.modules.system.service.GridService;
|
||||
import org.nl.modules.system.service.dto.GridDto;
|
||||
import org.nl.modules.wql.core.bean.ResultBean;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.WqlUtil;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: 表格服务实现类
|
||||
* @Date: 2022-08-01
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class GridServiceImpl implements GridService {
|
||||
@Override
|
||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||
WQLObject wo = WQLObject.getWQLObject("sys_grid");
|
||||
String where = "1=1";
|
||||
if (whereJson.get("name") != null) {
|
||||
where = "name like ('%" + whereJson.get("name") + "%')";
|
||||
}
|
||||
ResultBean rb = wo.pagequery(WqlUtil.getHttpContext(page), where, "update_time desc");
|
||||
final JSONObject json = rb.pageResult();
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(GridDto dto) {
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
String uid = SecurityUtils.getCurrentUserId();
|
||||
String now = DateUtil.now();
|
||||
|
||||
dto.setId(IdUtil.simpleUUID());
|
||||
dto.setCreate_id(uid.toString());
|
||||
dto.setUpdate_optid(uid.toString());
|
||||
dto.setCreate_name(currentUsername);
|
||||
dto.setUpdate_optname(currentUsername);
|
||||
dto.setUpdate_time(now);
|
||||
dto.setCreate_time(now);
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("sys_grid");
|
||||
JSONObject json = JSONObject.parseObject( JSONObject.toJSONString(dto));
|
||||
wo.insert(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GridDto findById(String id) {
|
||||
WQLObject wo = WQLObject.getWQLObject("sys_grid");
|
||||
JSONObject json = wo.query("id = '" + id + "'").uniqueResult(0);
|
||||
final GridDto obj = json.toJavaObject(GridDto.class);;
|
||||
return obj;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(GridDto dto) {
|
||||
GridDto entity = this.findById(dto.getId());
|
||||
if (entity == null) {
|
||||
throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
}
|
||||
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
String now = DateUtil.now();
|
||||
dto.setUpdate_optid(SecurityUtils.getCurrentUserId().toString());
|
||||
dto.setUpdate_time(now);
|
||||
dto.setUpdate_optname(currentUsername);
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("sys_grid");
|
||||
JSONObject json = JSONObject.parseObject( JSONObject.toJSONString(dto));
|
||||
wo.update(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteAll(String[] ids) {
|
||||
WQLObject wo = WQLObject.getWQLObject("sys_grid");
|
||||
WQLObject wqlObject = WQLObject.getWQLObject("sys_grid_field");
|
||||
// 删除明细
|
||||
for (String grid_id : ids) {
|
||||
wqlObject.delete("grid_id = '" + grid_id + "'");
|
||||
wo.delete("id = '" + grid_id + "'");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONArray getGridList() {
|
||||
JSONArray arr = WQLObject.getWQLObject("sys_grid").query().getResultJSONArray(0);
|
||||
JSONArray result = new JSONArray();
|
||||
for (int i = 0; i < arr.size(); i++) {
|
||||
JSONObject obj = arr.getJSONObject(i);
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("grid_id", obj.getString("id"));
|
||||
json.put("grid_code", obj.getString("code"));
|
||||
json.put("grid_name", obj.getString("name"));
|
||||
result.add(json);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
[交易说明]
|
||||
交易名: 获取用户权限
|
||||
所属模块:
|
||||
功能简述:
|
||||
版权所有:
|
||||
表引用:
|
||||
版本经历:
|
||||
|
||||
[数据库]
|
||||
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库
|
||||
|
||||
[IO定义]
|
||||
#################################################
|
||||
## 表字段对应输入参数
|
||||
#################################################
|
||||
输入.flag TYPEAS s_string
|
||||
输入.user_id TYPEAS s_string
|
||||
|
||||
[临时表]
|
||||
--这边列出来的临时表就会在运行期动态创建
|
||||
|
||||
[临时变量]
|
||||
--所有中间过程变量均可在此处定义
|
||||
|
||||
[业务过程]
|
||||
|
||||
##########################################
|
||||
# 1、输入输出检查 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 2、主过程前处理 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 3、业务主过程 #
|
||||
##########################################
|
||||
IF 输入.flag = "1"
|
||||
QUERY
|
||||
SELECT DISTINCT
|
||||
permission
|
||||
FROM
|
||||
sys_menu
|
||||
WHERE
|
||||
menu_id IN
|
||||
(
|
||||
SELECT
|
||||
menu_id
|
||||
FROM
|
||||
sys_roles_menus
|
||||
WHERE
|
||||
role_id IN
|
||||
(
|
||||
SELECT
|
||||
role_id
|
||||
FROM
|
||||
sys_users_roles
|
||||
WHERE
|
||||
1=1
|
||||
OPTION 输入.user_id <> ""
|
||||
user_id = 输入.user_id
|
||||
ENDOPTION
|
||||
)
|
||||
)
|
||||
AND permission IS NOT NULL
|
||||
AND permission != ''
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
@@ -1,56 +0,0 @@
|
||||
[交易说明]
|
||||
交易名: 表格数据
|
||||
所属模块:
|
||||
功能简述:
|
||||
版权所有:
|
||||
表引用:
|
||||
版本经历:
|
||||
|
||||
[数据库]
|
||||
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库
|
||||
|
||||
[IO定义]
|
||||
#################################################
|
||||
## 表字段对应输入参数
|
||||
#################################################
|
||||
输入.flag TYPEAS s_string
|
||||
输入.grid_name TYPEAS s_string
|
||||
|
||||
|
||||
|
||||
[临时表]
|
||||
--这边列出来的临时表就会在运行期动态创建
|
||||
|
||||
[临时变量]
|
||||
--所有中间过程变量均可在此处定义
|
||||
|
||||
[业务过程]
|
||||
|
||||
##########################################
|
||||
# 1、输入输出检查 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 2、主过程前处理 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 3、业务主过程 #
|
||||
##########################################
|
||||
IF 输入.flag = "1"
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
sys_grid_field.*, sys_grid.name as grid_name
|
||||
FROM
|
||||
sys_grid_field
|
||||
LEFT JOIN sys_grid ON sys_grid_field.grid_id = sys_grid.id
|
||||
WHERE
|
||||
sys_grid_field.is_delete = '0' AND sys_grid.is_delete = '0'
|
||||
OPTION 输入.grid_name <> ""
|
||||
sys_grid.name LIKE 输入.grid_name
|
||||
ENDOPTION
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
@@ -1,56 +0,0 @@
|
||||
[交易说明]
|
||||
交易名: 部门数据
|
||||
所属模块:
|
||||
功能简述:
|
||||
版权所有:
|
||||
表引用:
|
||||
版本经历:
|
||||
|
||||
[数据库]
|
||||
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库
|
||||
|
||||
[IO定义]
|
||||
#################################################
|
||||
## 表字段对应输入参数
|
||||
#################################################
|
||||
输入.flag TYPEAS s_string
|
||||
输入.grid_name TYPEAS s_string
|
||||
|
||||
|
||||
|
||||
[临时表]
|
||||
--这边列出来的临时表就会在运行期动态创建
|
||||
|
||||
[临时变量]
|
||||
--所有中间过程变量均可在此处定义
|
||||
|
||||
[业务过程]
|
||||
|
||||
##########################################
|
||||
# 1、输入输出检查 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 2、主过程前处理 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 3、业务主过程 #
|
||||
##########################################
|
||||
IF 输入.flag = "1"
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
sys_grid_field.*, sys_grid.name as grid_name
|
||||
FROM
|
||||
sys_grid_field
|
||||
LEFT JOIN sys_grid ON sys_grid_field.grid_id = sys_grid.id
|
||||
WHERE
|
||||
sys_grid_field.is_delete = '0' AND sys_grid.is_delete = '0'
|
||||
OPTION 输入.grid_name <> ""
|
||||
sys_grid.name LIKE 输入.grid_name
|
||||
ENDOPTION
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
Reference in New Issue
Block a user