Quellcode durchsuchen

新增省市区相关表的维护

王苗苗 vor 3 Wochen
Ursprung
Commit
497d8427d6

+ 135 - 0
ruoyi-system/src/main/java/com/ruoyi/business/domain/SysRegion.java

@@ -0,0 +1,135 @@
+package com.ruoyi.business.domain;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+
+/**
+ * 【请填写功能名称】对象 sys_region
+ * 
+ * @author ruoyi
+ * @date 2025-03-06
+ */
+public class SysRegion extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** $column.columnComment */
+    private Long regionId;
+
+    /** $column.columnComment */
+    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+    private String regionCod;
+
+    /** $column.columnComment */
+    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+    private String regionName;
+
+    /** $column.columnComment */
+    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+    private Long parentId;
+
+    /** $column.columnComment */
+    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+    private Long regionLevel;
+
+    /** $column.columnComment */
+    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+    private Long regionSort;
+
+    /** $column.columnComment */
+    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+    private String nameEn;
+
+    /** $column.columnComment */
+    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+    private String regionNation;
+
+    public void setRegionId(Long regionId) 
+    {
+        this.regionId = regionId;
+    }
+
+    public Long getRegionId() 
+    {
+        return regionId;
+    }
+    public void setRegionCod(String regionCod) 
+    {
+        this.regionCod = regionCod;
+    }
+
+    public String getRegionCod() 
+    {
+        return regionCod;
+    }
+    public void setRegionName(String regionName) 
+    {
+        this.regionName = regionName;
+    }
+
+    public String getRegionName() 
+    {
+        return regionName;
+    }
+    public void setParentId(Long parentId) 
+    {
+        this.parentId = parentId;
+    }
+
+    public Long getParentId() 
+    {
+        return parentId;
+    }
+    public void setRegionLevel(Long regionLevel) 
+    {
+        this.regionLevel = regionLevel;
+    }
+
+    public Long getRegionLevel() 
+    {
+        return regionLevel;
+    }
+    public void setRegionSort(Long regionSort) 
+    {
+        this.regionSort = regionSort;
+    }
+
+    public Long getRegionSort() 
+    {
+        return regionSort;
+    }
+    public void setNameEn(String nameEn) 
+    {
+        this.nameEn = nameEn;
+    }
+
+    public String getNameEn() 
+    {
+        return nameEn;
+    }
+    public void setRegionNation(String regionNation) 
+    {
+        this.regionNation = regionNation;
+    }
+
+    public String getRegionNation() 
+    {
+        return regionNation;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("regionId", getRegionId())
+            .append("regionCod", getRegionCod())
+            .append("regionName", getRegionName())
+            .append("parentId", getParentId())
+            .append("regionLevel", getRegionLevel())
+            .append("regionSort", getRegionSort())
+            .append("nameEn", getNameEn())
+            .append("regionNation", getRegionNation())
+            .toString();
+    }
+}

+ 61 - 0
ruoyi-system/src/main/java/com/ruoyi/business/mapper/SysRegionMapper.java

@@ -0,0 +1,61 @@
+package com.ruoyi.business.mapper;
+
+import java.util.List;
+import com.ruoyi.business.domain.SysRegion;
+
+/**
+ * 【请填写功能名称】Mapper接口
+ * 
+ * @author ruoyi
+ * @date 2025-03-06
+ */
+public interface SysRegionMapper 
+{
+    /**
+     * 查询【请填写功能名称】
+     * 
+     * @param regionId 【请填写功能名称】主键
+     * @return 【请填写功能名称】
+     */
+    public SysRegion selectSysRegionByRegionId(Long regionId);
+
+    /**
+     * 查询【请填写功能名称】列表
+     * 
+     * @param sysRegion 【请填写功能名称】
+     * @return 【请填写功能名称】集合
+     */
+    public List<SysRegion> selectSysRegionList(SysRegion sysRegion);
+
+    /**
+     * 新增【请填写功能名称】
+     * 
+     * @param sysRegion 【请填写功能名称】
+     * @return 结果
+     */
+    public int insertSysRegion(SysRegion sysRegion);
+
+    /**
+     * 修改【请填写功能名称】
+     * 
+     * @param sysRegion 【请填写功能名称】
+     * @return 结果
+     */
+    public int updateSysRegion(SysRegion sysRegion);
+
+    /**
+     * 删除【请填写功能名称】
+     * 
+     * @param regionId 【请填写功能名称】主键
+     * @return 结果
+     */
+    public int deleteSysRegionByRegionId(Long regionId);
+
+    /**
+     * 批量删除【请填写功能名称】
+     * 
+     * @param regionIds 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteSysRegionByRegionIds(Long[] regionIds);
+}

+ 61 - 0
ruoyi-system/src/main/java/com/ruoyi/business/service/ISysRegionService.java

@@ -0,0 +1,61 @@
+package com.ruoyi.business.service;
+
+import java.util.List;
+import com.ruoyi.business.domain.SysRegion;
+
+/**
+ * 【请填写功能名称】Service接口
+ * 
+ * @author ruoyi
+ * @date 2025-03-06
+ */
+public interface ISysRegionService 
+{
+    /**
+     * 查询【请填写功能名称】
+     * 
+     * @param regionId 【请填写功能名称】主键
+     * @return 【请填写功能名称】
+     */
+    public SysRegion selectSysRegionByRegionId(Long regionId);
+
+    /**
+     * 查询【请填写功能名称】列表
+     * 
+     * @param sysRegion 【请填写功能名称】
+     * @return 【请填写功能名称】集合
+     */
+    public List<SysRegion> selectSysRegionList(SysRegion sysRegion);
+
+    /**
+     * 新增【请填写功能名称】
+     * 
+     * @param sysRegion 【请填写功能名称】
+     * @return 结果
+     */
+    public int insertSysRegion(SysRegion sysRegion);
+
+    /**
+     * 修改【请填写功能名称】
+     * 
+     * @param sysRegion 【请填写功能名称】
+     * @return 结果
+     */
+    public int updateSysRegion(SysRegion sysRegion);
+
+    /**
+     * 批量删除【请填写功能名称】
+     * 
+     * @param regionIds 需要删除的【请填写功能名称】主键集合
+     * @return 结果
+     */
+    public int deleteSysRegionByRegionIds(Long[] regionIds);
+
+    /**
+     * 删除【请填写功能名称】信息
+     * 
+     * @param regionId 【请填写功能名称】主键
+     * @return 结果
+     */
+    public int deleteSysRegionByRegionId(Long regionId);
+}

+ 93 - 0
ruoyi-system/src/main/java/com/ruoyi/business/service/impl/SysRegionServiceImpl.java

@@ -0,0 +1,93 @@
+package com.ruoyi.business.service.impl;
+
+import java.util.List;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.ruoyi.business.mapper.SysRegionMapper;
+import com.ruoyi.business.domain.SysRegion;
+import com.ruoyi.business.service.ISysRegionService;
+
+/**
+ * 【请填写功能名称】Service业务层处理
+ * 
+ * @author ruoyi
+ * @date 2025-03-06
+ */
+@Service
+public class SysRegionServiceImpl implements ISysRegionService 
+{
+    @Autowired
+    private SysRegionMapper sysRegionMapper;
+
+    /**
+     * 查询【请填写功能名称】
+     * 
+     * @param regionId 【请填写功能名称】主键
+     * @return 【请填写功能名称】
+     */
+    @Override
+    public SysRegion selectSysRegionByRegionId(Long regionId)
+    {
+        return sysRegionMapper.selectSysRegionByRegionId(regionId);
+    }
+
+    /**
+     * 查询【请填写功能名称】列表
+     * 
+     * @param sysRegion 【请填写功能名称】
+     * @return 【请填写功能名称】
+     */
+    @Override
+    public List<SysRegion> selectSysRegionList(SysRegion sysRegion)
+    {
+        return sysRegionMapper.selectSysRegionList(sysRegion);
+    }
+
+    /**
+     * 新增【请填写功能名称】
+     * 
+     * @param sysRegion 【请填写功能名称】
+     * @return 结果
+     */
+    @Override
+    public int insertSysRegion(SysRegion sysRegion)
+    {
+        return sysRegionMapper.insertSysRegion(sysRegion);
+    }
+
+    /**
+     * 修改【请填写功能名称】
+     * 
+     * @param sysRegion 【请填写功能名称】
+     * @return 结果
+     */
+    @Override
+    public int updateSysRegion(SysRegion sysRegion)
+    {
+        return sysRegionMapper.updateSysRegion(sysRegion);
+    }
+
+    /**
+     * 批量删除【请填写功能名称】
+     * 
+     * @param regionIds 需要删除的【请填写功能名称】主键
+     * @return 结果
+     */
+    @Override
+    public int deleteSysRegionByRegionIds(Long[] regionIds)
+    {
+        return sysRegionMapper.deleteSysRegionByRegionIds(regionIds);
+    }
+
+    /**
+     * 删除【请填写功能名称】信息
+     * 
+     * @param regionId 【请填写功能名称】主键
+     * @return 结果
+     */
+    @Override
+    public int deleteSysRegionByRegionId(Long regionId)
+    {
+        return sysRegionMapper.deleteSysRegionByRegionId(regionId);
+    }
+}

+ 88 - 0
ruoyi-system/src/main/resources/mapper/business/SysRegionMapper.xml

@@ -0,0 +1,88 @@
+<?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.ruoyi.business.mapper.SysRegionMapper">
+    
+    <resultMap type="SysRegion" id="SysRegionResult">
+        <result property="regionId"    column="region_id"    />
+        <result property="regionCod"    column="region_cod"    />
+        <result property="regionName"    column="region_name"    />
+        <result property="parentId"    column="parent_id"    />
+        <result property="regionLevel"    column="region_level"    />
+        <result property="regionSort"    column="region_sort"    />
+        <result property="nameEn"    column="name_en"    />
+        <result property="regionNation"    column="region_nation"    />
+    </resultMap>
+
+    <sql id="selectSysRegionVo">
+        select region_id, region_cod, region_name, parent_id, region_level, region_sort, name_en, region_nation from sys_region
+    </sql>
+
+    <select id="selectSysRegionList" parameterType="SysRegion" resultMap="SysRegionResult">
+        <include refid="selectSysRegionVo"/>
+        <where>  
+            <if test="regionCod != null  and regionCod != ''"> and region_cod = #{regionCod}</if>
+            <if test="regionName != null  and regionName != ''"> and region_name like concat('%', #{regionName}, '%')</if>
+            <if test="parentId != null "> and parent_id = #{parentId}</if>
+            <if test="regionLevel != null "> and region_level = #{regionLevel}</if>
+            <if test="regionSort != null "> and region_sort = #{regionSort}</if>
+            <if test="nameEn != null  and nameEn != ''"> and name_en = #{nameEn}</if>
+            <if test="regionNation != null  and regionNation != ''"> and region_nation = #{regionNation}</if>
+        </where>
+    </select>
+    
+    <select id="selectSysRegionByRegionId" parameterType="Long" resultMap="SysRegionResult">
+        <include refid="selectSysRegionVo"/>
+        where region_id = #{regionId}
+    </select>
+
+    <insert id="insertSysRegion" parameterType="SysRegion">
+        insert into sys_region
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="regionId != null">region_id,</if>
+            <if test="regionCod != null">region_cod,</if>
+            <if test="regionName != null">region_name,</if>
+            <if test="parentId != null">parent_id,</if>
+            <if test="regionLevel != null">region_level,</if>
+            <if test="regionSort != null">region_sort,</if>
+            <if test="nameEn != null">name_en,</if>
+            <if test="regionNation != null">region_nation,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="regionId != null">#{regionId},</if>
+            <if test="regionCod != null">#{regionCod},</if>
+            <if test="regionName != null">#{regionName},</if>
+            <if test="parentId != null">#{parentId},</if>
+            <if test="regionLevel != null">#{regionLevel},</if>
+            <if test="regionSort != null">#{regionSort},</if>
+            <if test="nameEn != null">#{nameEn},</if>
+            <if test="regionNation != null">#{regionNation},</if>
+         </trim>
+    </insert>
+
+    <update id="updateSysRegion" parameterType="SysRegion">
+        update sys_region
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="regionCod != null">region_cod = #{regionCod},</if>
+            <if test="regionName != null">region_name = #{regionName},</if>
+            <if test="parentId != null">parent_id = #{parentId},</if>
+            <if test="regionLevel != null">region_level = #{regionLevel},</if>
+            <if test="regionSort != null">region_sort = #{regionSort},</if>
+            <if test="nameEn != null">name_en = #{nameEn},</if>
+            <if test="regionNation != null">region_nation = #{regionNation},</if>
+        </trim>
+        where region_id = #{regionId}
+    </update>
+
+    <delete id="deleteSysRegionByRegionId" parameterType="Long">
+        delete from sys_region where region_id = #{regionId}
+    </delete>
+
+    <delete id="deleteSysRegionByRegionIds" parameterType="String">
+        delete from sys_region where region_id in 
+        <foreach item="regionId" collection="array" open="(" separator="," close=")">
+            #{regionId}
+        </foreach>
+    </delete>
+</mapper>