EventTemplate控制器编写

This commit is contained in:
hanyong
2022-09-16 16:33:06 +08:00
parent 3635403a35
commit 1512674f4c
4 changed files with 11 additions and 28 deletions

View File

@@ -28,6 +28,8 @@ public class EventTemplateParam {
@Pattern(regexp = PatternRegex.DIC_REGEX, message = ValidMessage.PID_FORMAT_ERROR) @Pattern(regexp = PatternRegex.DIC_REGEX, message = ValidMessage.PID_FORMAT_ERROR)
private String pid; private String pid;
@ApiModelProperty("所有父节点")
private String pids;
@ApiModelProperty("排序") @ApiModelProperty("排序")
@NotNull(message = ValidMessage.SORT_NOT_NULL) @NotNull(message = ValidMessage.SORT_NOT_NULL)

View File

@@ -32,23 +32,4 @@ public class EventTemplateTree implements Serializable {
private String pids; private String pids;
/**
* 终端厂家
*/
private String manufacturer;
/**
* 电压等级Id字典表
*/
private String scale;
/**
* 干扰源类型,字典表
*/
private String loadType;
/**
* 接线方式
*/
private Integer ptType;
} }

View File

@@ -70,13 +70,13 @@ public class EventTemplateController extends BaseController{
} }
/** /**
* 新增模板 * 新增
* @author hany * @author hany
* @date 2022/09/09 * @date 2022/09/09
*/ */
@PostMapping("/add") @PostMapping("/add")
@OperateInfo(info = LogEnum.SYSTEM_COMMON) @OperateInfo(info = LogEnum.SYSTEM_COMMON)
@ApiOperation("新增模板") @ApiOperation("新增")
@ApiImplicitParam(name = "eventTemplateParam", value = "模板数据", required = true) @ApiImplicitParam(name = "eventTemplateParam", value = "模板数据", required = true)
public HttpResult<Boolean> add(@RequestBody EventTemplateParam eventTemplateParam){ public HttpResult<Boolean> add(@RequestBody EventTemplateParam eventTemplateParam){
String methodDescribe = getMethodDescribe("add"); String methodDescribe = getMethodDescribe("add");
@@ -98,10 +98,10 @@ public class EventTemplateController extends BaseController{
@OperateInfo(info = LogEnum.SYSTEM_COMMON) @OperateInfo(info = LogEnum.SYSTEM_COMMON)
@ApiOperation("修改字典") @ApiOperation("修改字典")
@ApiImplicitParam(name = "eventDataUpdateParam", value = "字典表数据", required = true) @ApiImplicitParam(name = "eventDataUpdateParam", value = "字典表数据", required = true)
public HttpResult<Boolean> update(@RequestBody EventTemplateParam.EventTemplateUpdateParam eventDataUpdateParam){ public HttpResult<Boolean> update(@RequestBody EventTemplateParam.EventTemplateUpdateParam eventUpdateParam){
String methodDescribe = getMethodDescribe("update"); String methodDescribe = getMethodDescribe("update");
LogUtil.njcnDebug(log, "{},字典表数据数据为:{}", methodDescribe, eventDataUpdateParam); LogUtil.njcnDebug(log, "{},字典表数据数据为:{}", methodDescribe, eventUpdateParam);
boolean result = iEventTemplateService.update(eventDataUpdateParam); boolean result = iEventTemplateService.update(eventUpdateParam);
if (result) { if (result) {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
} else { } else {

View File

@@ -55,17 +55,17 @@ public class EventTemplateServiceImpl extends ServiceImpl<EventTemplateMapper, E
if (ObjectUtil.isNotNull(queryParam)) { if (ObjectUtil.isNotNull(queryParam)) {
//查询参数不为空,进行条件填充 //查询参数不为空,进行条件填充
if (StrUtil.isNotBlank(queryParam.getSearchValue())) { if (StrUtil.isNotBlank(queryParam.getSearchValue())) {
//字典类型表,仅提供名称、编码模糊查询 //字典类型表,仅提供名称模糊查询
queryWrapper queryWrapper
.and(param -> param.like("report_template_dict.name", queryParam.getSearchValue()) .and(param -> param.like("report_template_dict.name", queryParam.getSearchValue()));
.or().like("report_template_dict.pid", queryParam.getSearchValue()));
} }
//排序 //排序
if (ObjectUtil.isAllNotEmpty(queryParam.getSortBy(), queryParam.getOrderBy())) { if (ObjectUtil.isAllNotEmpty(queryParam.getSortBy(), queryParam.getOrderBy())) {
queryWrapper.orderBy(true, queryParam.getOrderBy().equals(DbConstant.ASC), StrUtil.toUnderlineCase(queryParam.getSortBy())); queryWrapper.orderBy(true, queryParam.getOrderBy().equals(DbConstant.ASC), StrUtil.toUnderlineCase(queryParam.getSortBy()));
} else { } else {
queryWrapper.eq("report_template_dict.pid",queryParam.getPid());
//没有排序参数默认根据sort字段排序没有排序字段的根据updateTime更新时间排序 //没有排序参数默认根据sort字段排序没有排序字段的根据updateTime更新时间排序
queryWrapper.orderBy(true, true, "report_template_dict.sort"); queryWrapper.orderBy(true, true, "report_template_dict.update_time");
} }
} }
queryWrapper.ne("report_template_dict.state", DataStateEnum.DELETED.getCode()); queryWrapper.ne("report_template_dict.state", DataStateEnum.DELETED.getCode());