From 7ed6c5a40c669a1b4dffcb3dca25bffebce16dcf Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期六, 07 十月 2023 15:25:17 +0800
Subject: [PATCH] baseParam代码

---
 server/platform/src/main/java/com/doumee/api/business/BaseParamController.java           |   90 +++++++++++
 server/services/src/main/java/com/doumee/service/business/impl/BaseParamServiceImpl.java |  145 ++++++++++++++++++
 server/services/src/main/java/com/doumee/dao/business/model/BaseParam.java               |   73 +++++++++
 server/services/src/main/java/com/doumee/service/business/BaseParamService.java          |   97 ++++++++++++
 server/services/db/business.base_param.permissions.sql                                   |    6 
 server/services/src/main/java/com/doumee/dao/business/BaseParamMapper.java               |   12 +
 6 files changed, 423 insertions(+), 0 deletions(-)

diff --git a/server/platform/src/main/java/com/doumee/api/business/BaseParamController.java b/server/platform/src/main/java/com/doumee/api/business/BaseParamController.java
new file mode 100644
index 0000000..d2dd2b2
--- /dev/null
+++ b/server/platform/src/main/java/com/doumee/api/business/BaseParamController.java
@@ -0,0 +1,90 @@
+package com.doumee.api.business;
+
+import com.doumee.api.BaseController;
+import com.doumee.core.annotation.excel.ExcelExporter;
+import com.doumee.core.annotation.pr.PreventRepeat;
+import com.doumee.core.model.ApiResponse;
+import com.doumee.core.model.PageWrap;
+import com.doumee.core.model.PageData;
+import com.doumee.dao.business.model.BaseParam;
+import com.doumee.service.business.BaseParamService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.apache.shiro.authz.annotation.RequiresPermissions;    
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import javax.servlet.http.HttpServletResponse;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author 姹熻箘韫�
+ * @date 2023/10/07 15:19
+ */
+@Api(tags = "绯荤粺鍩虹閰嶇疆琛�")
+@RestController
+@RequestMapping("/business/baseParam")
+public class BaseParamController extends BaseController {
+
+    @Autowired
+    private BaseParamService baseParamService;
+
+    @PreventRepeat
+    @ApiOperation("鏂板缓")
+    @PostMapping("/create")
+    @RequiresPermissions("business:baseparam:create")
+    public ApiResponse create(@RequestBody BaseParam baseParam) {
+        return ApiResponse.success(baseParamService.create(baseParam));
+    }
+
+    @ApiOperation("鏍规嵁ID鍒犻櫎")
+    @GetMapping("/delete/{id}")
+    @RequiresPermissions("business:baseparam:delete")
+    public ApiResponse deleteById(@PathVariable String id) {
+        baseParamService.deleteById(id);
+        return ApiResponse.success(null);
+    }
+
+    @ApiOperation("鎵归噺鍒犻櫎")
+    @GetMapping("/delete/batch")
+    @RequiresPermissions("business:baseparam:delete")
+    public ApiResponse deleteByIdInBatch(@RequestParam String ids) {
+        String [] idArray = ids.split(",");
+        List<String> idList = new ArrayList<>();
+        for (String id : idArray) {
+            idList.add(id);
+        }
+        baseParamService.deleteByIdInBatch(idList);
+        return ApiResponse.success(null);
+    }
+
+    @ApiOperation("鏍规嵁ID淇敼")
+    @PostMapping("/updateById")
+    @RequiresPermissions("business:baseparam:update")
+    public ApiResponse updateById(@RequestBody BaseParam baseParam) {
+        baseParamService.updateById(baseParam);
+        return ApiResponse.success(null);
+    }
+
+    @ApiOperation("鍒嗛〉鏌ヨ")
+    @PostMapping("/page")
+    @RequiresPermissions("business:baseparam:query")
+    public ApiResponse<PageData<BaseParam>> findPage (@RequestBody PageWrap<BaseParam> pageWrap) {
+        return ApiResponse.success(baseParamService.findPage(pageWrap));
+    }
+
+    @ApiOperation("瀵煎嚭Excel")
+    @PostMapping("/exportExcel")
+    @RequiresPermissions("business:baseparam:exportExcel")
+    public void exportExcel (@RequestBody PageWrap<BaseParam> pageWrap, HttpServletResponse response) {
+        ExcelExporter.build(BaseParam.class).export(baseParamService.findPage(pageWrap).getRecords(), "绯荤粺鍩虹閰嶇疆琛�", response);
+    }
+
+    @ApiOperation("鏍规嵁ID鏌ヨ")
+    @GetMapping("/{id}")
+    @RequiresPermissions("business:baseparam:query")
+    public ApiResponse findById(@PathVariable String id) {
+        return ApiResponse.success(baseParamService.findById(id));
+    }
+}
diff --git a/server/services/db/business.base_param.permissions.sql b/server/services/db/business.base_param.permissions.sql
new file mode 100644
index 0000000..34cbae3
--- /dev/null
+++ b/server/services/db/business.base_param.permissions.sql
@@ -0,0 +1,6 @@
+INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:baseparam:create', '鏂板缓绯荤粺鍩虹閰嶇疆琛�', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
+INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:baseparam:delete', '鍒犻櫎绯荤粺鍩虹閰嶇疆琛�', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
+INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:baseparam:update', '淇敼绯荤粺鍩虹閰嶇疆琛�', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
+INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:baseparam:query', '鏌ヨ绯荤粺鍩虹閰嶇疆琛�', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
+INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:baseparam:exportExcel', '瀵煎嚭绯荤粺鍩虹閰嶇疆琛�(Excel)', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0);
+
diff --git a/server/services/src/main/java/com/doumee/dao/business/BaseParamMapper.java b/server/services/src/main/java/com/doumee/dao/business/BaseParamMapper.java
new file mode 100644
index 0000000..155f58f
--- /dev/null
+++ b/server/services/src/main/java/com/doumee/dao/business/BaseParamMapper.java
@@ -0,0 +1,12 @@
+package com.doumee.dao.business;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.doumee.dao.business.model.BaseParam;
+
+/**
+ * @author 姹熻箘韫�
+ * @date 2023/10/07 15:19
+ */
+public interface BaseParamMapper extends BaseMapper<BaseParam> {
+
+}
diff --git a/server/services/src/main/java/com/doumee/dao/business/model/BaseParam.java b/server/services/src/main/java/com/doumee/dao/business/model/BaseParam.java
new file mode 100644
index 0000000..17bbb81
--- /dev/null
+++ b/server/services/src/main/java/com/doumee/dao/business/model/BaseParam.java
@@ -0,0 +1,73 @@
+package com.doumee.dao.business.model;
+
+import com.doumee.core.annotation.excel.ExcelColumn;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+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 java.util.Date;
+
+/**
+ * 绯荤粺鍩虹閰嶇疆琛�
+ * @author 姹熻箘韫�
+ * @date 2023/10/07 15:19
+ */
+@Data
+@ApiModel("绯荤粺鍩虹閰嶇疆琛�")
+@TableName("`base_param`")
+public class BaseParam {
+
+    @ApiModelProperty(value = "缂栫爜")
+    @ExcelColumn(name="缂栫爜")
+    private String id;
+
+    @ApiModelProperty(value = "鍒涘缓鏃堕棿")
+    @ExcelColumn(name="鍒涘缓鏃堕棿")
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private Date createDate;
+
+    @ApiModelProperty(value = "鍒涘缓浜�")
+    @ExcelColumn(name="鍒涘缓浜�")
+    private String creator;
+
+    @ApiModelProperty(value = "缂栬緫鏃堕棿")
+    @ExcelColumn(name="缂栬緫鏃堕棿")
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private Date editDate;
+
+    @ApiModelProperty(value = "缂栬緫浜�")
+    @ExcelColumn(name="缂栬緫浜�")
+    private String editor;
+
+    @ApiModelProperty(value = "鏄惁宸插垹闄� 0鏈垹闄� 1宸插垹闄�", example = "1")
+    @ExcelColumn(name="鏄惁宸插垹闄� 0鏈垹闄� 1宸插垹闄�")
+    private Integer isdeleted;
+
+    @ApiModelProperty(value = "鍚嶇О")
+    @ExcelColumn(name="鍚嶇О")
+    private String name;
+
+    @ApiModelProperty(value = "鎺掑簭鐮侊紙鍗囧簭锛�", example = "1")
+    @ExcelColumn(name="鎺掑簭鐮侊紙鍗囧簭锛�")
+    private Integer sortnum;
+
+    @ApiModelProperty(value = "绫诲瀷 0杞﹁締淇濅慨鍘熷洜 1寮哄埗杩樿溅鍘熷洜 2鏃堕暱鍑忓厤鍘熷洜 3鍗曡溅绫诲瀷", example = "1")
+    @ExcelColumn(name="绫诲瀷 0杞﹁締淇濅慨鍘熷洜 1寮哄埗杩樿溅鍘熷洜 2鏃堕暱鍑忓厤鍘熷洜 3鍗曡溅绫诲瀷")
+    private Integer type;
+
+    @ApiModelProperty(value = "鐘舵�� 0鍚敤 1绂佺敤", example = "1")
+    @ExcelColumn(name="鐘舵�� 0鍚敤 1绂佺敤")
+    private Integer status;
+
+    @ApiModelProperty(value = "澶囨敞")
+    @ExcelColumn(name="澶囨敞")
+    private String info;
+
+    @ApiModelProperty(value = "澶囨敞鏄惁蹇呭~ 0鍚� 1鏄�", example = "1")
+    @ExcelColumn(name="澶囨敞鏄惁蹇呭~ 0鍚� 1鏄�")
+    private Integer required;
+
+}
diff --git a/server/services/src/main/java/com/doumee/service/business/BaseParamService.java b/server/services/src/main/java/com/doumee/service/business/BaseParamService.java
new file mode 100644
index 0000000..abb0032
--- /dev/null
+++ b/server/services/src/main/java/com/doumee/service/business/BaseParamService.java
@@ -0,0 +1,97 @@
+package com.doumee.service.business;
+
+import com.doumee.core.model.PageData;
+import com.doumee.core.model.PageWrap;
+import com.doumee.dao.business.model.BaseParam;
+import java.util.List;
+
+/**
+ * 绯荤粺鍩虹閰嶇疆琛⊿ervice瀹氫箟
+ * @author 姹熻箘韫�
+ * @date 2023/10/07 15:19
+ */
+public interface BaseParamService {
+
+    /**
+     * 鍒涘缓
+     * 
+     * @param baseParam 瀹炰綋瀵硅薄
+     * @return String
+     */
+    String create(BaseParam baseParam);
+
+    /**
+     * 涓婚敭鍒犻櫎
+     *
+     * @param id 涓婚敭
+     */
+    void deleteById(String id);
+
+    /**
+     * 鍒犻櫎
+     *
+     * @param baseParam 瀹炰綋瀵硅薄
+     */
+    void delete(BaseParam baseParam);
+
+    /**
+     * 鎵归噺涓婚敭鍒犻櫎
+     *
+     * @param ids 涓婚敭闆�
+     */
+    void deleteByIdInBatch(List<String> ids);
+
+    /**
+     * 涓婚敭鏇存柊
+     *
+     * @param baseParam 瀹炰綋瀵硅薄
+     */
+    void updateById(BaseParam baseParam);
+
+    /**
+     * 鎵归噺涓婚敭鏇存柊
+     *
+     * @param baseParams 瀹炰綋闆�
+     */
+    void updateByIdInBatch(List<BaseParam> baseParams);
+
+    /**
+     * 涓婚敭鏌ヨ
+     *
+     * @param id 涓婚敭
+     * @return BaseParam
+     */
+    BaseParam findById(String id);
+
+    /**
+     * 鏉′欢鏌ヨ鍗曟潯璁板綍
+     *
+     * @param baseParam 瀹炰綋瀵硅薄
+     * @return BaseParam
+     */
+    BaseParam findOne(BaseParam baseParam);
+
+    /**
+     * 鏉′欢鏌ヨ
+     *
+     * @param baseParam 瀹炰綋瀵硅薄
+     * @return List<BaseParam>
+     */
+    List<BaseParam> findList(BaseParam baseParam);
+  
+    /**
+     * 鍒嗛〉鏌ヨ
+     *
+     * @param pageWrap 鍒嗛〉瀵硅薄
+     * @return PageData<BaseParam>
+     */
+    PageData<BaseParam> findPage(PageWrap<BaseParam> pageWrap);
+
+    /**
+     * 鏉′欢缁熻
+     *
+     * @param baseParam 瀹炰綋瀵硅薄
+     * @return long
+     */
+    long count(BaseParam baseParam);
+}
diff --git a/server/services/src/main/java/com/doumee/service/business/impl/BaseParamServiceImpl.java b/server/services/src/main/java/com/doumee/service/business/impl/BaseParamServiceImpl.java
new file mode 100644
index 0000000..b02a7dd
--- /dev/null
+++ b/server/services/src/main/java/com/doumee/service/business/impl/BaseParamServiceImpl.java
@@ -0,0 +1,145 @@
+package com.doumee.service.business.impl;
+
+import com.doumee.core.model.PageData;
+import com.doumee.core.model.PageWrap;
+import com.doumee.core.utils.Utils;
+import com.doumee.dao.business.BaseParamMapper;
+import com.doumee.dao.business.model.BaseParam;
+import com.doumee.service.business.BaseParamService;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
+
+import java.util.List;
+
+/**
+ * 绯荤粺鍩虹閰嶇疆琛⊿ervice瀹炵幇
+ * @author 姹熻箘韫�
+ * @date 2023/10/07 15:19
+ */
+@Service
+public class BaseParamServiceImpl implements BaseParamService {
+
+    @Autowired
+    private BaseParamMapper baseParamMapper;
+
+    @Override
+    public String create(BaseParam baseParam) {
+        baseParamMapper.insert(baseParam);
+        return baseParam.getId();
+    }
+
+    @Override
+    public void deleteById(String id) {
+        baseParamMapper.deleteById(id);
+    }
+
+    @Override
+    public void delete(BaseParam baseParam) {
+        UpdateWrapper<BaseParam> deleteWrapper = new UpdateWrapper<>(baseParam);
+        baseParamMapper.delete(deleteWrapper);
+    }
+
+    @Override
+    public void deleteByIdInBatch(List<String> ids) {
+        if (CollectionUtils.isEmpty(ids)) {
+            return;
+        }
+        baseParamMapper.deleteBatchIds(ids);
+    }
+
+    @Override
+    public void updateById(BaseParam baseParam) {
+        baseParamMapper.updateById(baseParam);
+    }
+
+    @Override
+    public void updateByIdInBatch(List<BaseParam> baseParams) {
+        if (CollectionUtils.isEmpty(baseParams)) {
+            return;
+        }
+        for (BaseParam baseParam: baseParams) {
+            this.updateById(baseParam);
+        }
+    }
+
+    @Override
+    public BaseParam findById(String id) {
+        return baseParamMapper.selectById(id);
+    }
+
+    @Override
+    public BaseParam findOne(BaseParam baseParam) {
+        QueryWrapper<BaseParam> wrapper = new QueryWrapper<>(baseParam);
+        return baseParamMapper.selectOne(wrapper);
+    }
+
+    @Override
+    public List<BaseParam> findList(BaseParam baseParam) {
+        QueryWrapper<BaseParam> wrapper = new QueryWrapper<>(baseParam);
+        return baseParamMapper.selectList(wrapper);
+    }
+  
+    @Override
+    public PageData<BaseParam> findPage(PageWrap<BaseParam> pageWrap) {
+        IPage<BaseParam> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity());
+        QueryWrapper<BaseParam> queryWrapper = new QueryWrapper<>();
+        Utils.MP.blankToNull(pageWrap.getModel());
+        if (pageWrap.getModel().getId() != null) {
+            queryWrapper.lambda().eq(BaseParam::getId, pageWrap.getModel().getId());
+        }
+        if (pageWrap.getModel().getCreateDate() != null) {
+            queryWrapper.lambda().ge(BaseParam::getCreateDate, Utils.Date.getStart(pageWrap.getModel().getCreateDate()));
+            queryWrapper.lambda().le(BaseParam::getCreateDate, Utils.Date.getEnd(pageWrap.getModel().getCreateDate()));
+        }
+        if (pageWrap.getModel().getCreator() != null) {
+            queryWrapper.lambda().eq(BaseParam::getCreator, pageWrap.getModel().getCreator());
+        }
+        if (pageWrap.getModel().getEditDate() != null) {
+            queryWrapper.lambda().ge(BaseParam::getEditDate, Utils.Date.getStart(pageWrap.getModel().getEditDate()));
+            queryWrapper.lambda().le(BaseParam::getEditDate, Utils.Date.getEnd(pageWrap.getModel().getEditDate()));
+        }
+        if (pageWrap.getModel().getEditor() != null) {
+            queryWrapper.lambda().eq(BaseParam::getEditor, pageWrap.getModel().getEditor());
+        }
+        if (pageWrap.getModel().getIsdeleted() != null) {
+            queryWrapper.lambda().eq(BaseParam::getIsdeleted, pageWrap.getModel().getIsdeleted());
+        }
+        if (pageWrap.getModel().getName() != null) {
+            queryWrapper.lambda().eq(BaseParam::getName, pageWrap.getModel().getName());
+        }
+        if (pageWrap.getModel().getSortnum() != null) {
+            queryWrapper.lambda().eq(BaseParam::getSortnum, pageWrap.getModel().getSortnum());
+        }
+        if (pageWrap.getModel().getType() != null) {
+            queryWrapper.lambda().eq(BaseParam::getType, pageWrap.getModel().getType());
+        }
+        if (pageWrap.getModel().getStatus() != null) {
+            queryWrapper.lambda().eq(BaseParam::getStatus, pageWrap.getModel().getStatus());
+        }
+        if (pageWrap.getModel().getInfo() != null) {
+            queryWrapper.lambda().eq(BaseParam::getInfo, pageWrap.getModel().getInfo());
+        }
+        if (pageWrap.getModel().getRequired() != null) {
+            queryWrapper.lambda().eq(BaseParam::getRequired, pageWrap.getModel().getRequired());
+        }
+        for(PageWrap.SortData sortData: pageWrap.getSorts()) {
+            if (sortData.getDirection().equalsIgnoreCase(PageWrap.DESC)) {
+                queryWrapper.orderByDesc(sortData.getProperty());
+            } else {
+                queryWrapper.orderByAsc(sortData.getProperty());
+            }
+        }
+        return PageData.from(baseParamMapper.selectPage(page, queryWrapper));
+    }
+
+    @Override
+    public long count(BaseParam baseParam) {
+        QueryWrapper<BaseParam> wrapper = new QueryWrapper<>(baseParam);
+        return baseParamMapper.selectCount(wrapper);
+    }
+}

--
Gitblit v1.9.3