Prechádzať zdrojové kódy

Merge remote-tracking branch 'origin/master' into master

hejizheng 1 rok pred
rodič
commit
948db1b124

+ 124 - 0
zhbsq-admin/src/main/java/com/hjy/modlue/portal/CbOpServiceController.java

@@ -0,0 +1,124 @@
+package com.hjy.modlue.portal;
+
+import com.hjy.common.annotation.Log;
+import com.hjy.common.config.ZhbsqConfig;
+import com.hjy.common.constant.Constants;
+import com.hjy.common.core.controller.BaseController;
+import com.hjy.common.core.domain.AjaxResult;
+import com.hjy.common.enums.BusinessType;
+import com.hjy.common.utils.StringUtils;
+import com.hjy.common.utils.file.FileUtils;
+import com.hjy.common.utils.poi.ExcelUtil;
+
+import com.hjy.module.service.portal.ICbOpServiceService;
+import com.hjy.module.vo.portal.CbOpServiceVo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.MediaType;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+import com.hjy.common.core.page.TableDataInfo;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.Arrays;
+import java.util.List;
+
+import static com.hjy.framework.datasource.DynamicDataSourceContextHolder.log;
+
+/**
+ * 运营服务Controller
+ *
+ * @author Tellsea
+ * @date 2023-08-29
+ */
+@Api(tags = "运营服务Controller")
+@RestController
+@RequestMapping("/OPSERVICE")
+@RequiredArgsConstructor(onConstructor_ = @Autowired)
+public class CbOpServiceController extends BaseController {
+
+    private final ICbOpServiceService cbOpServiceService;
+
+    @ApiOperation("查询运营服务列表")
+    @PreAuthorize("@ss.hasPermi('business:OPSERVICE:list')")
+    @GetMapping("/list")
+    public TableDataInfo<CbOpServiceVo> list(CbOpServiceVo entity) {
+        return cbOpServiceService.queryList(entity);
+    }
+
+    @ApiOperation("查询运营服务所有列表")
+    @GetMapping("/listAll")
+    public AjaxResult listAll(CbOpServiceVo entity) {
+        return AjaxResult.success("查询成功", cbOpServiceService.queryAll(entity));
+    }
+
+    @ApiOperation("导出运营服务列表")
+    @PreAuthorize("@ss.hasPermi('business:OPSERVICE:export')")
+    @Log(title = "运营服务", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, CbOpServiceVo entity) {
+        List<CbOpServiceVo> list = cbOpServiceService.queryAll(entity);
+        ExcelUtil<CbOpServiceVo> util = new ExcelUtil<>(CbOpServiceVo.class);
+        util.exportExcel(response, list, "运营服务数据");
+    }
+
+    @ApiOperation("获取运营服务详细信息")
+    @PreAuthorize("@ss.hasPermi('business:OPSERVICE:query')")
+    @GetMapping(value = "/getInfo/{id}")
+    public AjaxResult getInfo(@PathVariable("id") String id) {
+        return AjaxResult.success("查询成功", cbOpServiceService.queryById(id));
+    }
+
+    @ApiOperation("新增运营服务")
+    @PreAuthorize("@ss.hasPermi('business:OPSERVICE:add')")
+    @Log(title = "运营服务", businessType = BusinessType.INSERT)
+    @PostMapping("add")
+    public AjaxResult add(@RequestBody CbOpServiceVo entity) {
+        return toAjax(cbOpServiceService.save(entity));
+    }
+
+    @ApiOperation("修改运营服务")
+    @PreAuthorize("@ss.hasPermi('business:OPSERVICE:edit')")
+    @Log(title = "运营服务", businessType = BusinessType.UPDATE)
+    @PostMapping("edit")
+    public AjaxResult edit(@RequestBody CbOpServiceVo entity) {
+        return toAjax(cbOpServiceService.updateById(entity));
+    }
+
+    @ApiOperation("删除运营服务")
+    @PreAuthorize("@ss.hasPermi('business:OPSERVICE:remove')")
+    @Log(title = "运营服务", businessType = BusinessType.DELETE)
+	@GetMapping("/remove/{ids}")
+    public AjaxResult remove(@PathVariable String[] ids) {
+        return toAjax(cbOpServiceService.removeByIds(Arrays.asList(ids)) ? 1 : 0);
+    }
+
+
+    /**
+     * 本地资源通用下载
+     */
+    @ApiOperation("下载")
+    @Log(title = "下载", businessType = BusinessType.DOWNLOAD)
+    @GetMapping("/download")
+    public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request) {
+        try {
+            if (!FileUtils.checkAllowDownload(fileName)) {
+                throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName));
+            }
+            String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1);
+            String filePath = ZhbsqConfig.getDownloadPath() + fileName;
+
+            response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
+            FileUtils.setAttachmentResponseHeader(response, realFileName);
+            FileUtils.writeBytes(filePath, response.getOutputStream());
+            if (delete) {
+                FileUtils.deleteFile(filePath);
+            }
+        } catch (Exception e) {
+            log.error("下载文件失败", e);
+        }
+    }
+}

+ 6 - 0
zhbsq-common/src/main/java/com/hjy/common/enums/BusinessType.java

@@ -55,4 +55,10 @@ public enum BusinessType {
      * 清空数据
      */
     CLEAN,
+    /**
+     * 下载
+     */
+    DOWNLOAD,
+
+
 }

+ 65 - 0
zhbsq-modlue/src/main/java/com/hjy/module/domain/portal/CbOpService.java

@@ -0,0 +1,65 @@
+package com.hjy.module.domain.portal;
+
+import com.hjy.common.annotation.Excel;
+import com.hjy.common.core.domain.BaseEntity;
+import io.swagger.annotations.Api;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.ToString;
+import lombok.experimental.Accessors;
+
+/**
+ * 运营服务对象 CB_OP_SERVICE
+ *
+ * @author Tellsea
+ * @date 2023-08-29
+ */
+@Data
+@Accessors(chain = true)
+@ToString(callSuper = true)
+@EqualsAndHashCode(callSuper = true)
+public class CbOpService extends BaseEntity {
+
+    /**
+     * 主键id
+     */
+    @Excel(name = "主键id")
+    private String id;
+
+    /**
+     * 删除状态(0正常1删除)
+     */
+    @Excel(name = "删除状态", readConverterExp = "0=正常1删除")
+    private String delFlag;
+
+    /**
+     * 部门id
+     */
+    @Excel(name = "部门id")
+    private String deptId;
+
+    /**
+     * 文件名称
+     */
+    @Excel(name = "文件名称")
+    private String serviceName;
+
+    /**
+     * 文件附件
+     */
+    @Excel(name = "文件附件")
+    private String linkUrl;
+
+    /**
+     * 下载次数
+     */
+    @Excel(name = "下载次数")
+    private int download;
+
+    /**
+     * 服务状态(1招商服务2培训服务)
+     */
+    @Excel(name = "服务状态", readConverterExp = "1=招商服务2培训服务")
+    private String serviceType;
+
+}

+ 25 - 0
zhbsq-modlue/src/main/java/com/hjy/module/mapper/portal/CbOpServiceMapper.java

@@ -0,0 +1,25 @@
+package com.hjy.module.mapper.portal;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.hjy.module.domain.portal.CbOpService;
+import com.hjy.module.vo.portal.CbOpServiceVo;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 运营服务Mapper接口
+ *
+ * @author Tellsea
+ * @date 2023-08-29
+ */
+public interface CbOpServiceMapper extends BaseMapper<CbOpService> {
+
+    Page<CbOpServiceVo> queryList(Page<?> page, @Param("entity") CbOpServiceVo entity);
+
+    List<CbOpServiceVo> queryList(@Param("entity") CbOpServiceVo entity);
+
+    CbOpServiceVo queryById(@Param("id") String id);
+
+}

+ 41 - 0
zhbsq-modlue/src/main/java/com/hjy/module/service/portal/ICbOpServiceService.java

@@ -0,0 +1,41 @@
+package com.hjy.module.service.portal;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.hjy.common.core.page.TableDataInfo;
+import com.hjy.module.domain.portal.CbOpService;
+import com.hjy.module.vo.portal.CbOpServiceVo;
+
+import java.util.List;
+
+/**
+ * 运营服务Service接口
+ *
+ * @author Tellsea
+ * @date 2023-08-29
+ */
+public interface ICbOpServiceService extends IService<CbOpService> {
+
+    /**
+     * 分页查询
+     *
+     * @param entity
+     * @return
+     */
+    TableDataInfo<CbOpServiceVo> queryList(CbOpServiceVo entity);
+
+    /**
+     * 查询全部
+     *
+     * @param entity
+     * @return
+     */
+    List<CbOpServiceVo> queryAll(CbOpServiceVo entity);
+
+    /**
+     * 根据ID查询
+     *
+     * @param id
+     * @return
+     */
+    CbOpServiceVo queryById(String id);
+}

+ 37 - 0
zhbsq-modlue/src/main/java/com/hjy/module/service/portal/impl/CbOpServiceServiceImpl.java

@@ -0,0 +1,37 @@
+package com.hjy.module.service.portal.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.hjy.common.core.page.TableDataInfo;
+import com.hjy.common.utils.PageUtils;
+import com.hjy.module.domain.portal.CbOpService;
+import com.hjy.module.mapper.portal.CbOpServiceMapper;
+import com.hjy.module.service.portal.ICbOpServiceService;
+import com.hjy.module.vo.portal.CbOpServiceVo;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * 运营服务Service业务层处理
+ *
+ * @author Tellsea
+ * @date 2023-08-29
+ */
+@Service
+public class CbOpServiceServiceImpl extends ServiceImpl<CbOpServiceMapper, CbOpService> implements ICbOpServiceService {
+
+    @Override
+    public TableDataInfo<CbOpServiceVo> queryList(CbOpServiceVo entity) {
+        return PageUtils.buildDataInfo(this.baseMapper.queryList(PageUtils.buildPage(), entity));
+    }
+
+    @Override
+    public List<CbOpServiceVo> queryAll(CbOpServiceVo entity) {
+        return this.baseMapper.queryList(entity);
+    }
+
+    @Override
+    public CbOpServiceVo queryById(String id) {
+        return this.baseMapper.queryById(id);
+    }
+}

+ 21 - 0
zhbsq-modlue/src/main/java/com/hjy/module/vo/portal/CbOpServiceVo.java

@@ -0,0 +1,21 @@
+package com.hjy.module.vo.portal;
+
+import com.hjy.module.domain.portal.CbOpService;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.ToString;
+import lombok.experimental.Accessors;
+
+/**
+ * 运营服务Vo对象 CB_OP_SERVICE
+ *
+ * @author Tellsea
+ * @date 2023-08-29
+ */
+@Data
+@Accessors(chain = true)
+@ToString(callSuper = true)
+@EqualsAndHashCode(callSuper = true)
+public class CbOpServiceVo extends CbOpService {
+
+}

+ 73 - 0
zhbsq-modlue/src/main/resources/mapper/portal/CbOpServiceMapper.xml

@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.hjy.module.mapper.portal.CbOpServiceMapper">
+
+    <sql id="querySql">
+        select <include refid="allField"/>
+        from CB_OP_SERVICE A
+        <include refid="search"/>
+    </sql>
+
+    <select id="queryList" resultType="com.hjy.module.vo.portal.CbOpServiceVo">
+        <include refid="querySql"/>
+        <if test="entity.id != null and entity.id != ''">
+            and A.ID like concat('%', #{entity.id}, '%')
+        </if>
+        <if test="entity.createTime != null and entity.createTime != ''">
+            and A.CREATE_TIME like concat('%', #{entity.createTime}, '%')
+        </if>
+        <if test="entity.createBy != null and entity.createBy != ''">
+            and A.CREATE_BY like concat('%', #{entity.createBy}, '%')
+        </if>
+        <if test="entity.updateTime != null and entity.updateTime != ''">
+            and A.UPDATE_TIME like concat('%', #{entity.updateTime}, '%')
+        </if>
+        <if test="entity.updateBy != null and entity.updateBy != ''">
+            and A.UPDATE_BY like concat('%', #{entity.updateBy}, '%')
+        </if>
+        <if test="entity.delFlag != null and entity.delFlag != ''">
+            and A.DEL_FLAG like concat('%', #{entity.delFlag}, '%')
+        </if>
+        <if test="entity.deptId != null and entity.deptId != ''">
+            and A.DEPT_ID like concat('%', #{entity.deptId}, '%')
+        </if>
+        <if test="entity.serviceName != null and entity.serviceName != ''">
+            and A.SERVICE_NAME like concat('%', #{entity.serviceName}, '%')
+        </if>
+        <if test="entity.linkUrl != null and entity.linkUrl != ''">
+            and A.LINK_URL like concat('%', #{entity.linkUrl}, '%')
+        </if>
+        <if test="entity.download != null and entity.download != ''">
+            and A.DOWNLOAD like concat('%', #{entity.download}, '%')
+        </if>
+        <if test="entity.serviceType != null and entity.serviceType != ''">
+            and A.SERVICE_TYPE like concat('%', #{entity.serviceType}, '%')
+        </if>
+        order by A.create_time desc
+    </select>
+
+    <select id="queryById" resultType="com.hjy.module.vo.portal.CbOpServiceVo">
+        <include refid="querySql"/>
+        and A.id = #{id}
+    </select>
+
+    <sql id="allField">
+        A.ID,
+        A.CREATE_TIME,
+        A.CREATE_BY,
+        A.UPDATE_TIME,
+        A.UPDATE_BY,
+        A.DEL_FLAG,
+        A.DEPT_ID,
+        A.SERVICE_NAME,
+        A.LINK_URL,
+        A.DOWNLOAD,
+        A.SERVICE_TYPE
+    </sql>
+
+    <sql id="search">
+        where A.del_flag = 0
+    </sql>
+</mapper>