表格列表、编码生成完善
This commit is contained in:
@@ -39,7 +39,6 @@ public class GridController {
|
|||||||
@Log("新增系统表格")
|
@Log("新增系统表格")
|
||||||
@ApiOperation("新增系统表格")
|
@ApiOperation("新增系统表格")
|
||||||
public ResponseEntity<Object> create(@Validated @RequestBody GridDto dto){
|
public ResponseEntity<Object> create(@Validated @RequestBody GridDto dto){
|
||||||
log.info("dto:{}",dto);
|
|
||||||
gridService.create(dto);
|
gridService.create(dto);
|
||||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,6 @@ public class GridFieldController {
|
|||||||
@Log("单个新增表格字段")
|
@Log("单个新增表格字段")
|
||||||
@ApiOperation("单个新增表格字段")
|
@ApiOperation("单个新增表格字段")
|
||||||
public ResponseEntity<Object> create(@Validated @RequestBody GridFieldDto dto){
|
public ResponseEntity<Object> create(@Validated @RequestBody GridFieldDto dto){
|
||||||
log.info("dto:{}",dto);
|
|
||||||
gridFieldService.create(dto);
|
gridFieldService.create(dto);
|
||||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,14 +16,31 @@ public interface GenCodeService {
|
|||||||
*/
|
*/
|
||||||
JSONObject queryAll(Map form, Pageable pageable);
|
JSONObject queryAll(Map form, Pageable pageable);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增编码
|
||||||
|
* @param form
|
||||||
|
*/
|
||||||
public void create(Map form);
|
public void create(Map form);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除编码
|
||||||
|
* @param ids
|
||||||
|
*/
|
||||||
public void delete(Set<String> ids);
|
public void delete(Set<String> ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新编码
|
||||||
|
* @param json
|
||||||
|
*/
|
||||||
public void update(JSONObject json);
|
public void update(JSONObject json);
|
||||||
|
|
||||||
public String codeDemo(Map form);
|
public String codeDemo(Map form);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据编码获取id
|
||||||
|
* @param code
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public String queryIdByCode(String code);
|
public String queryIdByCode(String code);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,29 +30,29 @@ public class GridDto {
|
|||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否激活
|
* 创建人id
|
||||||
*/
|
*/
|
||||||
private String is_active;
|
private String create_id;
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否删除
|
|
||||||
*/
|
|
||||||
private String is_delete;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建人
|
* 创建人
|
||||||
*/
|
*/
|
||||||
private String create_by;
|
private String create_name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建时间
|
* 创建时间
|
||||||
*/
|
*/
|
||||||
private String create_time;
|
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 Integer sort_num;
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否激活
|
|
||||||
*/
|
|
||||||
private String is_active;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否删除
|
|
||||||
*/
|
|
||||||
private String is_delete;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否隐藏
|
* 是否隐藏
|
||||||
*/
|
*/
|
||||||
private String is_hidden;
|
private String is_hidden;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人id
|
||||||
|
*/
|
||||||
|
private String create_id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建人
|
* 创建人
|
||||||
*/
|
*/
|
||||||
private String create_by;
|
private String create_name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建时间
|
* 创建时间
|
||||||
*/
|
*/
|
||||||
private String create_time;
|
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
|
@Override
|
||||||
public void create(Map form) {
|
public void create(Map form) {
|
||||||
|
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||||
|
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||||
WQLObject wql = WQLObject.getWQLObject("sys_code_rule");
|
WQLObject wql = WQLObject.getWQLObject("sys_code_rule");
|
||||||
JSONObject json = new JSONObject();
|
JSONObject json = new JSONObject();
|
||||||
String id = IdUtil.simpleUUID();
|
String id = IdUtil.simpleUUID();
|
||||||
@@ -62,10 +64,12 @@ public class GenCodeServiceImpl implements GenCodeService {
|
|||||||
json.put("id", id);
|
json.put("id", id);
|
||||||
json.put("code", form.get("code"));
|
json.put("code", form.get("code"));
|
||||||
json.put("name", form.get("name"));
|
json.put("name", form.get("name"));
|
||||||
json.put("is_active", "1");
|
json.put("create_id", currentUserId);
|
||||||
json.put("is_delete", "0");
|
json.put("update_optid", currentUserId);
|
||||||
json.put("create_by", SecurityUtils.getCurrentUsername());
|
json.put("create_name", currentUsername);
|
||||||
|
json.put("update_optname", currentUsername);
|
||||||
json.put("create_time", now);
|
json.put("create_time", now);
|
||||||
|
json.put("update_time", now);
|
||||||
WQLObject.getWQLObject("sys_code_rule").insert(json);
|
WQLObject.getWQLObject("sys_code_rule").insert(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,8 +91,9 @@ public class GenCodeServiceImpl implements GenCodeService {
|
|||||||
throw new BadRequestException("该编码code已存在,请校验!");
|
throw new BadRequestException("该编码code已存在,请校验!");
|
||||||
}
|
}
|
||||||
String now = DateUtil.now();
|
String now = DateUtil.now();
|
||||||
|
json.put("update_optid", SecurityUtils.getCurrentUserId());
|
||||||
json.put("update_time", now);
|
json.put("update_time", now);
|
||||||
json.put("update_by", SecurityUtils.getCurrentUsername());
|
json.put("update_optname", SecurityUtils.getCurrentUsername());
|
||||||
WQLObject.getWQLObject("sys_code_rule").update(json);
|
WQLObject.getWQLObject("sys_code_rule").update(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -47,11 +47,14 @@ public class GridFieldServiceImpl implements GridFieldService {
|
|||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void create(GridFieldDto dto) {
|
public void create(GridFieldDto dto) {
|
||||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||||
|
Long uid = SecurityUtils.getCurrentUserId();
|
||||||
String now = DateUtil.now();
|
String now = DateUtil.now();
|
||||||
|
|
||||||
dto.setId(IdUtil.simpleUUID());
|
dto.setId(IdUtil.simpleUUID());
|
||||||
dto.setCreate_by(currentUsername);
|
dto.setCreate_id(uid.toString());
|
||||||
dto.setUpdate_by(currentUsername);
|
dto.setUpdate_optid(uid.toString());
|
||||||
|
dto.setCreate_name(currentUsername);
|
||||||
|
dto.setUpdate_optname(currentUsername);
|
||||||
dto.setUpdate_time(now);
|
dto.setUpdate_time(now);
|
||||||
dto.setCreate_time(now);
|
dto.setCreate_time(now);
|
||||||
|
|
||||||
@@ -77,7 +80,8 @@ public class GridFieldServiceImpl implements GridFieldService {
|
|||||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||||
String now = DateUtil.now();
|
String now = DateUtil.now();
|
||||||
dto.setUpdate_time(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");
|
WQLObject wo = WQLObject.getWQLObject("sys_grid_field");
|
||||||
JSONObject json = JSONObject.parseObject( JSONObject.toJSONString(dto));
|
JSONObject json = JSONObject.parseObject( JSONObject.toJSONString(dto));
|
||||||
@@ -89,10 +93,11 @@ public class GridFieldServiceImpl implements GridFieldService {
|
|||||||
public void deleteAll(String[] ids) {
|
public void deleteAll(String[] ids) {
|
||||||
WQLObject wo = WQLObject.getWQLObject("sys_grid_field");
|
WQLObject wo = WQLObject.getWQLObject("sys_grid_field");
|
||||||
for (String id : ids) {
|
for (String id : ids) {
|
||||||
GridFieldDto gridFieldDto = this.findById(id);
|
// GridFieldDto gridFieldDto = this.findById(id);
|
||||||
gridFieldDto.setIs_delete("1");
|
// gridFieldDto.setIs_delete("1");
|
||||||
JSONObject json = JSONObject.parseObject( JSONObject.toJSONString(gridFieldDto));
|
// JSONObject json = JSONObject.parseObject( JSONObject.toJSONString(gridFieldDto));
|
||||||
wo.update(json);
|
// wo.update(json);
|
||||||
|
wo.delete("grid_id = '" + id + "'");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -103,6 +108,7 @@ public class GridFieldServiceImpl implements GridFieldService {
|
|||||||
JSONArray fieldDatas = json.getJSONArray("gridFieldData");
|
JSONArray fieldDatas = json.getJSONArray("gridFieldData");
|
||||||
WQLObject wo = WQLObject.getWQLObject("sys_grid_field");
|
WQLObject wo = WQLObject.getWQLObject("sys_grid_field");
|
||||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||||
|
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||||
// 先删除原先所有的数据
|
// 先删除原先所有的数据
|
||||||
wo.delete("grid_id = '" + grid_id + "'");
|
wo.delete("grid_id = '" + grid_id + "'");
|
||||||
// 然后添加
|
// 然后添加
|
||||||
@@ -111,9 +117,11 @@ public class GridFieldServiceImpl implements GridFieldService {
|
|||||||
JSONObject fieldData = fieldDatas.getJSONObject(i);
|
JSONObject fieldData = fieldDatas.getJSONObject(i);
|
||||||
fieldData.put("grid_id", grid_id);
|
fieldData.put("grid_id", grid_id);
|
||||||
fieldData.put("id", IdUtil.simpleUUID());
|
fieldData.put("id", IdUtil.simpleUUID());
|
||||||
fieldData.put("create_by", currentUsername);
|
fieldData.put("create_id", currentUserId);
|
||||||
fieldData.put("create_time", currentUsername);
|
fieldData.put("update_optid", currentUserId);
|
||||||
fieldData.put("update_by", now);
|
fieldData.put("create_name", currentUsername);
|
||||||
|
fieldData.put("update_optname", currentUsername);
|
||||||
|
fieldData.put("create_time", now);
|
||||||
fieldData.put("update_time", now);
|
fieldData.put("update_time", now);
|
||||||
wo.insert(fieldData);
|
wo.insert(fieldData);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public class GridServiceImpl implements GridService {
|
|||||||
if (whereJson.get("name") != null) {
|
if (whereJson.get("name") != null) {
|
||||||
where = "name like ('%" + whereJson.get("name") + "%')";
|
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();
|
final JSONObject json = rb.pageResult();
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
@@ -44,11 +44,14 @@ public class GridServiceImpl implements GridService {
|
|||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void create(GridDto dto) {
|
public void create(GridDto dto) {
|
||||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||||
|
Long uid = SecurityUtils.getCurrentUserId();
|
||||||
String now = DateUtil.now();
|
String now = DateUtil.now();
|
||||||
|
|
||||||
dto.setId(IdUtil.simpleUUID());
|
dto.setId(IdUtil.simpleUUID());
|
||||||
dto.setCreate_by(currentUsername);
|
dto.setCreate_id(uid.toString());
|
||||||
dto.setUpdate_by(currentUsername);
|
dto.setUpdate_optid(uid.toString());
|
||||||
|
dto.setCreate_name(currentUsername);
|
||||||
|
dto.setUpdate_optname(currentUsername);
|
||||||
dto.setUpdate_time(now);
|
dto.setUpdate_time(now);
|
||||||
dto.setCreate_time(now);
|
dto.setCreate_time(now);
|
||||||
|
|
||||||
@@ -60,7 +63,7 @@ public class GridServiceImpl implements GridService {
|
|||||||
@Override
|
@Override
|
||||||
public GridDto findById(String id) {
|
public GridDto findById(String id) {
|
||||||
WQLObject wo = WQLObject.getWQLObject("sys_grid");
|
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);;
|
final GridDto obj = json.toJavaObject(GridDto.class);;
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
@@ -73,8 +76,9 @@ public class GridServiceImpl implements GridService {
|
|||||||
|
|
||||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||||
String now = DateUtil.now();
|
String now = DateUtil.now();
|
||||||
|
dto.setUpdate_optid(SecurityUtils.getCurrentUserId().toString());
|
||||||
dto.setUpdate_time(now);
|
dto.setUpdate_time(now);
|
||||||
dto.setUpdate_by(currentUsername);
|
dto.setUpdate_optname(currentUsername);
|
||||||
|
|
||||||
WQLObject wo = WQLObject.getWQLObject("sys_grid");
|
WQLObject wo = WQLObject.getWQLObject("sys_grid");
|
||||||
JSONObject json = JSONObject.parseObject( JSONObject.toJSONString(dto));
|
JSONObject json = JSONObject.parseObject( JSONObject.toJSONString(dto));
|
||||||
@@ -95,7 +99,7 @@ public class GridServiceImpl implements GridService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JSONArray getGridList() {
|
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();
|
JSONArray result = new JSONArray();
|
||||||
for (int i = 0; i < arr.size(); i++) {
|
for (int i = 0; i < arr.size(); i++) {
|
||||||
JSONObject obj = arr.getJSONObject(i);
|
JSONObject obj = arr.getJSONObject(i);
|
||||||
|
|||||||
Binary file not shown.
@@ -49,7 +49,7 @@
|
|||||||
<span v-else>是</span>
|
<span v-else>是</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="create_by" label="创建者" />
|
<el-table-column prop="create_name" label="创建者" />
|
||||||
<el-table-column v-permission="['admin','grid:edit','grid:del']" label="操作" width="150px" align="center">
|
<el-table-column v-permission="['admin','grid:edit','grid:del']" label="操作" width="150px" align="center">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<udOperation
|
<udOperation
|
||||||
@@ -119,7 +119,7 @@
|
|||||||
{ required: true, message: '编码不能为空!', trigger: 'blur' }
|
{ required: true, message: '编码不能为空!', trigger: 'blur' }
|
||||||
]"
|
]"
|
||||||
>
|
>
|
||||||
<el-input v-model="scope.row.code" />
|
<el-input v-model="scope.row.code" style="text-align: center" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
@@ -212,11 +212,9 @@ const defaultForm = {
|
|||||||
code: null,
|
code: null,
|
||||||
name: null,
|
name: null,
|
||||||
remark: null,
|
remark: null,
|
||||||
is_active: 1,
|
create_name: null,
|
||||||
is_delete: 0,
|
|
||||||
create_by: null,
|
|
||||||
create_time: null,
|
create_time: null,
|
||||||
update_by: null,
|
update_optname: null,
|
||||||
update_time: null
|
update_time: null
|
||||||
}
|
}
|
||||||
export default {
|
export default {
|
||||||
@@ -273,11 +271,9 @@ export default {
|
|||||||
sort_num: null,
|
sort_num: null,
|
||||||
remark: null,
|
remark: null,
|
||||||
is_hidden: 0,
|
is_hidden: 0,
|
||||||
is_active: 1,
|
create_name: null,
|
||||||
is_delete: 0,
|
|
||||||
create_by: null,
|
|
||||||
create_time: null,
|
create_time: null,
|
||||||
update_by: null,
|
update_optname: null,
|
||||||
update_time: null,
|
update_time: null,
|
||||||
grid_id: null
|
grid_id: null
|
||||||
}
|
}
|
||||||
@@ -310,11 +306,9 @@ export default {
|
|||||||
sort_num: null,
|
sort_num: null,
|
||||||
remark: null,
|
remark: null,
|
||||||
is_hidden: 0,
|
is_hidden: 0,
|
||||||
is_active: 1,
|
create_name: null,
|
||||||
is_delete: 0,
|
|
||||||
create_by: null,
|
|
||||||
create_time: null,
|
create_time: null,
|
||||||
update_by: null,
|
update_optname: null,
|
||||||
update_time: null,
|
update_time: null,
|
||||||
grid_id: null
|
grid_id: null
|
||||||
}
|
}
|
||||||
@@ -348,11 +342,9 @@ export default {
|
|||||||
sort_num: null,
|
sort_num: null,
|
||||||
remark: null,
|
remark: null,
|
||||||
is_hidden: 0,
|
is_hidden: 0,
|
||||||
is_active: 1,
|
create_name: null,
|
||||||
is_delete: 0,
|
|
||||||
create_by: null,
|
|
||||||
create_time: null,
|
create_time: null,
|
||||||
update_by: null,
|
update_optname: null,
|
||||||
update_time: null,
|
update_time: null,
|
||||||
grid_id: null
|
grid_id: null
|
||||||
}
|
}
|
||||||
@@ -389,7 +381,7 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.el-form-item--small.el-form-item {
|
.el-form-item--mini.el-form-item {
|
||||||
margin-bottom: 0 !important;
|
margin: 5px !important;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -46,7 +46,7 @@
|
|||||||
:align="item.align"
|
:align="item.align"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<el-table-column label="操作" min-width="30" align="center">
|
<el-table-column label="操作" align="center">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button size="mini" type="danger" icon="el-icon-minus" @click="del(scope.row)" />
|
<el-button size="mini" type="danger" icon="el-icon-minus" @click="del(scope.row)" />
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
Reference in New Issue
Block a user