iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/controller/admin/ChartController.java
对比新文件 @@ -0,0 +1,70 @@ package com.iailab.module.model.mpk.controller.admin; import com.iailab.framework.common.page.PageData; import com.iailab.framework.common.pojo.CommonResult; import com.iailab.module.model.mpk.dto.ChartDTO; import com.iailab.module.model.mpk.dto.ChartParamDTO; import com.iailab.module.model.mpk.entity.ChartEntity; import com.iailab.module.model.mpk.entity.ChartParamEntity; import com.iailab.module.model.mpk.service.ChartService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; import java.util.Map; import static com.iailab.framework.common.pojo.CommonResult.success; /** * @description: * @author: dzd * @date: 2024/11/5 11:43 **/ @Tag(name = "图表参数") @RestController @RequestMapping("/model/chart") public class ChartController { @Autowired private ChartService chartService; @GetMapping("page") @Operation(summary = "分页") @PreAuthorize("@ss.hasPermission('model:chart:query')") public CommonResult<PageData<ChartDTO>> page(@RequestParam Map<String, Object> params) { PageData<ChartDTO> page = chartService.page(params); return success(page); } @GetMapping("/get") @Operation(summary = "获得详情") public CommonResult<ChartEntity> get(@RequestParam("id") String id) { ChartEntity data = chartService.get(id); return success(data); } @PostMapping("/create") @Operation(summary = "创建") @PreAuthorize("@ss.hasPermission('model:chart:create')") public CommonResult<Boolean> save(@RequestBody ChartEntity entity) { chartService.create(entity); return success(true); } @PutMapping("/update") @Operation(summary = "更新") @PreAuthorize("@ss.hasPermission('model:chart:update')") public CommonResult<Boolean> update(@RequestBody ChartEntity entity) { chartService.update(entity); return success(true); } @DeleteMapping("/delete") @PreAuthorize("@ss.hasPermission('model:chart:delete')") public CommonResult<Boolean> delete(@RequestParam("id") String id) { chartService.delete(id); return success(true); } } iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/controller/admin/ChartParamController.java
对比新文件 @@ -0,0 +1,71 @@ package com.iailab.module.model.mpk.controller.admin; import com.iailab.framework.common.page.PageData; import com.iailab.framework.common.pojo.CommonResult; import com.iailab.framework.common.pojo.PageResult; import com.iailab.framework.common.util.object.BeanUtils; import com.iailab.module.model.mpk.dto.ChartParamDTO; import com.iailab.module.model.mpk.dto.MpkFileDTO; import com.iailab.module.model.mpk.entity.ChartParamEntity; import com.iailab.module.model.mpk.entity.IconEntity; import com.iailab.module.model.mpk.service.ChartParamService; import com.iailab.module.model.mpk.vo.IconPageReqVO; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; import javax.validation.Valid; import java.util.List; import java.util.Map; import static com.iailab.framework.common.pojo.CommonResult.success; /** * @description: * @author: dzd * @date: 2024/11/5 11:43 **/ @Tag(name = "图表参数") @RestController @RequestMapping("/model/chart/param") public class ChartParamController { @Autowired private ChartParamService chartParamService; @GetMapping("page") @Operation(summary = "分页") public CommonResult<PageData<ChartParamDTO>> page(@RequestParam Map<String, Object> params) { PageData<ChartParamDTO> page = chartParamService.page(params); return success(page); } @GetMapping("/get") @Operation(summary = "获得详情") public CommonResult<ChartParamEntity> get(@RequestParam("id") String id) { ChartParamEntity data = chartParamService.get(id); return success(data); } @PostMapping("/create") @Operation(summary = "创建") public CommonResult<Boolean> save(@RequestBody ChartParamEntity entity) { chartParamService.create(entity); return success(true); } @PutMapping("/update") @Operation(summary = "更新") public CommonResult<Boolean> update(@RequestBody ChartParamEntity entity) { chartParamService.update(entity); return success(true); } @DeleteMapping("/delete") public CommonResult<Boolean> delete(@RequestParam("id") String id) { chartParamService.delete(id); return success(true); } } iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/dao/ChartDao.java
对比新文件 @@ -0,0 +1,17 @@ package com.iailab.module.model.mpk.dao; import com.iailab.framework.common.dao.BaseDao; import com.iailab.framework.tenant.core.db.dynamic.TenantDS; import com.iailab.module.model.mpk.entity.ChartEntity; import org.apache.ibatis.annotations.Mapper; /** * @description: * @author: dzd * @date: 2024/11/5 11:19 **/ @TenantDS @Mapper public interface ChartDao extends BaseDao<ChartEntity> { } iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/dao/ChartParamDao.java
对比新文件 @@ -0,0 +1,17 @@ package com.iailab.module.model.mpk.dao; import com.iailab.framework.common.dao.BaseDao; import com.iailab.framework.tenant.core.db.dynamic.TenantDS; import com.iailab.module.model.mpk.entity.ChartParamEntity; import org.apache.ibatis.annotations.Mapper; /** * @description: * @author: dzd * @date: 2024/11/5 11:19 **/ @TenantDS @Mapper public interface ChartParamDao extends BaseDao<ChartParamEntity> { } iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/dto/ChartDTO.java
对比新文件 @@ -0,0 +1,47 @@ package com.iailab.module.model.mpk.dto; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import java.io.Serializable; import java.util.Date; import java.util.List; /** * @description: 图表参数 * @author: dzd * @date: 2024/11/5 11:17 **/ @Data public class ChartDTO implements Serializable { private static final long serialVersionUID = 1L; /** * id */ @TableId private String id; /** * 图表名称 */ private String chartName; /** * 图表编码 */ private String chartCode; /** * 创建时间 */ private Date createTime; /** * 修改时间 */ private Date updateTime; private List<ChartParamDTO> chartParams; } iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/dto/ChartParamDTO.java
对比新文件 @@ -0,0 +1,56 @@ package com.iailab.module.model.mpk.dto; import lombok.Data; import java.io.Serializable; import java.util.Date; /** * @description: 图表参数 * @author: dzd * @date: 2024/11/5 11:17 **/ @Data public class ChartParamDTO implements Serializable { private static final long serialVersionUID = 1L; /** * id */ private String id; /** * 图表id */ private String chartId; /** * 参数名称 */ private String paramName; /** * 参数编码 */ private String paramCode; /** * 参数值 */ private String paramValue; /** * 备注 */ private String remark; /** * 创建时间 */ private Date createTime; /** * 修改时间 */ private Date updateTime; } iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/entity/ChartEntity.java
对比新文件 @@ -0,0 +1,45 @@ package com.iailab.module.model.mpk.entity; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import java.io.Serializable; import java.util.Date; /** * @description: 图表参数 * @author: dzd * @date: 2024/11/5 11:17 **/ @Data @TableName("t_chart") public class ChartEntity implements Serializable { private static final long serialVersionUID = 1L; /** * id */ @TableId private String id; /** * 图表名称 */ private String chartName; /** * 图表编码 */ private String chartCode; /** * 创建时间 */ private Date createTime; /** * 修改时间 */ private Date updateTime; } iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/entity/ChartParamEntity.java
对比新文件 @@ -0,0 +1,60 @@ package com.iailab.module.model.mpk.entity; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import java.io.Serializable; import java.util.Date; /** * @description: 图表参数 * @author: dzd * @date: 2024/11/5 11:17 **/ @Data @TableName("t_chart_param") public class ChartParamEntity implements Serializable { private static final long serialVersionUID = 1L; /** * id */ @TableId private String id; /** * 图表id */ private String chartId; /** * 参数名称 */ private String paramName; /** * 参数编码 */ private String paramCode; /** * 参数值 */ private String paramValue; /** * 备注 */ private String remark; /** * 创建时间 */ private Date createTime; /** * 修改时间 */ private Date updateTime; } iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/ChartParamService.java
对比新文件 @@ -0,0 +1,29 @@ package com.iailab.module.model.mpk.service; import com.iailab.framework.common.page.PageData; import com.iailab.framework.common.pojo.PageResult; import com.iailab.module.model.mpk.dto.ChartParamDTO; import com.iailab.module.model.mpk.entity.ChartParamEntity; import com.iailab.module.model.mpk.entity.IconEntity; import com.iailab.module.model.mpk.vo.IconPageReqVO; import java.util.List; import java.util.Map; /** * @description: * @author: dzd * @date: 2024/11/5 11:20 **/ public interface ChartParamService { PageData<ChartParamDTO> page(Map<String, Object> params); void create(ChartParamEntity entity); void update(ChartParamEntity entity); ChartParamEntity get(String id); void delete(String id); } iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/ChartService.java
对比新文件 @@ -0,0 +1,25 @@ package com.iailab.module.model.mpk.service; import com.iailab.framework.common.page.PageData; import com.iailab.module.model.mpk.dto.ChartDTO; import com.iailab.module.model.mpk.entity.ChartEntity; import java.util.Map; /** * @description: * @author: dzd * @date: 2024/11/5 11:20 **/ public interface ChartService { PageData<ChartDTO> page(Map<String, Object> params); void create(ChartEntity entity); void update(ChartEntity entity); ChartEntity get(String id); void delete(String id); } iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/ChartParamServiceImpl.java
对比新文件 @@ -0,0 +1,74 @@ package com.iailab.module.model.mpk.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.iailab.framework.common.page.PageData; import com.iailab.framework.common.service.impl.BaseServiceImpl; import com.iailab.module.model.mpk.dao.ChartParamDao; import com.iailab.module.model.mpk.dto.ChartParamDTO; import com.iailab.module.model.mpk.entity.ChartEntity; import com.iailab.module.model.mpk.entity.ChartParamEntity; import com.iailab.module.model.mpk.service.ChartParamService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.Date; import java.util.Map; import java.util.UUID; /** * @description: * @author: dzd * @date: 2024/11/5 11:21 **/ @Slf4j @Service public class ChartParamServiceImpl extends BaseServiceImpl<ChartParamDao, ChartParamEntity> implements ChartParamService { @Override public PageData<ChartParamDTO> page(Map<String, Object> params) { IPage<ChartParamEntity> page = baseDao.selectPage( getPage(params, "create_time", false), getWrapper(params) ); return getPageData(page, ChartParamDTO.class); } @Override public void create(ChartParamEntity entity) { entity.setId(UUID.randomUUID().toString()); entity.setCreateTime(new Date()); baseDao.insert(entity); } @Override public void update(ChartParamEntity entity) { entity.setUpdateTime(new Date()); baseDao.updateById(entity); } @Override public ChartParamEntity get(String id) { return baseDao.selectById(id); } @Override public void delete(String id) { baseDao.deleteById(id); } private QueryWrapper<ChartParamEntity> getWrapper(Map<String, Object> params) { String paramName = (String) params.get("paramName"); String paramCode = (String) params.get("paramCode"); String chartId = (String) params.get("chartId"); QueryWrapper<ChartParamEntity> wrapper = new QueryWrapper<>(); wrapper.like(StringUtils.isNotBlank(paramName), "param_name", paramName) .like(StringUtils.isNotBlank(paramCode), "param_code", paramCode) .eq(StringUtils.isNotBlank(chartId), "chart_id", chartId); return wrapper; } } iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/ChartServiceImpl.java
对比新文件 @@ -0,0 +1,74 @@ package com.iailab.module.model.mpk.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.iailab.framework.common.page.PageData; import com.iailab.framework.common.service.impl.BaseServiceImpl; import com.iailab.module.model.mpk.dao.ChartDao; import com.iailab.module.model.mpk.dao.ChartParamDao; import com.iailab.module.model.mpk.dto.ChartDTO; import com.iailab.module.model.mpk.dto.ChartParamDTO; import com.iailab.module.model.mpk.entity.ChartEntity; import com.iailab.module.model.mpk.entity.ChartParamEntity; import com.iailab.module.model.mpk.service.ChartParamService; import com.iailab.module.model.mpk.service.ChartService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import java.util.Date; import java.util.Map; import java.util.UUID; /** * @description: * @author: dzd * @date: 2024/11/5 11:21 **/ @Slf4j @Service public class ChartServiceImpl extends BaseServiceImpl<ChartDao, ChartEntity> implements ChartService { @Override public PageData<ChartDTO> page(Map<String, Object> params) { IPage<ChartEntity> page = baseDao.selectPage( getPage(params, "create_time", false), getWrapper(params) ); return getPageData(page, ChartDTO.class); } @Override public void create(ChartEntity entity) { entity.setId(UUID.randomUUID().toString()); entity.setCreateTime(new Date()); baseDao.insert(entity); } @Override public void update(ChartEntity entity) { entity.setUpdateTime(new Date()); baseDao.updateById(entity); } @Override public ChartEntity get(String id) { return baseDao.selectById(id); } @Override public void delete(String id) { baseDao.deleteById(id); } private QueryWrapper<ChartEntity> getWrapper(Map<String, Object> params) { String chartName = (String) params.get("chartName"); String chartCode = (String) params.get("chartCode"); QueryWrapper<ChartEntity> wrapper = new QueryWrapper<>(); wrapper.like(StringUtils.isNotBlank(chartName), "chart_name", chartName) .like(StringUtils.isNotBlank(chartCode), "chart_code", chartCode); return wrapper; } } iailab-module-model/iailab-module-model-biz/src/main/resources/application.yml
@@ -215,6 +215,8 @@ - t_mpk_icon - t_mpk_file_menu - t_mpk_file_group - t_chart_param - t_chart app: app-key: model app-secret: 85b0df7edc3df3611913df34ed695011