Commit 68c65757 authored by yaobaizheng's avatar yaobaizheng

首页推荐 默认图配置表

parent aac026d0
......@@ -96,7 +96,7 @@
var editFlag = [[${@permission.hasPermi('system:user:edit')}]];
var removeFlag = [[${@permission.hasPermi('system:user:remove')}]];
var resetPwdFlag = [[${@permission.hasPermi('system:user:resetPwd')}]];
var datas = [[${@dict.getType('sys_user_source')}]];
var datas = [[${@dict.getType('lyy_channel_source')}]];
var prefix = ctx + "system/user";
$(function() {
......
package com.ruoyi.system.controller;
import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.SysDefaultImgurl;
import com.ruoyi.system.service.ISysDefaultImgurlService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 设置默认图Controller
*
* @author ruoyi
* @date 2023-12-22
*/
@Controller
@RequestMapping("/default/imgurl")
public class SysDefaultImgurlController extends BaseController
{
private String prefix = "default/imgurl";
@Autowired
private ISysDefaultImgurlService sysDefaultImgurlService;
@RequiresPermissions("default:imgurl:view")
@GetMapping()
public String imgurl()
{
return prefix + "/imgurl";
}
/**
* 查询设置默认图列表
*/
@RequiresPermissions("default:imgurl:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(SysDefaultImgurl sysDefaultImgurl)
{
startPage();
List<SysDefaultImgurl> list = sysDefaultImgurlService.selectSysDefaultImgurlList(sysDefaultImgurl);
return getDataTable(list);
}
/**
* 导出设置默认图列表
*/
@RequiresPermissions("default:imgurl:export")
@Log(title = "设置默认图", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(SysDefaultImgurl sysDefaultImgurl)
{
List<SysDefaultImgurl> list = sysDefaultImgurlService.selectSysDefaultImgurlList(sysDefaultImgurl);
ExcelUtil<SysDefaultImgurl> util = new ExcelUtil<SysDefaultImgurl>(SysDefaultImgurl.class);
return util.exportExcel(list, "设置默认图数据");
}
/**
* 新增设置默认图
*/
@GetMapping("/add")
public String add()
{
return prefix + "/add";
}
/**
* 新增保存设置默认图
*/
@RequiresPermissions("default:imgurl:add")
@Log(title = "设置默认图", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(SysDefaultImgurl sysDefaultImgurl)
{
return toAjax(sysDefaultImgurlService.insertSysDefaultImgurl(sysDefaultImgurl));
}
/**
* 修改设置默认图
*/
@RequiresPermissions("default:imgurl:edit")
@GetMapping("/edit/{id}")
public String edit(@PathVariable("id") Long id, ModelMap mmap)
{
SysDefaultImgurl sysDefaultImgurl = sysDefaultImgurlService.selectSysDefaultImgurlById(id);
mmap.put("sysDefaultImgurl", sysDefaultImgurl);
return prefix + "/edit";
}
/**
* 修改保存设置默认图
*/
@RequiresPermissions("default:imgurl:edit")
@Log(title = "设置默认图", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(SysDefaultImgurl sysDefaultImgurl)
{
return toAjax(sysDefaultImgurlService.updateSysDefaultImgurl(sysDefaultImgurl));
}
/**
* 删除设置默认图
*/
@RequiresPermissions("default:imgurl:remove")
@Log(title = "设置默认图", businessType = BusinessType.DELETE)
@PostMapping( "/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
return toAjax(sysDefaultImgurlService.deleteSysDefaultImgurlByIds(ids));
}
}
package com.ruoyi.system.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_default_imgurl
*
* @author ruoyi
* @date 2023-12-22
*/
public class SysDefaultImgurl extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
private Long id;
/** 默认图地址 */
@Excel(name = "默认图地址")
private String imgUrl;
/** 描述信息 */
@Excel(name = "描述信息")
private String description;
/** 系统类型 */
@Excel(name = "系统类型")
private Integer systemType;
/** 业务类型 */
@Excel(name = "业务类型")
private Integer bussinessType;
/** 唯一标识 */
@Excel(name = "唯一标识")
private String keyType;
/** 是否启用(0:否 1:是) */
@Excel(name = "是否启用", readConverterExp = "0=:否,1=:是")
private Integer status;
/** 乐观锁 */
@Excel(name = "乐观锁")
private Long version;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setImgUrl(String imgUrl)
{
this.imgUrl = imgUrl;
}
public String getImgUrl()
{
return imgUrl;
}
public void setDescription(String description)
{
this.description = description;
}
public String getDescription()
{
return description;
}
public void setSystemType(Integer systemType)
{
this.systemType = systemType;
}
public Integer getSystemType()
{
return systemType;
}
public void setBussinessType(Integer bussinessType)
{
this.bussinessType = bussinessType;
}
public Integer getBussinessType()
{
return bussinessType;
}
public void setKeyType(String keyType)
{
this.keyType = keyType;
}
public String getKeyType()
{
return keyType;
}
public void setStatus(Integer status)
{
this.status = status;
}
public Integer getStatus()
{
return status;
}
public void setVersion(Long version)
{
this.version = version;
}
public Long getVersion()
{
return version;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("imgUrl", getImgUrl())
.append("description", getDescription())
.append("systemType", getSystemType())
.append("bussinessType", getBussinessType())
.append("keyType", getKeyType())
.append("status", getStatus())
.append("version", getVersion())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.SysDefaultImgurl;
/**
* 设置默认图Mapper接口
*
* @author ruoyi
* @date 2023-12-22
*/
public interface SysDefaultImgurlMapper
{
/**
* 查询设置默认图
*
* @param id 设置默认图主键
* @return 设置默认图
*/
public SysDefaultImgurl selectSysDefaultImgurlById(Long id);
/**
* 查询设置默认图列表
*
* @param sysDefaultImgurl 设置默认图
* @return 设置默认图集合
*/
public List<SysDefaultImgurl> selectSysDefaultImgurlList(SysDefaultImgurl sysDefaultImgurl);
/**
* 新增设置默认图
*
* @param sysDefaultImgurl 设置默认图
* @return 结果
*/
public int insertSysDefaultImgurl(SysDefaultImgurl sysDefaultImgurl);
/**
* 修改设置默认图
*
* @param sysDefaultImgurl 设置默认图
* @return 结果
*/
public int updateSysDefaultImgurl(SysDefaultImgurl sysDefaultImgurl);
/**
* 删除设置默认图
*
* @param id 设置默认图主键
* @return 结果
*/
public int deleteSysDefaultImgurlById(Long id);
/**
* 批量删除设置默认图
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteSysDefaultImgurlByIds(String[] ids);
}
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.SysDefaultImgurl;
/**
* 设置默认图Service接口
*
* @author ruoyi
* @date 2023-12-22
*/
public interface ISysDefaultImgurlService
{
/**
* 查询设置默认图
*
* @param id 设置默认图主键
* @return 设置默认图
*/
public SysDefaultImgurl selectSysDefaultImgurlById(Long id);
/**
* 查询设置默认图列表
*
* @param sysDefaultImgurl 设置默认图
* @return 设置默认图集合
*/
public List<SysDefaultImgurl> selectSysDefaultImgurlList(SysDefaultImgurl sysDefaultImgurl);
/**
* 新增设置默认图
*
* @param sysDefaultImgurl 设置默认图
* @return 结果
*/
public int insertSysDefaultImgurl(SysDefaultImgurl sysDefaultImgurl);
/**
* 修改设置默认图
*
* @param sysDefaultImgurl 设置默认图
* @return 结果
*/
public int updateSysDefaultImgurl(SysDefaultImgurl sysDefaultImgurl);
/**
* 批量删除设置默认图
*
* @param ids 需要删除的设置默认图主键集合
* @return 结果
*/
public int deleteSysDefaultImgurlByIds(String ids);
/**
* 删除设置默认图信息
*
* @param id 设置默认图主键
* @return 结果
*/
public int deleteSysDefaultImgurlById(Long id);
}
package com.ruoyi.system.service.impl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.SysDefaultImgurlMapper;
import com.ruoyi.system.domain.SysDefaultImgurl;
import com.ruoyi.system.service.ISysDefaultImgurlService;
import com.ruoyi.common.core.text.Convert;
/**
* 设置默认图Service业务层处理
*
* @author ruoyi
* @date 2023-12-22
*/
@Service
public class SysDefaultImgurlServiceImpl implements ISysDefaultImgurlService
{
@Autowired
private SysDefaultImgurlMapper sysDefaultImgurlMapper;
/**
* 查询设置默认图
*
* @param id 设置默认图主键
* @return 设置默认图
*/
@Override
public SysDefaultImgurl selectSysDefaultImgurlById(Long id)
{
return sysDefaultImgurlMapper.selectSysDefaultImgurlById(id);
}
/**
* 查询设置默认图列表
*
* @param sysDefaultImgurl 设置默认图
* @return 设置默认图
*/
@Override
public List<SysDefaultImgurl> selectSysDefaultImgurlList(SysDefaultImgurl sysDefaultImgurl)
{
return sysDefaultImgurlMapper.selectSysDefaultImgurlList(sysDefaultImgurl);
}
/**
* 新增设置默认图
*
* @param sysDefaultImgurl 设置默认图
* @return 结果
*/
@Override
public int insertSysDefaultImgurl(SysDefaultImgurl sysDefaultImgurl)
{
sysDefaultImgurl.setCreateTime(DateUtils.getNowDate());
return sysDefaultImgurlMapper.insertSysDefaultImgurl(sysDefaultImgurl);
}
/**
* 修改设置默认图
*
* @param sysDefaultImgurl 设置默认图
* @return 结果
*/
@Override
public int updateSysDefaultImgurl(SysDefaultImgurl sysDefaultImgurl)
{
sysDefaultImgurl.setUpdateTime(DateUtils.getNowDate());
return sysDefaultImgurlMapper.updateSysDefaultImgurl(sysDefaultImgurl);
}
/**
* 批量删除设置默认图
*
* @param ids 需要删除的设置默认图主键
* @return 结果
*/
@Override
public int deleteSysDefaultImgurlByIds(String ids)
{
return sysDefaultImgurlMapper.deleteSysDefaultImgurlByIds(Convert.toStrArray(ids));
}
/**
* 删除设置默认图信息
*
* @param id 设置默认图主键
* @return 结果
*/
@Override
public int deleteSysDefaultImgurlById(Long id)
{
return sysDefaultImgurlMapper.deleteSysDefaultImgurlById(id);
}
}
<?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.system.mapper.SysDefaultImgurlMapper">
<resultMap type="SysDefaultImgurl" id="SysDefaultImgurlResult">
<result property="id" column="id" />
<result property="imgUrl" column="img_url" />
<result property="description" column="description" />
<result property="systemType" column="system_type" />
<result property="bussinessType" column="bussiness_type" />
<result property="keyType" column="key_type" />
<result property="status" column="status" />
<result property="version" column="version" />
<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="selectSysDefaultImgurlVo">
select id, img_url, description, system_type, bussiness_type, key_type, status, version, create_by, create_time, update_by, update_time from sys_default_imgurl
</sql>
<select id="selectSysDefaultImgurlList" parameterType="SysDefaultImgurl" resultMap="SysDefaultImgurlResult">
<include refid="selectSysDefaultImgurlVo"/>
<where>
<if test="imgUrl != null and imgUrl != ''"> and img_url = #{imgUrl}</if>
<if test="description != null and description != ''"> and description = #{description}</if>
<if test="systemType != null "> and system_type = #{systemType}</if>
<if test="bussinessType != null "> and bussiness_type = #{bussinessType}</if>
<if test="keyType != null and keyType != ''"> and key_type = #{keyType}</if>
<if test="status != null "> and status = #{status}</if>
<if test="version != null "> and version = #{version}</if>
</where>
</select>
<select id="selectSysDefaultImgurlById" parameterType="Long" resultMap="SysDefaultImgurlResult">
<include refid="selectSysDefaultImgurlVo"/>
where id = #{id}
</select>
<insert id="insertSysDefaultImgurl" parameterType="SysDefaultImgurl" useGeneratedKeys="true" keyProperty="id">
insert into sys_default_imgurl
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="imgUrl != null">img_url,</if>
<if test="description != null">description,</if>
<if test="systemType != null">system_type,</if>
<if test="bussinessType != null">bussiness_type,</if>
<if test="keyType != null">key_type,</if>
<if test="status != null">status,</if>
<if test="version != null">version,</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="imgUrl != null">#{imgUrl},</if>
<if test="description != null">#{description},</if>
<if test="systemType != null">#{systemType},</if>
<if test="bussinessType != null">#{bussinessType},</if>
<if test="keyType != null">#{keyType},</if>
<if test="status != null">#{status},</if>
<if test="version != null">#{version},</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="updateSysDefaultImgurl" parameterType="SysDefaultImgurl">
update sys_default_imgurl
<trim prefix="SET" suffixOverrides=",">
<if test="imgUrl != null">img_url = #{imgUrl},</if>
<if test="description != null">description = #{description},</if>
<if test="systemType != null">system_type = #{systemType},</if>
<if test="bussinessType != null">bussiness_type = #{bussinessType},</if>
<if test="keyType != null">key_type = #{keyType},</if>
<if test="status != null">status = #{status},</if>
<if test="version != null">version = #{version},</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 id = #{id}
</update>
<delete id="deleteSysDefaultImgurlById" parameterType="Long">
delete from sys_default_imgurl where id = #{id}
</delete>
<delete id="deleteSysDefaultImgurlByIds" parameterType="String">
delete from sys_default_imgurl where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
\ No newline at end of file
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('新增设置默认图')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-imgurl-add">
<div class="form-group">
<label class="col-sm-3 control-label">默认图地址:</label>
<div class="col-sm-8">
<input name="imgUrl" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">描述信息:</label>
<div class="col-sm-8">
<input name="description" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">乐观锁:</label>
<div class="col-sm-8">
<input name="version" class="form-control" type="text">
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var prefix = ctx + "default/imgurl"
$("#form-imgurl-add").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-imgurl-add').serialize());
}
}
</script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('修改设置默认图')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-imgurl-edit" th:object="${sysDefaultImgurl}">
<input name="id" th:field="*{id}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label">默认图地址:</label>
<div class="col-sm-8">
<input name="imgUrl" th:field="*{imgUrl}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">描述信息:</label>
<div class="col-sm-8">
<input name="description" th:field="*{description}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">乐观锁:</label>
<div class="col-sm-8">
<input name="version" th:field="*{version}" class="form-control" type="text">
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var prefix = ctx + "default/imgurl";
$("#form-imgurl-edit").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/edit", $('#form-imgurl-edit').serialize());
}
}
</script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('设置默认图列表')" />
</head>
<body class="gray-bg">
<div class="container-div">
<div class="row">
<div class="col-sm-12 search-collapse">
<form id="formId">
<div class="select-list">
<ul>
<!-- <li>-->
<!-- <label>描述信息:</label>-->
<!-- <input type="text" name="description"/>-->
<!-- </li>-->
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
</li>
</ul>
</div>
</form>
</div>
<div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="default:imgurl:add">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="default:imgurl:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="default:imgurl:remove">
<i class="fa fa-remove"></i> 删除
</a>
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="default:imgurl:export">
<i class="fa fa-download"></i> 导出
</a>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('default:imgurl:edit')}]];
var removeFlag = [[${@permission.hasPermi('default:imgurl:remove')}]];
var type = [[${@dict.getType('lyy_channel_source')}]];
var datasType = [[${@dict.getType('business_type')}]];
var prefix = ctx + "default/imgurl";
$(function() {
var options = {
url: prefix + "/list",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
modalName: "设置默认图",
columns: [{
checkbox: true
},
{
field: 'id',
title: '主键',
visible: false
},
{
field: 'imgUrl',
title: '默认图',
formatter: function (value, row, index) {
var actions = [];
actions.push('<img style="width:100px;height:100px" src=' + value + '>');
return actions.join('');
},
},
{
field: 'description',
title: '描述信息'
},
{
field: 'systemType',
title: '使用场景',
formatter: function (value, row, index) {
return $.table.selectDictLabel(type, value);
}
},
{
field: 'bussinessType',
title: '业务类型',
formatter: function (value, row, index) {
return $.table.selectDictLabel(datasType, value);
}
},
{
field: 'keyType',
title: '唯一标识'
},
{
field: 'status',
title: '是否启用',
formatter: function (value, row, index) {
return value===1?"是":"否";
}
},
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}
}]
};
$.table.init(options);
});
</script>
</body>
</html>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment