表格列表、编码生成完善
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.
@@ -49,7 +49,7 @@
|
||||
<span v-else>是</span>
|
||||
</template>
|
||||
</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">
|
||||
<template slot-scope="scope">
|
||||
<udOperation
|
||||
@@ -119,7 +119,7 @@
|
||||
{ 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>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -212,11 +212,9 @@ const defaultForm = {
|
||||
code: null,
|
||||
name: null,
|
||||
remark: null,
|
||||
is_active: 1,
|
||||
is_delete: 0,
|
||||
create_by: null,
|
||||
create_name: null,
|
||||
create_time: null,
|
||||
update_by: null,
|
||||
update_optname: null,
|
||||
update_time: null
|
||||
}
|
||||
export default {
|
||||
@@ -273,11 +271,9 @@ export default {
|
||||
sort_num: null,
|
||||
remark: null,
|
||||
is_hidden: 0,
|
||||
is_active: 1,
|
||||
is_delete: 0,
|
||||
create_by: null,
|
||||
create_name: null,
|
||||
create_time: null,
|
||||
update_by: null,
|
||||
update_optname: null,
|
||||
update_time: null,
|
||||
grid_id: null
|
||||
}
|
||||
@@ -310,11 +306,9 @@ export default {
|
||||
sort_num: null,
|
||||
remark: null,
|
||||
is_hidden: 0,
|
||||
is_active: 1,
|
||||
is_delete: 0,
|
||||
create_by: null,
|
||||
create_name: null,
|
||||
create_time: null,
|
||||
update_by: null,
|
||||
update_optname: null,
|
||||
update_time: null,
|
||||
grid_id: null
|
||||
}
|
||||
@@ -348,11 +342,9 @@ export default {
|
||||
sort_num: null,
|
||||
remark: null,
|
||||
is_hidden: 0,
|
||||
is_active: 1,
|
||||
is_delete: 0,
|
||||
create_by: null,
|
||||
create_name: null,
|
||||
create_time: null,
|
||||
update_by: null,
|
||||
update_optname: null,
|
||||
update_time: null,
|
||||
grid_id: null
|
||||
}
|
||||
@@ -389,7 +381,7 @@ export default {
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.el-form-item--small.el-form-item {
|
||||
margin-bottom: 0 !important;
|
||||
.el-form-item--mini.el-form-item {
|
||||
margin: 5px !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
:align="item.align"
|
||||
/>
|
||||
</div>
|
||||
<el-table-column label="操作" min-width="30" align="center">
|
||||
<el-table-column label="操作" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" type="danger" icon="el-icon-minus" @click="del(scope.row)" />
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user