diff --git a/ant-design-vue-jeecg/src/views/functiontemple/FunctionTemplateList.vue b/ant-design-vue-jeecg/src/views/functiontemple/FunctionTemplateList.vue new file mode 100644 index 0000000..c81cb85 --- /dev/null +++ b/ant-design-vue-jeecg/src/views/functiontemple/FunctionTemplateList.vue @@ -0,0 +1,343 @@ + + + + \ No newline at end of file diff --git a/ant-design-vue-jeecg/src/views/functiontemple/modules/FunctionTemplateForm.vue b/ant-design-vue-jeecg/src/views/functiontemple/modules/FunctionTemplateForm.vue new file mode 100644 index 0000000..e36ccc3 --- /dev/null +++ b/ant-design-vue-jeecg/src/views/functiontemple/modules/FunctionTemplateForm.vue @@ -0,0 +1,223 @@ + + + \ No newline at end of file diff --git a/ant-design-vue-jeecg/src/views/functiontemple/modules/FunctionTemplateModal.vue b/ant-design-vue-jeecg/src/views/functiontemple/modules/FunctionTemplateModal.vue new file mode 100644 index 0000000..09bbc0a --- /dev/null +++ b/ant-design-vue-jeecg/src/views/functiontemple/modules/FunctionTemplateModal.vue @@ -0,0 +1,60 @@ + + + \ No newline at end of file diff --git a/ant-design-vue-jeecg/src/views/functiontemple/modules/FunctionTemplateModal__Style#Drawer.vue b/ant-design-vue-jeecg/src/views/functiontemple/modules/FunctionTemplateModal__Style#Drawer.vue new file mode 100644 index 0000000..ea586e6 --- /dev/null +++ b/ant-design-vue-jeecg/src/views/functiontemple/modules/FunctionTemplateModal__Style#Drawer.vue @@ -0,0 +1,84 @@ + + + + + \ No newline at end of file diff --git a/ant-design-vue-jeecg/src/views/moduletype/ModuleTypeList.vue b/ant-design-vue-jeecg/src/views/moduletype/ModuleTypeList.vue new file mode 100644 index 0000000..1eabebb --- /dev/null +++ b/ant-design-vue-jeecg/src/views/moduletype/ModuleTypeList.vue @@ -0,0 +1,238 @@ + + + + \ No newline at end of file diff --git a/ant-design-vue-jeecg/src/views/moduletype/modules/ModuleTypeForm.vue b/ant-design-vue-jeecg/src/views/moduletype/modules/ModuleTypeForm.vue new file mode 100644 index 0000000..0195072 --- /dev/null +++ b/ant-design-vue-jeecg/src/views/moduletype/modules/ModuleTypeForm.vue @@ -0,0 +1,120 @@ + + + \ No newline at end of file diff --git a/ant-design-vue-jeecg/src/views/moduletype/modules/ModuleTypeModal.vue b/ant-design-vue-jeecg/src/views/moduletype/modules/ModuleTypeModal.vue new file mode 100644 index 0000000..85844e1 --- /dev/null +++ b/ant-design-vue-jeecg/src/views/moduletype/modules/ModuleTypeModal.vue @@ -0,0 +1,60 @@ + + + \ No newline at end of file diff --git a/ant-design-vue-jeecg/src/views/moduletype/modules/ModuleTypeModal__Style#Drawer.vue b/ant-design-vue-jeecg/src/views/moduletype/modules/ModuleTypeModal__Style#Drawer.vue new file mode 100644 index 0000000..5a72fe6 --- /dev/null +++ b/ant-design-vue-jeecg/src/views/moduletype/modules/ModuleTypeModal__Style#Drawer.vue @@ -0,0 +1,84 @@ + + + + + \ No newline at end of file diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/functiontemplate/controller/FunctionTemplateController.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/functiontemplate/controller/FunctionTemplateController.java new file mode 100644 index 0000000..38e00b1 --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/functiontemplate/controller/FunctionTemplateController.java @@ -0,0 +1,190 @@ +package org.jeecg.modules.demo.functiontemplate.controller; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.shiro.SecurityUtils; +import org.jeecg.common.api.vo.Result; +import org.jeecg.common.system.query.QueryGenerator; +import org.jeecg.common.system.vo.LoginUser; +import org.jeecg.common.util.oConvertUtils; +import org.jeecg.modules.demo.functiontemplate.entity.FunctionTemplate; +import org.jeecg.modules.demo.functiontemplate.service.IFunctionTemplateService; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import lombok.extern.slf4j.Slf4j; + +import org.jeecgframework.poi.excel.ExcelImportUtil; +import org.jeecgframework.poi.excel.def.NormalExcelConstants; +import org.jeecgframework.poi.excel.entity.ExportParams; +import org.jeecgframework.poi.excel.entity.ImportParams; +import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; +import org.jeecg.common.system.base.controller.JeecgController; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import org.springframework.web.servlet.ModelAndView; +import com.alibaba.fastjson.JSON; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.jeecg.common.aspect.annotation.AutoLog; + + /** + * @Description: 功能模板管理 + * @Author: jeecg-boot + * @Date: 2023-05-08 + * @Version: V1.0 + */ +@Api(tags="功能模板管理") +@RestController +@RequestMapping("/functiontemplate/functionTemplate") +@Slf4j +public class FunctionTemplateController extends JeecgController { + @Autowired + private IFunctionTemplateService functionTemplateService; + + /** + * 分页列表查询 + * + * @param functionTemplate + * @param pageNo + * @param pageSize + * @param req + * @return + */ + @AutoLog(value = "功能模板管理-分页列表查询") + @ApiOperation(value="功能模板管理-分页列表查询", notes="功能模板管理-分页列表查询") + @GetMapping(value = "/list") + public Result queryPageList(FunctionTemplate functionTemplate, + @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, + HttpServletRequest req) { +// QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(functionTemplate, req.getParameterMap()); + QueryWrapper queryWrapper=new QueryWrapper<>(); + queryWrapper.eq("modulextype_id",functionTemplate.getModulextypeId()); + if(functionTemplate.getFunctionTemplateName()!=null){ + queryWrapper.like("function_template_name",functionTemplate.getFunctionTemplateName()); + } + if(functionTemplate.getFunctionTemplateEnName()!=null){ + queryWrapper.like("function_template_en_name",functionTemplate.getFunctionTemplateEnName()); + } + if(functionTemplate.getWorkStatus()!=null){ + queryWrapper.eq("work_status",functionTemplate.getWorkStatus()); + } + if(functionTemplate.getFunctionTemplateType()!=null){ + queryWrapper.eq("function_template_type",functionTemplate.getFunctionTemplateType()); + } + Page page = new Page(pageNo, pageSize); + IPage pageList = functionTemplateService.page(page, queryWrapper); + return Result.OK(pageList); + } + + /** + * 添加 + * + * @param functionTemplate + * @return + */ + @AutoLog(value = "功能模板管理-添加") + @ApiOperation(value="功能模板管理-添加", notes="功能模板管理-添加") + @PostMapping(value = "/add") + public Result add(@RequestBody FunctionTemplate functionTemplate) { + LoginUser loginUser=(LoginUser) SecurityUtils.getSubject().getPrincipal(); + functionTemplate.setCreateBy(loginUser.getId()); + functionTemplateService.save(functionTemplate); + return Result.OK("添加成功!"); + } + + /** + * 编辑 + * + * @param functionTemplate + * @return + */ + @AutoLog(value = "功能模板管理-编辑") + @ApiOperation(value="功能模板管理-编辑", notes="功能模板管理-编辑") + @PutMapping(value = "/edit") + public Result edit(@RequestBody FunctionTemplate functionTemplate) { + functionTemplateService.updateById(functionTemplate); + return Result.OK("编辑成功!"); + } + + /** + * 通过id删除 + * + * @param id + * @return + */ + @AutoLog(value = "功能模板管理-通过id删除") + @ApiOperation(value="功能模板管理-通过id删除", notes="功能模板管理-通过id删除") + @DeleteMapping(value = "/delete") + public Result delete(@RequestParam(name="id",required=true) String id) { + functionTemplateService.removeById(id); + return Result.OK("删除成功!"); + } + + /** + * 批量删除 + * + * @param ids + * @return + */ + @AutoLog(value = "功能模板管理-批量删除") + @ApiOperation(value="功能模板管理-批量删除", notes="功能模板管理-批量删除") + @DeleteMapping(value = "/deleteBatch") + public Result deleteBatch(@RequestParam(name="ids",required=true) String ids) { + this.functionTemplateService.removeByIds(Arrays.asList(ids.split(","))); + return Result.OK("批量删除成功!"); + } + + /** + * 通过id查询 + * + * @param id + * @return + */ + @AutoLog(value = "功能模板管理-通过id查询") + @ApiOperation(value="功能模板管理-通过id查询", notes="功能模板管理-通过id查询") + @GetMapping(value = "/queryById") + public Result queryById(@RequestParam(name="id",required=true) String id) { + FunctionTemplate functionTemplate = functionTemplateService.getById(id); + if(functionTemplate==null) { + return Result.error("未找到对应数据"); + } + return Result.OK(functionTemplate); + } + + /** + * 导出excel + * + * @param request + * @param functionTemplate + */ + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, FunctionTemplate functionTemplate) { + return super.exportXls(request, functionTemplate, FunctionTemplate.class, "功能模板管理"); + } + + /** + * 通过excel导入数据 + * + * @param request + * @param response + * @return + */ + @RequestMapping(value = "/importExcel", method = RequestMethod.POST) + public Result importExcel(HttpServletRequest request, HttpServletResponse response) { + return super.importExcel(request, response, FunctionTemplate.class); + } + +} diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/functiontemplate/entity/FunctionTemplate.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/functiontemplate/entity/FunctionTemplate.java new file mode 100644 index 0000000..2540cff --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/functiontemplate/entity/FunctionTemplate.java @@ -0,0 +1,121 @@ +package org.jeecg.modules.demo.functiontemplate.entity; + +import java.io.Serializable; +import java.io.UnsupportedEncodingException; +import java.util.Date; +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.springframework.format.annotation.DateTimeFormat; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.jeecg.common.aspect.annotation.Dict; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + * @Description: 功能模板管理 + * @Author: jeecg-boot + * @Date: 2023-05-08 + * @Version: V1.0 + */ +@Data +@TableName("function_template") +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +@ApiModel(value="function_template对象", description="功能模板管理") +public class FunctionTemplate implements Serializable { + private static final long serialVersionUID = 1L; + + /**主键*/ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "主键") + private java.lang.String id; + /**创建人*/ + @ApiModelProperty(value = "创建人") + @Dict(dictTable = "sys_user",dicCode = "id",dicText = "realname") + private java.lang.String createBy; + /**创建日期*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "创建日期") + private java.util.Date createTime; + /**更新人*/ + @ApiModelProperty(value = "更新人") + private java.lang.String updateBy; + /**更新日期*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "更新日期") + private java.util.Date updateTime; + /**模块模板类型id*/ + @Excel(name = "模块模板类型id", width = 15) + @ApiModelProperty(value = "模块模板类型id") + @Dict(dictTable = "module_type",dicCode = "id",dicText = "modulextype_name") + private java.lang.String modulextypeId; + /**中文名称*/ + @Excel(name = "中文名称", width = 15) + @ApiModelProperty(value = "中文名称") + private java.lang.String functionTemplateName; + /**英文名称*/ + @Excel(name = "英文名称", width = 15) + @ApiModelProperty(value = "英文名称") + private java.lang.String functionTemplateEnName; + /**功能编码*/ + @Excel(name = "功能编码", width = 15) + @ApiModelProperty(value = "功能编码") + private java.lang.String functionTemplateCode; + /**功能类型*/ + @Excel(name = "功能类型", width = 15) + @ApiModelProperty(value = "功能类型") + @Dict(dicCode = "function_type") + private java.lang.Integer functionTemplateType; + /**功能描述*/ + @Excel(name = "功能描述", width = 15) + @ApiModelProperty(value = "功能描述") + private java.lang.String functionTemplateDescribe; + /**分析图*/ + @Excel(name = "分析图", width = 15) + @ApiModelProperty(value = "分析图") + private java.lang.String diagrams; + /**用户角色*/ + @Excel(name = "用户角色", width = 15, dictTable = "sys_user", dicText = "realname", dicCode = "username") + @Dict(dictTable = "sys_user", dicText = "realname", dicCode = "username") + @ApiModelProperty(value = "用户角色") + private java.lang.String userRole; + /**责任人*/ + @Excel(name = "责任人", width = 15, dictTable = "sys_user", dicText = "realname", dicCode = "username") + @Dict(dictTable = "sys_user", dicText = "realname", dicCode = "username") + @ApiModelProperty(value = "责任人") + private java.lang.String managerUsers; + /**任务等级*/ + @Excel(name = "任务等级", width = 15) + @ApiModelProperty(value = "任务等级") + @Dict(dicCode = "work_level") + private java.lang.Integer workLevel; + /**任务状态*/ + @Excel(name = "任务状态", width = 15) + @ApiModelProperty(value = "任务状态") + @Dict(dicCode = "work_status") + private java.lang.Integer workStatus; + /**发布时间*/ + @Excel(name = "发布时间", width = 20, format = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "发布时间") + private java.util.Date publishTime; + /**开始时间*/ + @Excel(name = "开始时间", width = 15, format = "yyyy-MM-dd") + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern="yyyy-MM-dd") + @ApiModelProperty(value = "开始时间") + private java.util.Date startTime; + /**任务时长*/ + @Excel(name = "任务时长", width = 15) + @ApiModelProperty(value = "任务时长") + private java.lang.Double duration; +} diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/functiontemplate/mapper/FunctionTemplateMapper.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/functiontemplate/mapper/FunctionTemplateMapper.java new file mode 100644 index 0000000..6112d49 --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/functiontemplate/mapper/FunctionTemplateMapper.java @@ -0,0 +1,17 @@ +package org.jeecg.modules.demo.functiontemplate.mapper; + +import java.util.List; + +import org.apache.ibatis.annotations.Param; +import org.jeecg.modules.demo.functiontemplate.entity.FunctionTemplate; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + * @Description: 功能模板管理 + * @Author: jeecg-boot + * @Date: 2023-05-08 + * @Version: V1.0 + */ +public interface FunctionTemplateMapper extends BaseMapper { + +} diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/functiontemplate/mapper/xml/FunctionTemplateMapper.xml b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/functiontemplate/mapper/xml/FunctionTemplateMapper.xml new file mode 100644 index 0000000..e24ffc4 --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/functiontemplate/mapper/xml/FunctionTemplateMapper.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/functiontemplate/service/IFunctionTemplateService.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/functiontemplate/service/IFunctionTemplateService.java new file mode 100644 index 0000000..b857b8c --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/functiontemplate/service/IFunctionTemplateService.java @@ -0,0 +1,14 @@ +package org.jeecg.modules.demo.functiontemplate.service; + +import org.jeecg.modules.demo.functiontemplate.entity.FunctionTemplate; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + * @Description: 功能模板管理 + * @Author: jeecg-boot + * @Date: 2023-05-08 + * @Version: V1.0 + */ +public interface IFunctionTemplateService extends IService { + +} diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/functiontemplate/service/impl/FunctionTemplateServiceImpl.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/functiontemplate/service/impl/FunctionTemplateServiceImpl.java new file mode 100644 index 0000000..8c91a91 --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/functiontemplate/service/impl/FunctionTemplateServiceImpl.java @@ -0,0 +1,19 @@ +package org.jeecg.modules.demo.functiontemplate.service.impl; + +import org.jeecg.modules.demo.functiontemplate.entity.FunctionTemplate; +import org.jeecg.modules.demo.functiontemplate.mapper.FunctionTemplateMapper; +import org.jeecg.modules.demo.functiontemplate.service.IFunctionTemplateService; +import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; + +/** + * @Description: 功能模板管理 + * @Author: jeecg-boot + * @Date: 2023-05-08 + * @Version: V1.0 + */ +@Service +public class FunctionTemplateServiceImpl extends ServiceImpl implements IFunctionTemplateService { + +} diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/moduletype/controller/ModuleTypeController.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/moduletype/controller/ModuleTypeController.java new file mode 100644 index 0000000..c180251 --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/moduletype/controller/ModuleTypeController.java @@ -0,0 +1,236 @@ +package org.jeecg.modules.demo.moduletype.controller; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.shiro.SecurityUtils; +import org.jeecg.common.api.vo.Result; +import org.jeecg.common.system.query.QueryGenerator; +import org.jeecg.common.system.vo.LoginUser; +import org.jeecg.common.util.oConvertUtils; +import org.jeecg.modules.demo.moduletype.entity.ModuleType; +import org.jeecg.modules.demo.moduletype.service.IModuleTypeService; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import lombok.extern.slf4j.Slf4j; + +import org.jeecgframework.poi.excel.ExcelImportUtil; +import org.jeecgframework.poi.excel.def.NormalExcelConstants; +import org.jeecgframework.poi.excel.entity.ExportParams; +import org.jeecgframework.poi.excel.entity.ImportParams; +import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; +import org.jeecg.common.system.base.controller.JeecgController; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import org.springframework.web.servlet.ModelAndView; +import com.alibaba.fastjson.JSON; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.jeecg.common.aspect.annotation.AutoLog; + + /** + * @Description: 模块模板类型 + * @Author: jeecg-boot + * @Date: 2023-05-08 + * @Version: V1.0 + */ +@Api(tags="模块模板类型") +@RestController +@RequestMapping("/moduletype/moduleType") +@Slf4j +public class ModuleTypeController extends JeecgController { + @Autowired + private IModuleTypeService moduleTypeService; + + /** + * 分页列表查询 + * + * @param moduleType + * @param pageNo + * @param pageSize + * @param req + * @return + */ + @AutoLog(value = "模块模板类型-分页列表查询") + @ApiOperation(value="模块模板类型-分页列表查询", notes="模块模板类型-分页列表查询") + @GetMapping(value = "/list") + public Result queryPageList(ModuleType moduleType, + @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, + HttpServletRequest req) { + //QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(moduleType, req.getParameterMap()); + QueryWrapper queryWrapper=new QueryWrapper<>(); + queryWrapper.orderByAsc("modulextype_order"); + if(moduleType.getModulextypeName()!=null&&moduleType.getModulextypeName().length()>0){ + queryWrapper.like("modulextype_name",moduleType.getModulextypeName()); + } + if(moduleType.getModulextypeStatus()!=null){ + queryWrapper.eq("modulextype_status",moduleType.getModulextypeStatus()); + } + Page page = new Page(pageNo, pageSize); + IPage pageList = moduleTypeService.page(page, queryWrapper); + return Result.OK(pageList); + } + + /** + * 添加 + * + * @param moduleType + * @return + */ + @AutoLog(value = "模块模板类型-添加") + @ApiOperation(value="模块模板类型-添加", notes="模块模板类型-添加") + @PostMapping(value = "/add") + public Result add(@RequestBody ModuleType moduleType) { + //添加用户id + LoginUser principal = (LoginUser)SecurityUtils.getSubject().getPrincipal(); + moduleType.setCreateBy(principal.getId()); + //设置排序 + Integer sort=moduleTypeService.getLastOne(); + if(sort==null){ + moduleType.setModulextypeOrder(1); + }else{ + moduleType.setModulextypeOrder(sort+1); + } + moduleTypeService.save(moduleType); + return Result.OK("添加成功!"); + } + + /** + * 编辑 + * + * @param moduleType + * @return + */ + @AutoLog(value = "模块模板类型-编辑") + @ApiOperation(value="模块模板类型-编辑", notes="模块模板类型-编辑") + @PutMapping(value = "/edit") + public Result edit(@RequestBody ModuleType moduleType) { + moduleTypeService.updateById(moduleType); + return Result.OK("编辑成功!"); + } + + /** + * 通过id删除 + * + * @param id + * @return + */ + @AutoLog(value = "模块模板类型-通过id删除") + @ApiOperation(value="模块模板类型-通过id删除", notes="模块模板类型-通过id删除") + @DeleteMapping(value = "/delete") + public Result delete(@RequestParam(name="id",required=true) String id) { + Integer sort=moduleTypeService.getLastOne(); + if(sort==null){ + return Result.error("数据异常!!!"); + } + ModuleType byId = moduleTypeService.getById(id); + if(byId.getModulextypeOrder()!=sort){ + return Result.error("请迁移至最后一个再进行删除!!!"); + } + moduleTypeService.removeById(id); + return Result.OK("删除成功!"); + } + + /** + * 批量删除 + * + * @param ids + * @return + */ + @AutoLog(value = "模块模板类型-批量删除") + @ApiOperation(value="模块模板类型-批量删除", notes="模块模板类型-批量删除") + @DeleteMapping(value = "/deleteBatch") + public Result deleteBatch(@RequestParam(name="ids",required=true) String ids) { + this.moduleTypeService.removeByIds(Arrays.asList(ids.split(","))); + return Result.OK("批量删除成功!"); + } + + /** + * 通过id查询 + * + * @param id + * @return + */ + @AutoLog(value = "模块模板类型-通过id查询") + @ApiOperation(value="模块模板类型-通过id查询", notes="模块模板类型-通过id查询") + @GetMapping(value = "/queryById") + public Result queryById(@RequestParam(name="id",required=true) String id) { + ModuleType moduleType = moduleTypeService.getById(id); + if(moduleType==null) { + return Result.error("未找到对应数据"); + } + return Result.OK(moduleType); + } + + /** + * 导出excel + * + * @param request + * @param moduleType + */ + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, ModuleType moduleType) { + return super.exportXls(request, moduleType, ModuleType.class, "模块模板类型"); + } + + /** + * 通过excel导入数据 + * + * @param request + * @param response + * @return + */ + @RequestMapping(value = "/importExcel", method = RequestMethod.POST) + public Result importExcel(HttpServletRequest request, HttpServletResponse response) { + return super.importExcel(request, response, ModuleType.class); + } + + @GetMapping(value = "/qian") + public Result qian(@RequestParam(name="id",required=true) String id) { + ModuleType moduleType = moduleTypeService.getById(id); + //先找到当前这个id对应的sort,获取它的前一个,进行一下交换即可 + List list=moduleTypeService.selectQTwo(moduleType.getModulextypeOrder()); + if(list==null||list.size()<=1){ + return Result.error("当前已是第一条,无法前移!!"); + } + ModuleType moduleType1=list.get(1); + int a=moduleType1.getModulextypeOrder(); + moduleType1.setModulextypeOrder(list.get(0).getModulextypeOrder()); + moduleTypeService.saveOrUpdate(moduleType1); + moduleType.setModulextypeOrder(a); + moduleTypeService.saveOrUpdate(moduleType); + //理论上只用查询排序小于的第一条就够了,查多了一条,无所谓。 + return Result.OK("前移成功!!"); + } + @GetMapping(value = "/hou") + public Result hou(@RequestParam(name="id",required=true) String id) { + ModuleType moduleType = moduleTypeService.getById(id); + //先找到当前这个id对应的sort,获取它的前一个,进行一下交换即可 + List list=moduleTypeService.selectHTwo(moduleType.getModulextypeOrder()); + if(list==null||list.size()<=1){ + return Result.error("当前已是最后一条,无法后移!!"); + } + ModuleType moduleType1=list.get(1); + int a=moduleType1.getModulextypeOrder(); + moduleType1.setModulextypeOrder(list.get(0).getModulextypeOrder()); + moduleTypeService.saveOrUpdate(moduleType1); + moduleType.setModulextypeOrder(a); + moduleTypeService.saveOrUpdate(moduleType); + //理论上只用查询排序小于的第一条就够了,查多了一条,无所谓。 + return Result.OK("后移成功!!"); + } + + + } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/moduletype/entity/ModuleType.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/moduletype/entity/ModuleType.java new file mode 100644 index 0000000..0d01009 --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/moduletype/entity/ModuleType.java @@ -0,0 +1,68 @@ +package org.jeecg.modules.demo.moduletype.entity; + +import java.io.Serializable; +import java.io.UnsupportedEncodingException; +import java.util.Date; +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.springframework.format.annotation.DateTimeFormat; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.jeecg.common.aspect.annotation.Dict; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + * @Description: 模块模板类型 + * @Author: jeecg-boot + * @Date: 2023-05-08 + * @Version: V1.0 + */ +@Data +@TableName("module_type") +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +@ApiModel(value="module_type对象", description="模块模板类型") +public class ModuleType implements Serializable { + private static final long serialVersionUID = 1L; + + /**主键*/ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "主键") + private java.lang.String id; + /**创建人*/ + @ApiModelProperty(value = "创建人") + @Dict(dictTable = "sys_user",dicCode = "id",dicText = "realname") + private java.lang.String createBy; + /**创建日期*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "创建日期") + private java.util.Date createTime; + /**更新人*/ + @ApiModelProperty(value = "更新人") + private java.lang.String updateBy; + /**更新日期*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "更新日期") + private java.util.Date updateTime; + /**名称*/ + @Excel(name = "名称", width = 15) + @ApiModelProperty(value = "名称") + private java.lang.String modulextypeName; + /**排序*/ + @Excel(name = "排序", width = 15) + @ApiModelProperty(value = "排序") + private java.lang.Integer modulextypeOrder; + /**模板状态*/ + @Excel(name = "模板状态", width = 15) + @ApiModelProperty(value = "模板状态") + @Dict(dicCode = "modulextype_status") + private java.lang.Integer modulextypeStatus; +} diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/moduletype/mapper/ModuleTypeMapper.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/moduletype/mapper/ModuleTypeMapper.java new file mode 100644 index 0000000..2426422 --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/moduletype/mapper/ModuleTypeMapper.java @@ -0,0 +1,24 @@ +package org.jeecg.modules.demo.moduletype.mapper; + +import java.util.List; + +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; +import org.jeecg.modules.demo.moduletype.entity.ModuleType; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + * @Description: 模块模板类型 + * @Author: jeecg-boot + * @Date: 2023-05-08 + * @Version: V1.0 + */ +public interface ModuleTypeMapper extends BaseMapper { + + @Select("select modulextype_order from module_type order by modulextype_order desc limit 0,1") + Integer getLastOne(); + @Select("SELECT * FROM module_type WHERE modulextype_order<=#{sort} ORDER BY modulextype_order DESC LIMIT 0,2") + List selectQTwo(@Param("sort") Integer sort); + @Select("SELECT * FROM module_type WHERE modulextype_order>=#{sort} ORDER BY modulextype_order LIMIT 0,2") + List selectHTwo(@Param("sort") Integer sort); +} diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/moduletype/mapper/xml/ModuleTypeMapper.xml b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/moduletype/mapper/xml/ModuleTypeMapper.xml new file mode 100644 index 0000000..071efc9 --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/moduletype/mapper/xml/ModuleTypeMapper.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/moduletype/service/IModuleTypeService.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/moduletype/service/IModuleTypeService.java new file mode 100644 index 0000000..c6a0508 --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/moduletype/service/IModuleTypeService.java @@ -0,0 +1,21 @@ +package org.jeecg.modules.demo.moduletype.service; + +import org.jeecg.modules.demo.moduletype.entity.ModuleType; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.List; + +/** + * @Description: 模块模板类型 + * @Author: jeecg-boot + * @Date: 2023-05-08 + * @Version: V1.0 + */ +public interface IModuleTypeService extends IService { + + Integer getLastOne(); + + List selectQTwo(Integer modulextypeOrder); + + List selectHTwo(Integer modulextypeOrder); +} diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/moduletype/service/impl/ModuleTypeServiceImpl.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/moduletype/service/impl/ModuleTypeServiceImpl.java new file mode 100644 index 0000000..c7a2e42 --- /dev/null +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/moduletype/service/impl/ModuleTypeServiceImpl.java @@ -0,0 +1,38 @@ +package org.jeecg.modules.demo.moduletype.service.impl; + + import org.jeecg.modules.demo.moduletype.entity.ModuleType; + import org.jeecg.modules.demo.moduletype.mapper.ModuleTypeMapper; + import org.jeecg.modules.demo.moduletype.service.IModuleTypeService; + import org.springframework.beans.factory.annotation.Autowired; + import org.springframework.stereotype.Service; + + import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; + + import java.util.List; + +/** + * @Description: 模块模板类型 + * @Author: jeecg-boot + * @Date: 2023-05-08 + * @Version: V1.0 + */ +@Service +public class ModuleTypeServiceImpl extends ServiceImpl implements IModuleTypeService { + + @Autowired + ModuleTypeMapper moduleTypeMapper; + @Override + public Integer getLastOne() { + return moduleTypeMapper.getLastOne(); + } + + @Override + public List selectQTwo(Integer modulextypeOrder) { + return moduleTypeMapper.selectQTwo(modulextypeOrder); + } + + @Override + public List selectHTwo(Integer modulextypeOrder) { + return moduleTypeMapper.selectHTwo(modulextypeOrder); + } +} diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/DuplicateCheckController.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/DuplicateCheckController.java index b8a94b3..9100f24 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/DuplicateCheckController.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/DuplicateCheckController.java @@ -48,13 +48,23 @@ public class DuplicateCheckController { final String[] sqlInjCheck = {duplicateCheckVo.getTableName(),duplicateCheckVo.getFieldName()}; SqlInjectionUtil.filterContent(sqlInjCheck); if(duplicateCheckVo.getModuleid()!=null){ + //针对的一个字段,包含这个字符串 + if(duplicateCheckVo.getFieldName().contains("template")){ + if (StringUtils.isNotBlank(duplicateCheckVo.getDataId())) { + // [2].编辑页面校验 + num = sysDictMapper.duplicateCheckCountSql2(duplicateCheckVo); + } else { + // [1].添加页面校验 + num = sysDictMapper.duplicateCheckCountSqlNoDataId2(duplicateCheckVo); + } + }else{ if (StringUtils.isNotBlank(duplicateCheckVo.getDataId())) { // [2].编辑页面校验 num = sysDictMapper.duplicateCheckCountSql1(duplicateCheckVo); } else { // [1].添加页面校验 num = sysDictMapper.duplicateCheckCountSqlNoDataId1(duplicateCheckVo); - } + }} }else{ if (StringUtils.isNotBlank(duplicateCheckVo.getDataId())) { // [2].编辑页面校验 diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/SysDictMapper.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/SysDictMapper.java index adc12c8..4fdeb1b 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/SysDictMapper.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/SysDictMapper.java @@ -162,4 +162,7 @@ public interface SysDictMapper extends BaseMapper { Long duplicateCheckCountSql1(DuplicateCheckVo duplicateCheckVo); Long duplicateCheckCountSqlNoDataId1(DuplicateCheckVo duplicateCheckVo); + Long duplicateCheckCountSql2(DuplicateCheckVo duplicateCheckVo); + + Long duplicateCheckCountSqlNoDataId2(DuplicateCheckVo duplicateCheckVo); } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/xml/SysDictMapper.xml b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/xml/SysDictMapper.xml index bffaa53..27e3680 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/xml/SysDictMapper.xml +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/xml/SysDictMapper.xml @@ -62,6 +62,14 @@ + + + +