add - 语言信息、区域管理

master
yinq 2 years ago
parent d826e53a08
commit e98a95c7e5

@ -0,0 +1,103 @@
package com.ruoyi.basic.controller;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.basic.domain.HwArea;
import com.ruoyi.basic.service.IHwAreaService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
/**
* Controller
*
* @author YINQ
* @date 2023-08-30
*/
@RestController
@RequestMapping("/area")
public class HwAreaController extends BaseController
{
@Autowired
private IHwAreaService hwAreaService;
/**
*
*/
@RequiresPermissions("basic:area:list")
@GetMapping("/list")
public AjaxResult list(HwArea hwArea)
{
List<HwArea> list = hwAreaService.selectHwAreaList(hwArea);
return success(list);
}
/**
*
*/
@RequiresPermissions("basic:area:export")
@Log(title = "区域管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, HwArea hwArea)
{
List<HwArea> list = hwAreaService.selectHwAreaList(hwArea);
ExcelUtil<HwArea> util = new ExcelUtil<HwArea>(HwArea.class);
util.exportExcel(response, list, "区域管理数据");
}
/**
*
*/
@RequiresPermissions("basic:area:query")
@GetMapping(value = "/{areaId}")
public AjaxResult getInfo(@PathVariable("areaId") Long areaId)
{
return success(hwAreaService.selectHwAreaByAreaId(areaId));
}
/**
*
*/
@RequiresPermissions("basic:area:add")
@Log(title = "区域管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody HwArea hwArea)
{
return toAjax(hwAreaService.insertHwArea(hwArea));
}
/**
*
*/
@RequiresPermissions("basic:area:edit")
@Log(title = "区域管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody HwArea hwArea)
{
return toAjax(hwAreaService.updateHwArea(hwArea));
}
/**
*
*/
@RequiresPermissions("basic:area:remove")
@Log(title = "区域管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{areaIds}")
public AjaxResult remove(@PathVariable Long[] areaIds)
{
return toAjax(hwAreaService.deleteHwAreaByAreaIds(areaIds));
}
}

@ -0,0 +1,72 @@
package com.ruoyi.basic.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.web.domain.TreeEntity;
/**
* hw_area
*
* @author YINQ
* @date 2023-08-30
*/
public class HwArea extends TreeEntity
{
private static final long serialVersionUID = 1L;
/** 区域ID */
private Long areaId;
/** 区域名称 */
@Excel(name = "区域名称")
private String areaName;
/** 区域状态 */
@Excel(name = "区域状态")
private Long areaStatus;
public void setAreaId(Long areaId)
{
this.areaId = areaId;
}
public Long getAreaId()
{
return areaId;
}
public void setAreaName(String areaName)
{
this.areaName = areaName;
}
public String getAreaName()
{
return areaName;
}
public void setAreaStatus(Long areaStatus)
{
this.areaStatus = areaStatus;
}
public Long getAreaStatus()
{
return areaStatus;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("areaId", getAreaId())
.append("areaName", getAreaName())
.append("ancestors", getAncestors())
.append("parentId", getParentId())
.append("areaStatus", getAreaStatus())
.append("orderNum", getOrderNum())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

@ -0,0 +1,61 @@
package com.ruoyi.basic.mapper;
import java.util.List;
import com.ruoyi.basic.domain.HwArea;
/**
* Mapper
*
* @author YINQ
* @date 2023-08-30
*/
public interface HwAreaMapper
{
/**
*
*
* @param areaId
* @return
*/
public HwArea selectHwAreaByAreaId(Long areaId);
/**
*
*
* @param hwArea
* @return
*/
public List<HwArea> selectHwAreaList(HwArea hwArea);
/**
*
*
* @param hwArea
* @return
*/
public int insertHwArea(HwArea hwArea);
/**
*
*
* @param hwArea
* @return
*/
public int updateHwArea(HwArea hwArea);
/**
*
*
* @param areaId
* @return
*/
public int deleteHwAreaByAreaId(Long areaId);
/**
*
*
* @param areaIds
* @return
*/
public int deleteHwAreaByAreaIds(Long[] areaIds);
}

@ -0,0 +1,61 @@
package com.ruoyi.basic.service;
import java.util.List;
import com.ruoyi.basic.domain.HwArea;
/**
* Service
*
* @author YINQ
* @date 2023-08-30
*/
public interface IHwAreaService
{
/**
*
*
* @param areaId
* @return
*/
public HwArea selectHwAreaByAreaId(Long areaId);
/**
*
*
* @param hwArea
* @return
*/
public List<HwArea> selectHwAreaList(HwArea hwArea);
/**
*
*
* @param hwArea
* @return
*/
public int insertHwArea(HwArea hwArea);
/**
*
*
* @param hwArea
* @return
*/
public int updateHwArea(HwArea hwArea);
/**
*
*
* @param areaIds
* @return
*/
public int deleteHwAreaByAreaIds(Long[] areaIds);
/**
*
*
* @param areaId
* @return
*/
public int deleteHwAreaByAreaId(Long areaId);
}

@ -0,0 +1,96 @@
package com.ruoyi.basic.service.impl;
import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.basic.mapper.HwAreaMapper;
import com.ruoyi.basic.domain.HwArea;
import com.ruoyi.basic.service.IHwAreaService;
/**
* Service
*
* @author YINQ
* @date 2023-08-30
*/
@Service
public class HwAreaServiceImpl implements IHwAreaService
{
@Autowired
private HwAreaMapper hwAreaMapper;
/**
*
*
* @param areaId
* @return
*/
@Override
public HwArea selectHwAreaByAreaId(Long areaId)
{
return hwAreaMapper.selectHwAreaByAreaId(areaId);
}
/**
*
*
* @param hwArea
* @return
*/
@Override
public List<HwArea> selectHwAreaList(HwArea hwArea)
{
return hwAreaMapper.selectHwAreaList(hwArea);
}
/**
*
*
* @param hwArea
* @return
*/
@Override
public int insertHwArea(HwArea hwArea)
{
hwArea.setCreateTime(DateUtils.getNowDate());
return hwAreaMapper.insertHwArea(hwArea);
}
/**
*
*
* @param hwArea
* @return
*/
@Override
public int updateHwArea(HwArea hwArea)
{
hwArea.setUpdateTime(DateUtils.getNowDate());
return hwAreaMapper.updateHwArea(hwArea);
}
/**
*
*
* @param areaIds
* @return
*/
@Override
public int deleteHwAreaByAreaIds(Long[] areaIds)
{
return hwAreaMapper.deleteHwAreaByAreaIds(areaIds);
}
/**
*
*
* @param areaId
* @return
*/
@Override
public int deleteHwAreaByAreaId(Long areaId)
{
return hwAreaMapper.deleteHwAreaByAreaId(areaId);
}
}

@ -0,0 +1,92 @@
<?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.basic.mapper.HwAreaMapper">
<resultMap type="HwArea" id="HwAreaResult">
<result property="areaId" column="area_id" />
<result property="areaName" column="area_name" />
<result property="ancestors" column="ancestors" />
<result property="parentId" column="parent_id" />
<result property="areaStatus" column="area_status" />
<result property="orderNum" column="order_num" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectHwAreaVo">
select area_id, area_name, ancestors, parent_id, area_status, order_num, create_by, create_time, update_by, update_time from hw_area
</sql>
<select id="selectHwAreaList" parameterType="HwArea" resultMap="HwAreaResult">
<include refid="selectHwAreaVo"/>
<where>
<if test="areaName != null and areaName != ''"> and area_name like concat('%', #{areaName}, '%')</if>
<if test="ancestors != null and ancestors != ''"> and ancestors = #{ancestors}</if>
<if test="parentId != null "> and parent_id = #{parentId}</if>
<if test="areaStatus != null "> and area_status = #{areaStatus}</if>
<if test="orderNum != null "> and order_num = #{orderNum}</if>
</where>
</select>
<select id="selectHwAreaByAreaId" parameterType="Long" resultMap="HwAreaResult">
<include refid="selectHwAreaVo"/>
where area_id = #{areaId}
</select>
<insert id="insertHwArea" parameterType="HwArea" useGeneratedKeys="true" keyProperty="areaId">
insert into hw_area
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="areaName != null and areaName != ''">area_name,</if>
<if test="ancestors != null">ancestors,</if>
<if test="parentId != null">parent_id,</if>
<if test="areaStatus != null">area_status,</if>
<if test="orderNum != null">order_num,</if>
<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>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="areaName != null and areaName != ''">#{areaName},</if>
<if test="ancestors != null">#{ancestors},</if>
<if test="parentId != null">#{parentId},</if>
<if test="areaStatus != null">#{areaStatus},</if>
<if test="orderNum != null">#{orderNum},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateHwArea" parameterType="HwArea">
update hw_area
<trim prefix="SET" suffixOverrides=",">
<if test="areaName != null and areaName != ''">area_name = #{areaName},</if>
<if test="ancestors != null">ancestors = #{ancestors},</if>
<if test="parentId != null">parent_id = #{parentId},</if>
<if test="areaStatus != null">area_status = #{areaStatus},</if>
<if test="orderNum != null">order_num = #{orderNum},</if>
<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>
</trim>
where area_id = #{areaId}
</update>
<delete id="deleteHwAreaByAreaId" parameterType="Long">
delete from hw_area where area_id = #{areaId}
</delete>
<delete id="deleteHwAreaByAreaIds" parameterType="String">
delete from hw_area where area_id in
<foreach item="areaId" collection="array" open="(" separator="," close=")">
#{areaId}
</foreach>
</delete>
</mapper>

@ -1,66 +0,0 @@
<?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.basic.mapper.HwDictDataLanguageMapper">
<resultMap type="HwDictDataLanguage" id="HwDictDataLanguageResult">
<result property="dataLanguageId" column="data_language_id" />
<result property="dictCode" column="dict_code" />
<result property="dictLabel" column="dict_label" />
<result property="languageCode" column="language_code" />
</resultMap>
<sql id="selectHwDictDataLanguageVo">
select data_language_id, dict_code, dict_label, language_code from hw_dict_data_language
</sql>
<select id="selectHwDictDataLanguageList" parameterType="HwDictDataLanguage" resultMap="HwDictDataLanguageResult">
<include refid="selectHwDictDataLanguageVo"/>
<where>
<if test="dictCode != null "> and dict_code = #{dictCode}</if>
<if test="dictLabel != null and dictLabel != ''"> and dict_label = #{dictLabel}</if>
<if test="languageCode != null and languageCode != ''"> and language_code = #{languageCode}</if>
</where>
</select>
<select id="selectHwDictDataLanguageByDataLanguageId" parameterType="Long" resultMap="HwDictDataLanguageResult">
<include refid="selectHwDictDataLanguageVo"/>
where data_language_id = #{dataLanguageId}
</select>
<insert id="insertHwDictDataLanguage" parameterType="HwDictDataLanguage" useGeneratedKeys="true" keyProperty="dataLanguageId">
insert into hw_dict_data_language
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="dictCode != null">dict_code,</if>
<if test="dictLabel != null">dict_label,</if>
<if test="languageCode != null and languageCode != ''">language_code,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="dictCode != null">#{dictCode},</if>
<if test="dictLabel != null">#{dictLabel},</if>
<if test="languageCode != null and languageCode != ''">#{languageCode},</if>
</trim>
</insert>
<update id="updateHwDictDataLanguage" parameterType="HwDictDataLanguage">
update hw_dict_data_language
<trim prefix="SET" suffixOverrides=",">
<if test="dictCode != null">dict_code = #{dictCode},</if>
<if test="dictLabel != null">dict_label = #{dictLabel},</if>
<if test="languageCode != null and languageCode != ''">language_code = #{languageCode},</if>
</trim>
where data_language_id = #{dataLanguageId}
</update>
<delete id="deleteHwDictDataLanguageByDataLanguageId" parameterType="Long">
delete from hw_dict_data_language where data_language_id = #{dataLanguageId}
</delete>
<delete id="deleteHwDictDataLanguageByDataLanguageIds" parameterType="String">
delete from hw_dict_data_language where data_language_id in
<foreach item="dataLanguageId" collection="array" open="(" separator="," close=")">
#{dataLanguageId}
</foreach>
</delete>
</mapper>

@ -1,118 +0,0 @@
<?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.basic.mapper.HwDictDataMapper">
<resultMap type="HwDictData" id="HwDictDataResult">
<result property="dictCode" column="dict_code" />
<result property="dictSort" column="dict_sort" />
<result property="dictLabel" column="dict_label" />
<result property="dictValue" column="dict_value" />
<result property="dictType" column="dict_type" />
<result property="cssClass" column="css_class" />
<result property="listClass" column="list_class" />
<result property="isDefault" column="is_default" />
<result property="status" column="status" />
<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" />
</resultMap>
<sql id="selectHwDictDataVo">
select dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, update_by, update_time, remark from hw_dict_data
</sql>
<select id="selectHwDictDataByType" parameterType="HwDictData" resultMap="HwDictDataResult">
<include refid="selectHwDictDataVo"/>
where status = '1' and dict_type = #{dictType} order by dict_sort asc
</select>
<select id="selectHwDictDataList" parameterType="HwDictData" resultMap="HwDictDataResult">
<include refid="selectHwDictDataVo"/>
<where>
<if test="dictSort != null "> and dict_sort = #{dictSort}</if>
<if test="dictLabel != null and dictLabel != ''"> and dict_label = #{dictLabel}</if>
<if test="dictValue != null and dictValue != ''"> and dict_value = #{dictValue}</if>
<if test="dictType != null and dictType != ''"> and dict_type = #{dictType}</if>
<if test="cssClass != null and cssClass != ''"> and css_class = #{cssClass}</if>
<if test="listClass != null and listClass != ''"> and list_class = #{listClass}</if>
<if test="isDefault != null and isDefault != ''"> and is_default = #{isDefault}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
</where>
</select>
<select id="selectHwDictDataByDictCode" parameterType="Long" resultMap="HwDictDataResult">
<include refid="selectHwDictDataVo"/>
where dict_code = #{dictCode}
</select>
<insert id="insertHwDictData" parameterType="HwDictData" useGeneratedKeys="true" keyProperty="dictCode">
insert into hw_dict_data
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="dictSort != null">dict_sort,</if>
<if test="dictLabel != null">dict_label,</if>
<if test="dictValue != null">dict_value,</if>
<if test="dictType != null">dict_type,</if>
<if test="cssClass != null">css_class,</if>
<if test="listClass != null">list_class,</if>
<if test="isDefault != null">is_default,</if>
<if test="status != null">status,</if>
<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="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="dictSort != null">#{dictSort},</if>
<if test="dictLabel != null">#{dictLabel},</if>
<if test="dictValue != null">#{dictValue},</if>
<if test="dictType != null">#{dictType},</if>
<if test="cssClass != null">#{cssClass},</if>
<if test="listClass != null">#{listClass},</if>
<if test="isDefault != null">#{isDefault},</if>
<if test="status != null">#{status},</if>
<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="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateHwDictData" parameterType="HwDictData">
update hw_dict_data
<trim prefix="SET" suffixOverrides=",">
<if test="dictSort != null">dict_sort = #{dictSort},</if>
<if test="dictLabel != null">dict_label = #{dictLabel},</if>
<if test="dictValue != null">dict_value = #{dictValue},</if>
<if test="dictType != null">dict_type = #{dictType},</if>
<if test="cssClass != null">css_class = #{cssClass},</if>
<if test="listClass != null">list_class = #{listClass},</if>
<if test="isDefault != null">is_default = #{isDefault},</if>
<if test="status != null">status = #{status},</if>
<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="remark != null">remark = #{remark},</if>
</trim>
where dict_code = #{dictCode}
</update>
<delete id="deleteHwDictDataByDictCode" parameterType="Long">
delete from hw_dict_data where dict_code = #{dictCode}
</delete>
<delete id="deleteHwDictDataByDictCodes" parameterType="String">
delete from hw_dict_data where dict_code in
<foreach item="dictCode" collection="array" open="(" separator="," close=")">
#{dictCode}
</foreach>
</delete>
</mapper>

@ -1,86 +0,0 @@
<?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.basic.mapper.HwDictTypeMapper">
<resultMap type="HwDictType" id="HwDictTypeResult">
<result property="dictId" column="dict_id" />
<result property="dictName" column="dict_name" />
<result property="dictType" column="dict_type" />
<result property="status" column="status" />
<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" />
</resultMap>
<sql id="selectHwDictTypeVo">
select dict_id, dict_name, dict_type, status, create_by, create_time, update_by, update_time, remark from hw_dict_type
</sql>
<select id="selectHwDictTypeList" parameterType="HwDictType" resultMap="HwDictTypeResult">
<include refid="selectHwDictTypeVo"/>
<where>
<if test="dictName != null and dictName != ''"> and dict_name like concat('%', #{dictName}, '%')</if>
<if test="dictType != null and dictType != ''"> and dict_type = #{dictType}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
</where>
</select>
<select id="selectHwDictTypeByDictId" parameterType="Long" resultMap="HwDictTypeResult">
<include refid="selectHwDictTypeVo"/>
where dict_id = #{dictId}
</select>
<insert id="insertHwDictType" parameterType="HwDictType" useGeneratedKeys="true" keyProperty="dictId">
insert into hw_dict_type
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="dictName != null">dict_name,</if>
<if test="dictType != null">dict_type,</if>
<if test="status != null">status,</if>
<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="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="dictName != null">#{dictName},</if>
<if test="dictType != null">#{dictType},</if>
<if test="status != null">#{status},</if>
<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="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateHwDictType" parameterType="HwDictType">
update hw_dict_type
<trim prefix="SET" suffixOverrides=",">
<if test="dictName != null">dict_name = #{dictName},</if>
<if test="dictType != null">dict_type = #{dictType},</if>
<if test="status != null">status = #{status},</if>
<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="remark != null">remark = #{remark},</if>
</trim>
where dict_id = #{dictId}
</update>
<delete id="deleteHwDictTypeByDictId" parameterType="Long">
delete from hw_dict_type where dict_id = #{dictId}
</delete>
<delete id="deleteHwDictTypeByDictIds" parameterType="String">
delete from hw_dict_type where dict_id in
<foreach item="dictId" collection="array" open="(" separator="," close=")">
#{dictId}
</foreach>
</delete>
</mapper>

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询区域管理列表
export function listArea(query) {
return request({
url: '/basic/area/list',
method: 'get',
params: query
})
}
// 查询区域管理详细
export function getArea(areaId) {
return request({
url: '/basic/area/' + areaId,
method: 'get'
})
}
// 新增区域管理
export function addArea(data) {
return request({
url: '/basic/area',
method: 'post',
data: data
})
}
// 修改区域管理
export function updateArea(data) {
return request({
url: '/basic/area',
method: 'put',
data: data
})
}
// 删除区域管理
export function delArea(areaId) {
return request({
url: '/basic/area/' + areaId,
method: 'delete'
})
}

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询语言信息列表
export function listLanguage(query) {
return request({
url: '/basic/language/list',
method: 'get',
params: query
})
}
// 查询语言信息详细
export function getLanguage(languageId) {
return request({
url: '/basic/language/' + languageId,
method: 'get'
})
}
// 新增语言信息
export function addLanguage(data) {
return request({
url: '/basic/language',
method: 'post',
data: data
})
}
// 修改语言信息
export function updateLanguage(data) {
return request({
url: '/basic/language',
method: 'put',
data: data
})
}
// 删除语言信息
export function delLanguage(languageId) {
return request({
url: '/basic/language/' + languageId,
method: 'delete'
})
}

@ -0,0 +1,331 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="区域名称" prop="areaName">
<el-input
v-model="queryParams.areaName"
placeholder="请输入区域名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="祖级列表" prop="ancestors">
<el-input
v-model="queryParams.ancestors"
placeholder="请输入祖级列表"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="父区域ID" prop="parentId">
<el-input
v-model="queryParams.parentId"
placeholder="请输入父区域ID"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="区域状态" prop="areaStatus">
<el-select v-model="queryParams.areaStatus" placeholder="请选择区域状态" clearable>
<el-option
v-for="dict in dict.type.area_status"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="显示顺序" prop="orderNum">
<el-input
v-model="queryParams.orderNum"
placeholder="请输入显示顺序"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['basic:area:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="info"
plain
icon="el-icon-sort"
size="mini"
@click="toggleExpandAll"
>展开/折叠</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table
v-if="refreshTable"
v-loading="loading"
:data="areaList"
row-key="areaId"
:default-expand-all="isExpandAll"
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
>
<el-table-column label="区域名称" prop="areaName" />
<el-table-column label="祖级列表" align="center" prop="ancestors" />
<el-table-column label="父区域ID" align="center" prop="parentId" />
<el-table-column label="区域状态" align="center" prop="areaStatus">
<template slot-scope="scope">
<dict-tag :options="dict.type.area_status" :value="scope.row.areaStatus"/>
</template>
</el-table-column>
<el-table-column label="显示顺序" align="center" prop="orderNum" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['basic:area:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-plus"
@click="handleAdd(scope.row)"
v-hasPermi="['basic:area:add']"
>新增</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['basic:area:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<!-- 添加或修改区域管理对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="区域名称" prop="areaName">
<el-input v-model="form.areaName" placeholder="请输入区域名称" />
</el-form-item>
<el-form-item label="父区域ID" prop="parentId">
<treeselect v-model="form.parentId" :options="areaOptions" :normalizer="normalizer" placeholder="请选择父区域ID" />
</el-form-item>
<el-form-item label="区域状态" prop="areaStatus">
<el-radio-group v-model="form.areaStatus">
<el-radio
v-for="dict in dict.type.area_status"
:key="dict.value"
:label="parseInt(dict.value)"
>{{dict.label}}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="显示顺序" prop="orderNum">
<el-input v-model="form.orderNum" placeholder="请输入显示顺序" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listArea, getArea, delArea, addArea, updateArea } from "@/api/basic/area";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default {
name: "Area",
dicts: ['area_status'],
components: {
Treeselect
},
data() {
return {
//
loading: true,
//
showSearch: true,
//
areaList: [],
//
areaOptions: [],
//
title: "",
//
open: false,
//
isExpandAll: true,
//
refreshTable: true,
//
queryParams: {
areaName: null,
ancestors: null,
parentId: null,
areaStatus: null,
orderNum: null,
},
//
form: {},
//
rules: {
areaName: [
{ required: true, message: "区域名称不能为空", trigger: "blur" }
],
parentId: [
{ required: true, message: "父区域ID不能为空", trigger: "blur" }
],
areaStatus: [
{ required: true, message: "区域状态不能为空", trigger: "change" }
],
orderNum: [
{ required: true, message: "显示顺序不能为空", trigger: "blur" }
],
}
};
},
created() {
this.getList();
},
methods: {
/** 查询区域管理列表 */
getList() {
this.loading = true;
listArea(this.queryParams).then(response => {
this.areaList = this.handleTree(response.data, "areaId", "parentId");
this.loading = false;
});
},
/** 转换区域管理数据结构 */
normalizer(node) {
if (node.children && !node.children.length) {
delete node.children;
}
return {
id: node.areaId,
label: node.areaName,
children: node.children
};
},
/** 查询区域管理下拉树结构 */
getTreeselect() {
listArea().then(response => {
this.areaOptions = [];
const data = { areaId: 0, areaName: '顶级节点', children: [] };
data.children = this.handleTree(response.data, "areaId", "parentId");
this.areaOptions.push(data);
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
areaId: null,
areaName: null,
ancestors: null,
parentId: null,
areaStatus: null,
orderNum: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd(row) {
this.reset();
this.getTreeselect();
if (row != null && row.areaId) {
this.form.parentId = row.areaId;
} else {
this.form.parentId = 0;
}
this.open = true;
this.title = "添加区域管理";
},
/** 展开/折叠操作 */
toggleExpandAll() {
this.refreshTable = false;
this.isExpandAll = !this.isExpandAll;
this.$nextTick(() => {
this.refreshTable = true;
});
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
this.getTreeselect();
if (row != null) {
this.form.parentId = row.areaId;
}
getArea(row.areaId).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改区域管理";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.areaId != null) {
updateArea(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addArea(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
this.$modal.confirm('是否确认删除区域管理编号为"' + row.areaId + '"的数据项?').then(function() {
return delArea(row.areaId);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
}
}
};
</script>

@ -0,0 +1,310 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="语言编码" prop="languageCode">
<el-input
v-model="queryParams.languageCode"
placeholder="请输入语言编码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="语言名称" prop="languageName">
<el-input
v-model="queryParams.languageName"
placeholder="请输入语言名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="语言代码" prop="languageLang">
<el-input
v-model="queryParams.languageLang"
placeholder="请输入语言代码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="语言国家" prop="languageCountry">
<el-input
v-model="queryParams.languageCountry"
placeholder="请输入语言国家"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="是否默认" prop="defaultFlag">
<el-input
v-model="queryParams.defaultFlag"
placeholder="请输入是否默认"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['basic:language:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['basic:language:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['basic:language:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['basic:language:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="languageList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="语言ID" align="center" prop="languageId" />
<el-table-column label="语言编码" align="center" prop="languageCode" />
<el-table-column label="语言名称" align="center" prop="languageName" />
<el-table-column label="语言代码" align="center" prop="languageLang" />
<el-table-column label="语言国家" align="center" prop="languageCountry" />
<el-table-column label="是否默认" align="center" prop="defaultFlag" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['basic:language:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['basic:language:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改语言信息对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="语言编码" prop="languageCode">
<el-input v-model="form.languageCode" placeholder="请输入语言编码" />
</el-form-item>
<el-form-item label="语言名称" prop="languageName">
<el-input v-model="form.languageName" placeholder="请输入语言名称" />
</el-form-item>
<el-form-item label="语言代码" prop="languageLang">
<el-input v-model="form.languageLang" placeholder="请输入语言代码" />
</el-form-item>
<el-form-item label="语言国家" prop="languageCountry">
<el-input v-model="form.languageCountry" placeholder="请输入语言国家" />
</el-form-item>
<el-form-item label="是否默认" prop="defaultFlag">
<el-input v-model="form.defaultFlag" placeholder="请输入是否默认" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listLanguage, getLanguage, delLanguage, addLanguage, updateLanguage } from "@/api/basic/language";
export default {
name: "Language",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
languageList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
languageCode: null,
languageName: null,
languageLang: null,
languageCountry: null,
defaultFlag: null
},
//
form: {},
//
rules: {
languageCode: [
{ required: true, message: "语言编码不能为空", trigger: "blur" }
],
languageName: [
{ required: true, message: "语言名称不能为空", trigger: "blur" }
],
defaultFlag: [
{ required: true, message: "是否默认不能为空", trigger: "blur" }
]
}
};
},
created() {
this.getList();
},
methods: {
/** 查询语言信息列表 */
getList() {
this.loading = true;
listLanguage(this.queryParams).then(response => {
this.languageList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
languageId: null,
languageCode: null,
languageName: null,
languageLang: null,
languageCountry: null,
defaultFlag: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.languageId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加语言信息";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const languageId = row.languageId || this.ids
getLanguage(languageId).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改语言信息";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.languageId != null) {
updateLanguage(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addLanguage(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const languageIds = row.languageId || this.ids;
this.$modal.confirm('是否确认删除语言信息编号为"' + languageIds + '"的数据项?').then(function() {
return delLanguage(languageIds);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('basic/language/export', {
...this.queryParams
}, `language_${new Date().getTime()}.xlsx`)
}
}
};
</script>
Loading…
Cancel
Save