Pārlūkot izejas kodu

网格类型配置

lidongyu 1 gadu atpakaļ
vecāks
revīzija
23434d0bc4

+ 93 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/handleAffairs/GridTypeController.java

@@ -0,0 +1,93 @@
+package com.ruoyi.web.controller.handleAffairs;
+
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.sooka.jnb.handleAffairs.domain.GridType;
+import com.sooka.jnb.handleAffairs.service.IGridTypeService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+@RestController
+@RequestMapping("/jnb/gridType")
+public class GridTypeController extends BaseController {
+
+    @Autowired
+    private IGridTypeService gridTypeService;
+
+    /**
+     * 查询网格类型配置列表
+     */
+    @PreAuthorize("@ss.hasPermi('jnb:gridType:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(GridType GridType)
+    {
+        startPage();
+        List<GridType> list = gridTypeService.selectGridTypeList(GridType);
+        return getDataTable(list);
+    }
+
+    /**
+     * 获取网格类型配置详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('jnb:gridType:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return success(gridTypeService.selectGridTypeById(id));
+    }
+
+    /**
+     * 新增网格类型配置
+     */
+    @PreAuthorize("@ss.hasPermi('jnb:gridType:add')")
+    @Log(title = "网格类型配置", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@Validated @RequestBody GridType GridType)
+    {
+        return toAjax(gridTypeService.insertGridType(GridType));
+    }
+
+    /**
+     * 修改网格类型配置
+     */
+    @PreAuthorize("@ss.hasPermi('jnb:gridType:edit')")
+    @Log(title = "网格类型配置", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@Validated @RequestBody GridType GridType)
+    {
+        return toAjax(gridTypeService.updateGridType(GridType));
+    }
+
+    /**
+     * 删除网格类型配置
+     */
+    @PreAuthorize("@ss.hasPermi('jnb:gridType:remove')")
+    @Log(title = "网格类型配置", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids)
+    {
+        return toAjax(gridTypeService.deleteGridTypeByIds(ids));
+    }
+
+    /**
+     * 导出网格类型配置列表
+     */
+    @PreAuthorize("@ss.hasPermi('jnb:gridType:export')")
+    @Log(title = "网格类型配置", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, GridType GridType)
+    {
+        List<GridType> list = gridTypeService.selectGridTypeList(GridType);
+        ExcelUtil<GridType> util = new ExcelUtil<GridType>(GridType.class);
+        util.exportExcel(response, list, "网格类型配置数据");
+    }
+}

+ 41 - 0
sooka-jnb/src/main/java/com/sooka/jnb/handleAffairs/domain/GridType.java

@@ -0,0 +1,41 @@
+package com.sooka.jnb.handleAffairs.domain;
+
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+
+/**
+ * 网格类型配置对象 jnb_grid_type
+ * 
+ * @author lidongyu
+ * @date 2024-03-01
+ */
+@Data
+public class GridType extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** id */
+    private Long id;
+
+    /** 名称 */
+    @Excel(name = "名称")
+    @NotBlank(message = "名称不能为空")
+    private String name;
+
+    /** 岗位描述 */
+    @Excel(name = "岗位描述")
+    @NotBlank(message = "岗位描述不能为空")
+    private String jobDescription;
+
+    /** 图片路径 */
+    @Excel(name = "图片路径")
+    private String fileUrl;
+
+    /** 是否展示 */
+    @Excel(name = "是否展示")
+    private String yesOrNoShow;
+
+}

+ 63 - 0
sooka-jnb/src/main/java/com/sooka/jnb/handleAffairs/mapper/GridTypeMapper.java

@@ -0,0 +1,63 @@
+package com.sooka.jnb.handleAffairs.mapper;
+
+import com.sooka.jnb.handleAffairs.domain.GridType;
+
+import java.util.List;
+
+
+/**
+ * 网格类型配置Mapper接口
+ * 
+ * @author lidongyu
+ * @date 2024-03-01
+ */
+public interface GridTypeMapper 
+{
+    /**
+     * 查询网格类型配置
+     * 
+     * @param id 网格类型配置主键
+     * @return 网格类型配置
+     */
+    public GridType selectGridTypeById(Long id);
+
+    /**
+     * 查询网格类型配置列表
+     * 
+     * @param gridType 网格类型配置
+     * @return 网格类型配置集合
+     */
+    public List<GridType> selectGridTypeList(GridType gridType);
+
+    /**
+     * 新增网格类型配置
+     * 
+     * @param gridType 网格类型配置
+     * @return 结果
+     */
+    public int insertGridType(GridType gridType);
+
+    /**
+     * 修改网格类型配置
+     * 
+     * @param gridType 网格类型配置
+     * @return 结果
+     */
+    public int updateGridType(GridType gridType);
+
+    /**
+     * 删除网格类型配置
+     * 
+     * @param id 网格类型配置主键
+     * @return 结果
+     */
+    public int deleteGridTypeById(Long id);
+
+    /**
+     * 批量删除网格类型配置
+     * 
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteGridTypeByIds(Long[] ids);
+}

+ 63 - 0
sooka-jnb/src/main/java/com/sooka/jnb/handleAffairs/service/IGridTypeService.java

@@ -0,0 +1,63 @@
+package com.sooka.jnb.handleAffairs.service;
+
+import com.sooka.jnb.handleAffairs.domain.GridType;
+
+import java.util.List;
+
+
+/**
+ * 网格类型配置Service接口
+ * 
+ * @author lidongyu
+ * @date 2024-03-01
+ */
+public interface IGridTypeService
+{
+    /**
+     * 查询网格类型配置
+     * 
+     * @param id 网格类型配置主键
+     * @return 网格类型配置
+     */
+    public GridType selectGridTypeById(Long id);
+
+    /**
+     * 查询网格类型配置列表
+     * 
+     * @param gridType 网格类型配置
+     * @return 网格类型配置集合
+     */
+    public List<GridType> selectGridTypeList(GridType gridType);
+
+    /**
+     * 新增网格类型配置
+     * 
+     * @param gridType 网格类型配置
+     * @return 结果
+     */
+    public int insertGridType(GridType gridType);
+
+    /**
+     * 修改网格类型配置
+     * 
+     * @param gridType 网格类型配置
+     * @return 结果
+     */
+    public int updateGridType(GridType gridType);
+
+    /**
+     * 批量删除网格类型配置
+     * 
+     * @param ids 需要删除的网格类型配置主键集合
+     * @return 结果
+     */
+    public int deleteGridTypeByIds(Long[] ids);
+
+    /**
+     * 删除网格类型配置信息
+     * 
+     * @param id 网格类型配置主键
+     * @return 结果
+     */
+    public int deleteGridTypeById(Long id);
+}

+ 102 - 0
sooka-jnb/src/main/java/com/sooka/jnb/handleAffairs/service/impl/GridTypeServiceImpl.java

@@ -0,0 +1,102 @@
+package com.sooka.jnb.handleAffairs.service.impl;
+
+
+import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.SecurityUtils;
+import com.sooka.jnb.handleAffairs.domain.GridType;
+import com.sooka.jnb.handleAffairs.mapper.GridTypeMapper;
+import com.sooka.jnb.handleAffairs.service.IGridTypeService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * 网格类型配置Service业务层处理
+ * 
+ * @author lidongyu
+ * @date 2024-03-01
+ */
+@Service
+public class GridTypeServiceImpl implements IGridTypeService 
+{
+    @Autowired
+    private GridTypeMapper gridTypeMapper;
+
+    /**
+     * 查询网格类型配置
+     * 
+     * @param id 网格类型配置主键
+     * @return 网格类型配置
+     */
+    @Override
+    public GridType selectGridTypeById(Long id)
+    {
+        return gridTypeMapper.selectGridTypeById(id);
+    }
+
+    /**
+     * 查询网格类型配置列表
+     * 
+     * @param gridType 网格类型配置
+     * @return 网格类型配置
+     */
+    @Override
+    public List<GridType> selectGridTypeList(GridType gridType)
+    {
+        return gridTypeMapper.selectGridTypeList(gridType);
+    }
+
+    /**
+     * 新增网格类型配置
+     * 
+     * @param gridType 网格类型配置
+     * @return 结果
+     */
+    @Override
+    public int insertGridType(GridType gridType)
+    {
+        gridType.setCreateTime(DateUtils.getNowDate());
+        gridType.setCreateBy(SecurityUtils.getUserId().toString());
+        gridType.setDelFlag("0");
+        return gridTypeMapper.insertGridType(gridType);
+    }
+
+    /**
+     * 修改网格类型配置
+     * 
+     * @param gridType 网格类型配置
+     * @return 结果
+     */
+    @Override
+    public int updateGridType(GridType gridType)
+    {
+        gridType.setUpdateTime(DateUtils.getNowDate());
+        gridType.setUpdateBy(SecurityUtils.getUserId().toString());
+        return gridTypeMapper.updateGridType(gridType);
+    }
+
+    /**
+     * 批量删除网格类型配置
+     * 
+     * @param ids 需要删除的网格类型配置主键
+     * @return 结果
+     */
+    @Override
+    public int deleteGridTypeByIds(Long[] ids)
+    {
+        return gridTypeMapper.deleteGridTypeByIds(ids);
+    }
+
+    /**
+     * 删除网格类型配置信息
+     * 
+     * @param id 网格类型配置主键
+     * @return 结果
+     */
+    @Override
+    public int deleteGridTypeById(Long id)
+    {
+        return gridTypeMapper.deleteGridTypeById(id);
+    }
+}

+ 91 - 0
sooka-jnb/src/main/resources/mapper/handleAffairs/GridTypeMapper.xml

@@ -0,0 +1,91 @@
+<?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.sooka.jnb.handleAffairs.mapper.GridTypeMapper">
+    
+    <resultMap type="GridType" id="GridTypeResult">
+        <result property="createBy"    column="create_by"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateBy"    column="update_by"    />
+        <result property="updateTime"    column="update_time"    />
+        <result property="remark"    column="remark"    />
+        <result property="delFlag"    column="del_flag"    />
+        <result property="version"    column="version"    />
+        <result property="id"    column="id"    />
+        <result property="name"    column="name"    />
+        <result property="jobDescription"    column="job_description"    />
+        <result property="fileUrl"    column="file_url"    />
+        <result property="yesOrNoShow"    column="yes_or_no_show"    />
+    </resultMap>
+
+    <sql id="selectGridTypeVo">
+        select create_by, create_time, update_by, update_time, remark, del_flag, version, id, name, job_description, file_url, yes_or_no_show from jnb_grid_type
+    </sql>
+
+    <select id="selectGridTypeList" parameterType="GridType" resultMap="GridTypeResult">
+        <include refid="selectGridTypeVo"/>
+        <where>
+            and del_flag = 0
+            <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
+            <if test="yesOrNoShow != null  and yesOrNoShow != ''"> and yes_or_no_show = #{yesOrNoShow}</if>
+        </where>
+    </select>
+    
+    <select id="selectGridTypeById" parameterType="Long" resultMap="GridTypeResult">
+        <include refid="selectGridTypeVo"/>
+        where id = #{id}
+    </select>
+        
+    <insert id="insertGridType" parameterType="GridType" useGeneratedKeys="true" keyProperty="id">
+        insert into jnb_grid_type
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="createBy != null">create_by,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="updateBy != null">update_by,</if>
+            <if test="updateTime != null">update_time,</if>
+            <if test="name != null and name != ''">name,</if>
+            <if test="jobDescription != null and jobDescription != ''">job_description,</if>
+            <if test="fileUrl != null">file_url,</if>
+            <if test="yesOrNoShow != null">yes_or_no_show,</if>
+            <if test="delFlag != null">del_flag,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="createBy != null">#{createBy},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="updateBy != null">#{updateBy},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+            <if test="name != null and name != ''">#{name},</if>
+            <if test="jobDescription != null and jobDescription != ''">#{jobDescription},</if>
+            <if test="fileUrl != null">#{fileUrl},</if>
+            <if test="yesOrNoShow != null">#{yesOrNoShow},</if>
+            <if test="delFlag != null">#{delFlag},</if>
+         </trim>
+    </insert>
+
+    <update id="updateGridType" parameterType="GridType">
+        update jnb_grid_type
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="createBy != null">create_by = #{createBy},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="updateBy != null">update_by = #{updateBy},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+            <if test="name != null and name != ''">name = #{name},</if>
+            <if test="jobDescription != null and jobDescription != ''">job_description = #{jobDescription},</if>
+            <if test="fileUrl != null">file_url = #{fileUrl},</if>
+            <if test="yesOrNoShow != null">yes_or_no_show = #{yesOrNoShow},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteGridTypeById" parameterType="Long">
+        update jnb_grid_type set del_flag = 2  where id = #{id}
+    </delete>
+
+    <delete id="deleteGridTypeByIds" parameterType="String">
+        update jnb_grid_type set del_flag = 2 where id in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>