平台参数设置 模块
parent
b247bd5e9c
commit
e43e86df5e
@ -1,4 +1,4 @@
|
|||||||
package com.flossom.miniProgram.Enums;
|
package com.flossom.hzMapper.Enums;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 系统设置-key 枚举
|
* 系统设置-key 枚举
|
||||||
@ -0,0 +1,69 @@
|
|||||||
|
package com.flossom.hzMapper.mapper;
|
||||||
|
|
||||||
|
import com.flossom.hzMapper.domain.WxSystemSetting;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 平台参数设置Mapper接口
|
||||||
|
*
|
||||||
|
* @author flossom
|
||||||
|
* @date 2023-12-11
|
||||||
|
*/
|
||||||
|
public interface WxSystemSettingMapper
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询平台参数设置
|
||||||
|
*
|
||||||
|
* @param id 平台参数设置主键
|
||||||
|
* @return 平台参数设置
|
||||||
|
*/
|
||||||
|
public WxSystemSetting selectWxSystemSettingById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询平台参数设置列表
|
||||||
|
*
|
||||||
|
* @param wxSystemSetting 平台参数设置
|
||||||
|
* @return 平台参数设置集合
|
||||||
|
*/
|
||||||
|
public List<WxSystemSetting> selectWxSystemSettingList(WxSystemSetting wxSystemSetting);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增平台参数设置
|
||||||
|
*
|
||||||
|
* @param wxSystemSetting 平台参数设置
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertWxSystemSetting(WxSystemSetting wxSystemSetting);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改平台参数设置
|
||||||
|
*
|
||||||
|
* @param wxSystemSetting 平台参数设置
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateWxSystemSetting(WxSystemSetting wxSystemSetting);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除平台参数设置
|
||||||
|
*
|
||||||
|
* @param id 平台参数设置主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteWxSystemSettingById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除平台参数设置
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的数据主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteWxSystemSettingByIds(Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据 key 获取平台参数
|
||||||
|
* @param systemSetKey
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
WxSystemSetting getSystemSettingByKey(String systemSetKey);
|
||||||
|
}
|
||||||
@ -0,0 +1,102 @@
|
|||||||
|
<?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.flossom.hzMapper.mapper.WxSystemSettingMapper">
|
||||||
|
|
||||||
|
<resultMap type="WxSystemSetting" id="WxSystemSettingResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="key" column="key" />
|
||||||
|
<result property="value" column="value" />
|
||||||
|
<result property="instructions" column="instructions" />
|
||||||
|
<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="selectWxSystemSettingVo">
|
||||||
|
select id, `key`, `value`, instructions, status, create_by, create_time, update_by, update_time, remark from wx_system_setting
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectWxSystemSettingList" parameterType="WxSystemSetting" resultMap="WxSystemSettingResult">
|
||||||
|
<include refid="selectWxSystemSettingVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="key != null and key != ''"> and key = #{key}</if>
|
||||||
|
<if test="value != null and value != ''"> and value = #{value}</if>
|
||||||
|
<if test="instructions != null and instructions != ''"> and instructions = #{instructions}</if>
|
||||||
|
<if test="status != null "> and status = #{status}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectWxSystemSettingById" parameterType="Long" resultMap="WxSystemSettingResult">
|
||||||
|
<include refid="selectWxSystemSettingVo"/>
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertWxSystemSetting" parameterType="WxSystemSetting" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into wx_system_setting
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="key != null">key,</if>
|
||||||
|
<if test="value != null">value,</if>
|
||||||
|
<if test="instructions != null">instructions,</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="key != null">#{key},</if>
|
||||||
|
<if test="value != null">#{value},</if>
|
||||||
|
<if test="instructions != null">#{instructions},</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="updateWxSystemSetting" parameterType="WxSystemSetting">
|
||||||
|
update wx_system_setting
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="key != null">key = #{key},</if>
|
||||||
|
<if test="value != null">value = #{value},</if>
|
||||||
|
<if test="instructions != null">instructions = #{instructions},</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 id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteWxSystemSettingById" parameterType="Long">
|
||||||
|
delete from wx_system_setting where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteWxSystemSettingByIds" parameterType="String">
|
||||||
|
delete from wx_system_setting where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<select id="getSystemSettingByKey" parameterType="String" resultMap="WxSystemSettingResult">
|
||||||
|
<include refid="selectWxSystemSettingVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="key !=null">
|
||||||
|
and `key` = #{key}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
order by update_time desc
|
||||||
|
limit 1
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
@ -1,10 +0,0 @@
|
|||||||
package com.flossom.miniProgram.mapper;
|
|
||||||
|
|
||||||
import com.flossom.miniProgram.Enums.SystemSettingKeyEnum;
|
|
||||||
import com.flossom.miniProgram.domain.WxSystemSetting;
|
|
||||||
|
|
||||||
public interface SystemSettingMapper {
|
|
||||||
|
|
||||||
WxSystemSetting getSystemSettingByKey(String systemSetKey);
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,51 +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.flossom.miniProgram.mapper.SystemSettingMapper">
|
|
||||||
|
|
||||||
<resultMap type="WxSystemSetting" id="wxSystemSettingResult">
|
|
||||||
<id property="id" column="id"/>
|
|
||||||
<result property="key" column="key"/>
|
|
||||||
<result property="value" column="value"/>
|
|
||||||
<result property="instructions" column="instructions"/>
|
|
||||||
<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="selectWxSystemSettingVo">
|
|
||||||
select id,
|
|
||||||
`key`,
|
|
||||||
`value`,
|
|
||||||
instructions,
|
|
||||||
status,
|
|
||||||
create_by,
|
|
||||||
create_time,
|
|
||||||
update_by,
|
|
||||||
update_time,
|
|
||||||
remark
|
|
||||||
from wx_system_setting
|
|
||||||
</sql>
|
|
||||||
|
|
||||||
<!-- 查询条件 -->
|
|
||||||
<sql id="sqlwhereSearch">
|
|
||||||
<where>
|
|
||||||
<if test="key !=null">
|
|
||||||
and `key` = #{key}
|
|
||||||
</if>
|
|
||||||
</where>
|
|
||||||
</sql>
|
|
||||||
|
|
||||||
<select id="getSystemSettingByKey" parameterType="String" resultMap="wxSystemSettingResult">
|
|
||||||
<include refid="selectWxSystemSettingVo"/>
|
|
||||||
<include refid="sqlwhereSearch"/>
|
|
||||||
order by update_time desc
|
|
||||||
limit 1
|
|
||||||
</select>
|
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
|
||||||
@ -0,0 +1,98 @@
|
|||||||
|
package com.flossom.system.controller;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import com.flossom.common.core.utils.poi.ExcelUtil;
|
||||||
|
import com.flossom.common.core.web.controller.BaseController;
|
||||||
|
import com.flossom.common.core.web.domain.AjaxResult;
|
||||||
|
import com.flossom.common.core.web.page.TableDataInfo;
|
||||||
|
import com.flossom.common.log.annotation.Log;
|
||||||
|
import com.flossom.common.log.enums.BusinessType;
|
||||||
|
import com.flossom.common.security.annotation.RequiresPermissions;
|
||||||
|
import com.flossom.hzMapper.domain.WxSystemSetting;
|
||||||
|
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.flossom.system.service.IWxSystemSettingService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 平台参数设置Controller
|
||||||
|
*
|
||||||
|
* @author flossom
|
||||||
|
* @date 2023-12-11
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/setting")
|
||||||
|
public class WxSystemSettingController extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
private IWxSystemSettingService wxSystemSettingService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询平台参数设置列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:setting:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(WxSystemSetting wxSystemSetting) {
|
||||||
|
startPage();
|
||||||
|
List<WxSystemSetting> list = wxSystemSettingService.selectWxSystemSettingList(wxSystemSetting);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出平台参数设置列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:setting:export")
|
||||||
|
@Log(title = "平台参数设置", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, WxSystemSetting wxSystemSetting) {
|
||||||
|
List<WxSystemSetting> list = wxSystemSettingService.selectWxSystemSettingList(wxSystemSetting);
|
||||||
|
ExcelUtil<WxSystemSetting> util = new ExcelUtil<WxSystemSetting>(WxSystemSetting.class);
|
||||||
|
util.exportExcel(response, list, "平台参数设置数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取平台参数设置详细信息
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:setting:query")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||||
|
return success(wxSystemSettingService.selectWxSystemSettingById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增平台参数设置
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:setting:add")
|
||||||
|
@Log(title = "平台参数设置", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@RequestBody WxSystemSetting wxSystemSetting) {
|
||||||
|
return toAjax(wxSystemSettingService.insertWxSystemSetting(wxSystemSetting));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改平台参数设置
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:setting:edit")
|
||||||
|
@Log(title = "平台参数设置", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@RequestBody WxSystemSetting wxSystemSetting) {
|
||||||
|
return toAjax(wxSystemSettingService.updateWxSystemSetting(wxSystemSetting));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除平台参数设置
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:setting:remove")
|
||||||
|
@Log(title = "平台参数设置", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||||
|
return toAjax(wxSystemSettingService.deleteWxSystemSettingByIds(ids));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,61 @@
|
|||||||
|
package com.flossom.system.service;
|
||||||
|
|
||||||
|
import com.flossom.hzMapper.domain.WxSystemSetting;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 平台参数设置Service接口
|
||||||
|
*
|
||||||
|
* @author flossom
|
||||||
|
* @date 2023-12-11
|
||||||
|
*/
|
||||||
|
public interface IWxSystemSettingService {
|
||||||
|
/**
|
||||||
|
* 查询平台参数设置
|
||||||
|
*
|
||||||
|
* @param id 平台参数设置主键
|
||||||
|
* @return 平台参数设置
|
||||||
|
*/
|
||||||
|
public WxSystemSetting selectWxSystemSettingById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询平台参数设置列表
|
||||||
|
*
|
||||||
|
* @param wxSystemSetting 平台参数设置
|
||||||
|
* @return 平台参数设置集合
|
||||||
|
*/
|
||||||
|
public List<WxSystemSetting> selectWxSystemSettingList(WxSystemSetting wxSystemSetting);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增平台参数设置
|
||||||
|
*
|
||||||
|
* @param wxSystemSetting 平台参数设置
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertWxSystemSetting(WxSystemSetting wxSystemSetting);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改平台参数设置
|
||||||
|
*
|
||||||
|
* @param wxSystemSetting 平台参数设置
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateWxSystemSetting(WxSystemSetting wxSystemSetting);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除平台参数设置
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的平台参数设置主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteWxSystemSettingByIds(Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除平台参数设置信息
|
||||||
|
*
|
||||||
|
* @param id 平台参数设置主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteWxSystemSettingById(Long id);
|
||||||
|
}
|
||||||
@ -0,0 +1,90 @@
|
|||||||
|
package com.flossom.system.service.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.flossom.common.core.utils.DateUtils;
|
||||||
|
import com.flossom.hzMapper.domain.WxSystemSetting;
|
||||||
|
import com.flossom.hzMapper.mapper.WxSystemSettingMapper;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.flossom.system.service.IWxSystemSettingService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 平台参数设置Service业务层处理
|
||||||
|
*
|
||||||
|
* @author flossom
|
||||||
|
* @date 2023-12-11
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class WxSystemSettingServiceImpl implements IWxSystemSettingService {
|
||||||
|
@Autowired
|
||||||
|
private WxSystemSettingMapper wxSystemSettingMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询平台参数设置
|
||||||
|
*
|
||||||
|
* @param id 平台参数设置主键
|
||||||
|
* @return 平台参数设置
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public WxSystemSetting selectWxSystemSettingById(Long id) {
|
||||||
|
return wxSystemSettingMapper.selectWxSystemSettingById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询平台参数设置列表
|
||||||
|
*
|
||||||
|
* @param wxSystemSetting 平台参数设置
|
||||||
|
* @return 平台参数设置
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<WxSystemSetting> selectWxSystemSettingList(WxSystemSetting wxSystemSetting) {
|
||||||
|
return wxSystemSettingMapper.selectWxSystemSettingList(wxSystemSetting);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增平台参数设置
|
||||||
|
*
|
||||||
|
* @param wxSystemSetting 平台参数设置
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertWxSystemSetting(WxSystemSetting wxSystemSetting) {
|
||||||
|
wxSystemSetting.setCreateTime(DateUtils.getNowDate());
|
||||||
|
return wxSystemSettingMapper.insertWxSystemSetting(wxSystemSetting);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改平台参数设置
|
||||||
|
*
|
||||||
|
* @param wxSystemSetting 平台参数设置
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateWxSystemSetting(WxSystemSetting wxSystemSetting) {
|
||||||
|
wxSystemSetting.setUpdateTime(DateUtils.getNowDate());
|
||||||
|
return wxSystemSettingMapper.updateWxSystemSetting(wxSystemSetting);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除平台参数设置
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的平台参数设置主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteWxSystemSettingByIds(Long[] ids) {
|
||||||
|
return wxSystemSettingMapper.deleteWxSystemSettingByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除平台参数设置信息
|
||||||
|
*
|
||||||
|
* @param id 平台参数设置主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteWxSystemSettingById(Long id) {
|
||||||
|
return wxSystemSettingMapper.deleteWxSystemSettingById(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,44 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 查询平台参数设置列表
|
||||||
|
export function listSetting(query) {
|
||||||
|
return request({
|
||||||
|
url: '/system/setting/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询平台参数设置详细
|
||||||
|
export function getSetting(id) {
|
||||||
|
return request({
|
||||||
|
url: '/system/setting/' + id,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增平台参数设置
|
||||||
|
export function addSetting(data) {
|
||||||
|
return request({
|
||||||
|
url: '/system/setting',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改平台参数设置
|
||||||
|
export function updateSetting(data) {
|
||||||
|
return request({
|
||||||
|
url: '/system/setting',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除平台参数设置
|
||||||
|
export function delSetting(id) {
|
||||||
|
return request({
|
||||||
|
url: '/system/setting/' + id,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
||||||
@ -0,0 +1,277 @@
|
|||||||
|
<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="key">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.key"
|
||||||
|
placeholder="请输入键"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="说明" prop="instructions">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.instructions"
|
||||||
|
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="['system:setting: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="['system:setting: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="['system:setting: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="['system:setting:export']"
|
||||||
|
>导出</el-button>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-table v-loading="loading" :data="settingList" @selection-change="handleSelectionChange">
|
||||||
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
|
<el-table-column label="id" align="center" prop="id" />
|
||||||
|
<el-table-column label="键" align="center" prop="key" />
|
||||||
|
<el-table-column label="值" align="center" prop="value" show-overflow-tooltip="true" />
|
||||||
|
<el-table-column label="说明" align="center" prop="instructions" show-overflow-tooltip="true"/>
|
||||||
|
<el-table-column label="状态" align="center" prop="status" />
|
||||||
|
<el-table-column label="备注" align="center" prop="remark" />
|
||||||
|
<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="['system:setting:edit']"
|
||||||
|
>修改</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-delete"
|
||||||
|
@click="handleDelete(scope.row)"
|
||||||
|
v-hasPermi="['system:setting: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="key">
|
||||||
|
<el-input v-model="form.key" placeholder="请输入键" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="值" prop="value">
|
||||||
|
<el-input v-model="form.value" type="textarea" placeholder="请输入内容" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="说明" prop="instructions">
|
||||||
|
<el-input v-model="form.instructions" placeholder="请输入说明" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="备注" prop="remark">
|
||||||
|
<el-input v-model="form.remark" 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 { listSetting, getSetting, delSetting, addSetting, updateSetting } from "@/api/system/systemSetting";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "Setting",
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
// 遮罩层
|
||||||
|
loading: true,
|
||||||
|
// 选中数组
|
||||||
|
ids: [],
|
||||||
|
// 非单个禁用
|
||||||
|
single: true,
|
||||||
|
// 非多个禁用
|
||||||
|
multiple: true,
|
||||||
|
// 显示搜索条件
|
||||||
|
showSearch: true,
|
||||||
|
// 总条数
|
||||||
|
total: 0,
|
||||||
|
// 平台参数设置表格数据
|
||||||
|
settingList: [],
|
||||||
|
// 弹出层标题
|
||||||
|
title: "",
|
||||||
|
// 是否显示弹出层
|
||||||
|
open: false,
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
key: null,
|
||||||
|
value: null,
|
||||||
|
instructions: null,
|
||||||
|
status: null,
|
||||||
|
},
|
||||||
|
// 表单参数
|
||||||
|
form: {},
|
||||||
|
// 表单校验
|
||||||
|
rules: {
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
/** 查询平台参数设置列表 */
|
||||||
|
getList() {
|
||||||
|
this.loading = true;
|
||||||
|
listSetting(this.queryParams).then(response => {
|
||||||
|
this.settingList = response.rows;
|
||||||
|
this.total = response.total;
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 取消按钮
|
||||||
|
cancel() {
|
||||||
|
this.open = false;
|
||||||
|
this.reset();
|
||||||
|
},
|
||||||
|
// 表单重置
|
||||||
|
reset() {
|
||||||
|
this.form = {
|
||||||
|
id: null,
|
||||||
|
key: null,
|
||||||
|
value: null,
|
||||||
|
instructions: null,
|
||||||
|
status: null,
|
||||||
|
createBy: null,
|
||||||
|
createTime: null,
|
||||||
|
updateBy: null,
|
||||||
|
updateTime: null,
|
||||||
|
remark: 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.id)
|
||||||
|
this.single = selection.length!==1
|
||||||
|
this.multiple = !selection.length
|
||||||
|
},
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
handleAdd() {
|
||||||
|
this.reset();
|
||||||
|
this.open = true;
|
||||||
|
this.title = "添加平台参数设置";
|
||||||
|
},
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
handleUpdate(row) {
|
||||||
|
this.reset();
|
||||||
|
const id = row.id || this.ids
|
||||||
|
getSetting(id).then(response => {
|
||||||
|
this.form = response.data;
|
||||||
|
this.open = true;
|
||||||
|
this.title = "修改平台参数设置";
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 提交按钮 */
|
||||||
|
submitForm() {
|
||||||
|
this.$refs["form"].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
if (this.form.id != null) {
|
||||||
|
updateSetting(this.form).then(response => {
|
||||||
|
this.$modal.msgSuccess("修改成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
addSetting(this.form).then(response => {
|
||||||
|
this.$modal.msgSuccess("新增成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
handleDelete(row) {
|
||||||
|
const ids = row.id || this.ids;
|
||||||
|
this.$modal.confirm('是否确认删除平台参数设置编号为"' + ids + '"的数据项?').then(function() {
|
||||||
|
return delSetting(ids);
|
||||||
|
}).then(() => {
|
||||||
|
this.getList();
|
||||||
|
this.$modal.msgSuccess("删除成功");
|
||||||
|
}).catch(() => {});
|
||||||
|
},
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
handleExport() {
|
||||||
|
this.download('system/setting/export', {
|
||||||
|
...this.queryParams
|
||||||
|
}, `setting_${new Date().getTime()}.xlsx`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
Loading…
Reference in New Issue