表格列表、编码生成完善
This commit is contained in:
@@ -39,7 +39,6 @@ public class GridController {
|
||||
@Log("新增系统表格")
|
||||
@ApiOperation("新增系统表格")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody GridDto dto){
|
||||
log.info("dto:{}",dto);
|
||||
gridService.create(dto);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@@ -40,7 +40,6 @@ public class GridFieldController {
|
||||
@Log("单个新增表格字段")
|
||||
@ApiOperation("单个新增表格字段")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody GridFieldDto dto){
|
||||
log.info("dto:{}",dto);
|
||||
gridFieldService.create(dto);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@@ -16,14 +16,31 @@ public interface GenCodeService {
|
||||
*/
|
||||
JSONObject queryAll(Map form, Pageable pageable);
|
||||
|
||||
/**
|
||||
* 新增编码
|
||||
* @param form
|
||||
*/
|
||||
public void create(Map form);
|
||||
|
||||
/**
|
||||
* 删除编码
|
||||
* @param ids
|
||||
*/
|
||||
public void delete(Set<String> ids);
|
||||
|
||||
/**
|
||||
* 更新编码
|
||||
* @param json
|
||||
*/
|
||||
public void update(JSONObject json);
|
||||
|
||||
public String codeDemo(Map form);
|
||||
|
||||
/**
|
||||
* 根据编码获取id
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
public String queryIdByCode(String code);
|
||||
|
||||
}
|
||||
|
||||
@@ -30,29 +30,29 @@ public class GridDto {
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 是否激活
|
||||
* 创建人id
|
||||
*/
|
||||
private String is_active;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
private String is_delete;
|
||||
private String create_id;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String create_by;
|
||||
private String create_name;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String create_time;
|
||||
|
||||
/**
|
||||
* 更新人id
|
||||
*/
|
||||
private String update_optid;
|
||||
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
private String update_by;
|
||||
private String update_optname;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
|
||||
@@ -49,35 +49,35 @@ public class GridFieldDto {
|
||||
*/
|
||||
private Integer sort_num;
|
||||
|
||||
/**
|
||||
* 是否激活
|
||||
*/
|
||||
private String is_active;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
private String is_delete;
|
||||
|
||||
/**
|
||||
* 是否隐藏
|
||||
*/
|
||||
private String is_hidden;
|
||||
|
||||
/**
|
||||
* 创建人id
|
||||
*/
|
||||
private String create_id;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String create_by;
|
||||
private String create_name;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String create_time;
|
||||
|
||||
/**
|
||||
* 更新人id
|
||||
*/
|
||||
private String update_optid;
|
||||
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
private String update_by;
|
||||
private String update_optname;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
|
||||
@@ -50,6 +50,8 @@ public class GenCodeServiceImpl implements GenCodeService {
|
||||
|
||||
@Override
|
||||
public void create(Map form) {
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
WQLObject wql = WQLObject.getWQLObject("sys_code_rule");
|
||||
JSONObject json = new JSONObject();
|
||||
String id = IdUtil.simpleUUID();
|
||||
@@ -62,10 +64,12 @@ public class GenCodeServiceImpl implements GenCodeService {
|
||||
json.put("id", id);
|
||||
json.put("code", form.get("code"));
|
||||
json.put("name", form.get("name"));
|
||||
json.put("is_active", "1");
|
||||
json.put("is_delete", "0");
|
||||
json.put("create_by", SecurityUtils.getCurrentUsername());
|
||||
json.put("create_id", currentUserId);
|
||||
json.put("update_optid", currentUserId);
|
||||
json.put("create_name", currentUsername);
|
||||
json.put("update_optname", currentUsername);
|
||||
json.put("create_time", now);
|
||||
json.put("update_time", now);
|
||||
WQLObject.getWQLObject("sys_code_rule").insert(json);
|
||||
}
|
||||
|
||||
@@ -87,8 +91,9 @@ public class GenCodeServiceImpl implements GenCodeService {
|
||||
throw new BadRequestException("该编码code已存在,请校验!");
|
||||
}
|
||||
String now = DateUtil.now();
|
||||
json.put("update_optid", SecurityUtils.getCurrentUserId());
|
||||
json.put("update_time", now);
|
||||
json.put("update_by", SecurityUtils.getCurrentUsername());
|
||||
json.put("update_optname", SecurityUtils.getCurrentUsername());
|
||||
WQLObject.getWQLObject("sys_code_rule").update(json);
|
||||
}
|
||||
|
||||
|
||||
@@ -47,11 +47,14 @@ public class GridFieldServiceImpl implements GridFieldService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(GridFieldDto dto) {
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
Long uid = SecurityUtils.getCurrentUserId();
|
||||
String now = DateUtil.now();
|
||||
|
||||
dto.setId(IdUtil.simpleUUID());
|
||||
dto.setCreate_by(currentUsername);
|
||||
dto.setUpdate_by(currentUsername);
|
||||
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);
|
||||
|
||||
@@ -77,7 +80,8 @@ public class GridFieldServiceImpl implements GridFieldService {
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
String now = DateUtil.now();
|
||||
dto.setUpdate_time(now);
|
||||
dto.setUpdate_by(currentUsername);
|
||||
dto.setUpdate_optid(SecurityUtils.getCurrentUserId().toString());
|
||||
dto.setUpdate_optname(currentUsername);
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("sys_grid_field");
|
||||
JSONObject json = JSONObject.parseObject( JSONObject.toJSONString(dto));
|
||||
@@ -89,10 +93,11 @@ public class GridFieldServiceImpl implements GridFieldService {
|
||||
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);
|
||||
// GridFieldDto gridFieldDto = this.findById(id);
|
||||
// gridFieldDto.setIs_delete("1");
|
||||
// JSONObject json = JSONObject.parseObject( JSONObject.toJSONString(gridFieldDto));
|
||||
// wo.update(json);
|
||||
wo.delete("grid_id = '" + id + "'");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,6 +108,7 @@ public class GridFieldServiceImpl implements GridFieldService {
|
||||
JSONArray fieldDatas = json.getJSONArray("gridFieldData");
|
||||
WQLObject wo = WQLObject.getWQLObject("sys_grid_field");
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
// 先删除原先所有的数据
|
||||
wo.delete("grid_id = '" + grid_id + "'");
|
||||
// 然后添加
|
||||
@@ -111,9 +117,11 @@ public class GridFieldServiceImpl implements GridFieldService {
|
||||
JSONObject fieldData = fieldDatas.getJSONObject(i);
|
||||
fieldData.put("grid_id", grid_id);
|
||||
fieldData.put("id", IdUtil.simpleUUID());
|
||||
fieldData.put("create_by", currentUsername);
|
||||
fieldData.put("create_time", currentUsername);
|
||||
fieldData.put("update_by", now);
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ public class GridServiceImpl implements GridService {
|
||||
if (whereJson.get("name") != null) {
|
||||
where = "name like ('%" + whereJson.get("name") + "%')";
|
||||
}
|
||||
ResultBean rb = wo.pagequery(WqlUtil.getHttpContext(page), where +" AND is_delete = '0'", "update_time desc");
|
||||
ResultBean rb = wo.pagequery(WqlUtil.getHttpContext(page), where, "update_time desc");
|
||||
final JSONObject json = rb.pageResult();
|
||||
return json;
|
||||
}
|
||||
@@ -44,11 +44,14 @@ public class GridServiceImpl implements GridService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(GridDto dto) {
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
Long uid = SecurityUtils.getCurrentUserId();
|
||||
String now = DateUtil.now();
|
||||
|
||||
dto.setId(IdUtil.simpleUUID());
|
||||
dto.setCreate_by(currentUsername);
|
||||
dto.setUpdate_by(currentUsername);
|
||||
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);
|
||||
|
||||
@@ -60,7 +63,7 @@ public class GridServiceImpl implements GridService {
|
||||
@Override
|
||||
public GridDto findById(String id) {
|
||||
WQLObject wo = WQLObject.getWQLObject("sys_grid");
|
||||
JSONObject json = wo.query("id ='" + id + "' AND is_delete = '0'").uniqueResult(0);
|
||||
JSONObject json = wo.query("id = '" + id + "'").uniqueResult(0);
|
||||
final GridDto obj = json.toJavaObject(GridDto.class);;
|
||||
return obj;
|
||||
}
|
||||
@@ -73,8 +76,9 @@ public class GridServiceImpl implements GridService {
|
||||
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
String now = DateUtil.now();
|
||||
dto.setUpdate_optid(SecurityUtils.getCurrentUserId().toString());
|
||||
dto.setUpdate_time(now);
|
||||
dto.setUpdate_by(currentUsername);
|
||||
dto.setUpdate_optname(currentUsername);
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("sys_grid");
|
||||
JSONObject json = JSONObject.parseObject( JSONObject.toJSONString(dto));
|
||||
@@ -95,7 +99,7 @@ public class GridServiceImpl implements GridService {
|
||||
|
||||
@Override
|
||||
public JSONArray getGridList() {
|
||||
JSONArray arr = WQLObject.getWQLObject("sys_grid").query("is_delete= '0' AND is_active= '1'").getResultJSONArray(0);
|
||||
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);
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user