EventTemplate控制器编写
This commit is contained in:
@@ -8,6 +8,7 @@ import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.common.utils.LogUtil;
|
||||
import com.njcn.system.pojo.param.EventTemplateParam;
|
||||
import com.njcn.system.pojo.po.EventDict;
|
||||
import com.njcn.system.pojo.vo.EventTemplateTree;
|
||||
import com.njcn.system.pojo.vo.EventTemplateVO;
|
||||
import com.njcn.system.service.IEventTemplateService;
|
||||
@@ -58,13 +59,13 @@ public class EventTemplateController extends BaseController{
|
||||
* @date 2022/09/09
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@PostMapping("/list")
|
||||
@PostMapping("/getlist")
|
||||
@ApiOperation("查询字典数据")
|
||||
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
|
||||
public HttpResult<Page<EventTemplateVO>> list(@RequestBody @Validated EventTemplateParam.EventTemplateQueryParam queryParam) {
|
||||
String methodDescribe = getMethodDescribe("list");
|
||||
public HttpResult<Page<EventDict>> getlist(@RequestBody @Validated EventTemplateParam.EventTemplateQueryParam queryParam) {
|
||||
String methodDescribe = getMethodDescribe("getlist");
|
||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, queryParam);
|
||||
Page<EventTemplateVO> result = iEventTemplateService.listEventTemplateData(queryParam);
|
||||
Page<EventDict> result = iEventTemplateService.getlist(queryParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@@ -76,7 +77,7 @@ public class EventTemplateController extends BaseController{
|
||||
@PostMapping("/add")
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@ApiOperation("新增模板")
|
||||
@ApiImplicitParam(name = "dictDataParam", value = "模板数据", required = true)
|
||||
@ApiImplicitParam(name = "eventTemplateParam", value = "模板数据", required = true)
|
||||
public HttpResult<Boolean> add(@RequestBody EventTemplateParam eventTemplateParam){
|
||||
String methodDescribe = getMethodDescribe("add");
|
||||
LogUtil.njcnDebug(log, "{},模板数据为:{}", methodDescribe, eventTemplateParam);
|
||||
@@ -96,11 +97,11 @@ public class EventTemplateController extends BaseController{
|
||||
@PostMapping("/update")
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@ApiOperation("修改字典")
|
||||
@ApiImplicitParam(name = "dictDataUpdateParam", value = "字典表数据", required = true)
|
||||
public HttpResult<Boolean> update(@RequestBody EventTemplateParam.EventTemplateUpdateParam eventTemplateUpdateParam){
|
||||
@ApiImplicitParam(name = "eventDataUpdateParam", value = "字典表数据", required = true)
|
||||
public HttpResult<Boolean> update(@RequestBody EventTemplateParam.EventTemplateUpdateParam eventDataUpdateParam){
|
||||
String methodDescribe = getMethodDescribe("update");
|
||||
LogUtil.njcnDebug(log, "{},字典表数据数据为:{}", methodDescribe, eventTemplateUpdateParam);
|
||||
boolean result = iEventTemplateService.update(eventTemplateUpdateParam);
|
||||
LogUtil.njcnDebug(log, "{},字典表数据数据为:{}", methodDescribe, eventDataUpdateParam);
|
||||
boolean result = iEventTemplateService.update(eventDataUpdateParam);
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
} else {
|
||||
|
||||
@@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.system.pojo.po.EventDict;
|
||||
import com.njcn.system.pojo.vo.DictDataVO;
|
||||
import com.njcn.system.pojo.vo.EventTemplateVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@@ -20,5 +19,5 @@ public interface EventTemplateMapper extends BaseMapper<EventDict> {
|
||||
* @param queryWrapper 查询条件
|
||||
* @return 字典数据
|
||||
*/
|
||||
Page<EventTemplateVO> page(@Param("page")Page<EventTemplateVO> page, @Param("ew")QueryWrapper<EventTemplateVO> queryWrapper);
|
||||
Page<EventDict> page(@Param("page")Page<EventTemplateVO> page, @Param("ew")QueryWrapper<EventTemplateVO> queryWrapper);
|
||||
}
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
|
||||
<!--获取字典分页列表-->
|
||||
<select id="page" resultType="EventTemplateVO">
|
||||
SELECT eventreport_dict.*
|
||||
FROM eventreport_dict eventreport_dict
|
||||
SELECT report_template_dict.*
|
||||
FROM report_template_dict report_template_dict
|
||||
WHERE ${ew.sqlSegment}
|
||||
</select>
|
||||
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
package com.njcn.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.system.pojo.param.DictDataParam;
|
||||
import com.njcn.system.pojo.param.EventTemplateParam;
|
||||
import com.njcn.system.pojo.po.EventDict;
|
||||
import com.njcn.system.pojo.vo.EventTemplateTree;
|
||||
import com.njcn.system.pojo.vo.EventTemplateVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -25,12 +24,12 @@ public interface IEventTemplateService {
|
||||
* @param queryParam 查询参数
|
||||
* @return 字典列表
|
||||
*/
|
||||
Page<EventTemplateVO> listEventTemplateData(EventTemplateParam.EventTemplateQueryParam queryParam);
|
||||
Page<EventDict> getlist(EventTemplateParam.EventTemplateQueryParam queryParam);
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
boolean add(EventTemplateParam eventDataParam);
|
||||
boolean add(EventTemplateParam eventTemplateParam);
|
||||
|
||||
/**
|
||||
* 修改
|
||||
|
||||
@@ -47,27 +47,28 @@ public class EventTemplateServiceImpl extends ServiceImpl<EventTemplateMapper, E
|
||||
* 分页查询字典类型数据
|
||||
* @author hany
|
||||
* @date 2022/09/13
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Page<EventTemplateVO> listEventTemplateData(EventTemplateParam.EventTemplateQueryParam queryParam) {
|
||||
public Page<EventDict> getlist(EventTemplateParam.EventTemplateQueryParam queryParam) {
|
||||
QueryWrapper<EventTemplateVO> queryWrapper = new QueryWrapper<>();
|
||||
if (ObjectUtil.isNotNull(queryParam)) {
|
||||
//查询参数不为空,进行条件填充
|
||||
if (StrUtil.isNotBlank(queryParam.getSearchValue())) {
|
||||
//字典类型表,仅提供名称、编码模糊查询
|
||||
queryWrapper
|
||||
.and(param -> param.like("eventreport_dict.name", queryParam.getSearchValue())
|
||||
.or().like("eventreport_dict.pid", 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())) {
|
||||
queryWrapper.orderBy(true, queryParam.getOrderBy().equals(DbConstant.ASC), StrUtil.toUnderlineCase(queryParam.getSortBy()));
|
||||
} else {
|
||||
//没有排序参数,默认根据sort字段排序,没有排序字段的,根据updateTime更新时间排序
|
||||
queryWrapper.orderBy(true, true, "eventreport_dict.sort");
|
||||
queryWrapper.orderBy(true, true, "report_template_dict.sort");
|
||||
}
|
||||
}
|
||||
queryWrapper.ne("eventreport_dict.state", DataStateEnum.DELETED.getCode());
|
||||
queryWrapper.ne("report_template_dict.state", DataStateEnum.DELETED.getCode());
|
||||
//初始化分页数据
|
||||
return this.baseMapper.page(new Page<>(PageFactory.getPageNum(queryParam), PageFactory.getPageSize(queryParam)), queryWrapper);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user