Merge remote-tracking branch 'origin/master'

master
夜笙歌 3 years ago
commit bec00bc136

@ -1,21 +1,29 @@
package com.ruoyi.web.controller.broad;
import com.alibaba.fastjson.JSONArray;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.system.domain.BasePictureLocation;
import com.ruoyi.system.service.IBasePictureLocationService;
import com.ruoyi.system.service.IBaseUserManyiduService;
import com.ruoyi.system.service.IBroadDataService;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
/**
*
*/
@Controller
@RequestMapping("/broad/month")
@ApiOperation("月看板")
@ResponseBody
public class MouthController {
@Autowired
@ -38,8 +46,19 @@ public class MouthController {
return JSONArray.toJSONString( baseUserManyiduService.yue_selectUserSatisfaction());
}
@Autowired
private IBasePictureLocationService basePictureLocationService;
/**
*
*/
@PostMapping("/selectHighlightProducts")
@ApiOperation("亮点产品")
public String yue_selectHighlightProducts() {
return JSONArray.toJSONString(basePictureLocationService.selectBasePictureLocationList(null));
}
}

@ -1,6 +1,10 @@
package com.ruoyi.system.controller;
import java.io.IOException;
import java.util.List;
import com.ruoyi.common.config.Global;
import com.ruoyi.common.utils.file.FileUploadUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
@ -18,6 +22,7 @@ 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;
import org.springframework.web.multipart.MultipartFile;
/**
* Controller
@ -27,6 +32,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
*/
@Controller
@RequestMapping("/system/base_picture_location")
@ResponseBody
public class BasePictureLocationController extends BaseController
{
private String prefix = "system/base_picture_location";
@ -46,7 +52,7 @@ public class BasePictureLocationController extends BaseController
*/
@RequiresPermissions("system:base_picture_location:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(BasePictureLocation basePictureLocation)
{
startPage();
@ -84,9 +90,23 @@ public class BasePictureLocationController extends BaseController
@Log(title = "亮点产品维护", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(BasePictureLocation basePictureLocation)
public AjaxResult addSave(MultipartFile file, BasePictureLocation basePictureLocation)
{
return toAjax(basePictureLocationService.insertBasePictureLocation(basePictureLocation));
int tag=basePictureLocationService.countBasePictureLocation(basePictureLocation.getPictureLocation());
if (tag>0){
return error("当前位置已有图片");
}
String filePath = Global.getUploadPath();
try {
String pathName = FileUploadUtils.upload(filePath, file);
basePictureLocation.setPicturePath(pathName);
return toAjax(basePictureLocationService.insertBasePictureLocation(basePictureLocation));
} catch (IOException e) {
e.printStackTrace();
}
return error();
}
/**

@ -58,4 +58,6 @@ public interface BasePictureLocationMapper
* @return
*/
public int deleteBasePictureLocationByIds(String[] ids);
int countBasePictureLocation(Long pictureLocation);
}

@ -58,4 +58,6 @@ public interface IBasePictureLocationService
* @return
*/
public int deleteBasePictureLocationById(Long id);
int countBasePictureLocation(Long pictureLocation);
}

@ -91,4 +91,9 @@ public class BasePictureLocationServiceImpl implements IBasePictureLocationServi
{
return basePictureLocationMapper.deleteBasePictureLocationById(id);
}
@Override
public int countBasePictureLocation(Long pictureLocation) {
return basePictureLocationMapper.countBasePictureLocation(pictureLocation);
}
}

@ -14,6 +14,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select id, picture_path, picture_location from base_picture_location
</sql>
<select id="countBasePictureLocation" resultType="integer">
select count(id) from base_picture_location where picture_location= #{pictureLocation}
</select>
<select id="selectBasePictureLocationList" parameterType="BasePictureLocation" resultMap="BasePictureLocationResult">
<include refid="selectBasePictureLocationVo"/>
<where>

@ -2,20 +2,32 @@
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('新增亮点产品维护')" />
<th:block th:include="include :: datetimepicker-css"/>
<th:block th:include="include :: jasny-bootstrap-css"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-base_picture_location-add">
<div class="form-group">
<label class="col-sm-3 control-label">图片路径:</label>
<div class="col-sm-8">
<input name="picturePath" class="form-control" type="text">
<div class="fileinput fileinput-new" data-provides="fileinput">
<div class="fileinput-new thumbnail" style="width: 240px; height: 240px;">
<img alt="选择图片">
</div>
<div class="fileinput-preview fileinput-exists thumbnail"
style="max-width: 340px; max-height: 340px;"></div>
<div>
<span class="btn btn-white btn-file"><span class="fileinput-new">选择图片</span><span
class="fileinput-exists">更改</span>
<input type="file" id="imagepath" name="imagepath"></span>
<a href="#" class="btn btn-white fileinput-exists" data-dismiss="fileinput">清除</a>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">显示位置:</label>
<div class="col-sm-8">
<select name="pictureLocation" class="form-control m-b" th:with="type=${@dict.getType('picture_location')}">
<select name="pictureLocation" id="pictureLocation" class="form-control m-b" th:with="type=${@dict.getType('picture_location')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</div>
@ -23,6 +35,8 @@
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js"/>
<th:block th:include="include :: jasny-bootstrap-js"/>
<script th:inline="javascript">
var prefix = ctx + "system/base_picture_location"
$("#form-base_picture_location-add").validate({
@ -30,9 +44,27 @@
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-base_picture_location-add').serialize());
}
// if ($.validate.form()) {
// $.operate.save(prefix + "/add", $('#form-base_picture_location-add').serialize());
// }
var formData = new FormData();
formData.append('file', $('#imagepath')[0].files[0]);
var select=document.getElementById('pictureLocation');
var res_value=select.value;
formData.append('pictureLocation',res_value);
$.ajax({
url: prefix + "/add",
type: 'post',
cache: false,
data: formData,
processData: false,
contentType: false,
dataType: "json",
success: function(result) {
$.operate.successCallback(result);
}
});
}
</script>
</body>

@ -6,32 +6,30 @@
<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>
<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="col-sm-12 search-collapse">-->
<!-- <form id="formId">-->
<!-- <div class="select-list">-->
<!-- <ul>-->
<!-- <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="system:base_picture_location:add">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:base_picture_location:edit">
<i class="fa fa-edit"></i> 修改
</a>
<!-- <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:base_picture_location:edit">-->
<!-- <i class="fa fa-edit"></i> 修改-->
<!-- </a>-->
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:base_picture_location:remove">
<i class="fa fa-remove"></i> 删除
</a>
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:base_picture_location:export">
<i class="fa fa-download"></i> 导出
</a>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
@ -53,6 +51,8 @@
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
modalName: "亮点产品维护",
sortOrder:'asc',
sortName:'pictureLocation',
columns: [{
checkbox: true
},
@ -63,7 +63,10 @@
},
{
field: 'picturePath',
title: '图片路径'
title: '图片',
formatter: function (value, row, index) {
return $.table.imageView(value, 324);
}
},
{
field: 'pictureLocation',
@ -77,7 +80,7 @@
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-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('');
}

@ -9,8 +9,19 @@
<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="picturePath" th:field="*{picturePath}" class="form-control" type="text">
<!-- <div class="col-sm-8">-->
<!-- <input name="picturePath" th:field="*{picturePath}" class="form-control" type="text">-->
<!-- </div>-->
<div class="fileinput fileinput-new" data-provides="fileinput">
<div class="fileinput-new thumbnail" style="width: 140px; height: 140px;">
<img th:src="*{picturePath}">
</div>
<div class="fileinput-preview fileinput-exists thumbnail" style="max-width: 200px; max-height: 150px;"></div>
<div>
<span class="btn btn-white btn-file"><span class="fileinput-new">选择图片</span><span class="fileinput-exists">更改</span><input type="file" id="imagepath" name="imagepath" th:field="*{imagepath}" ></span>
<input type="hidden" id="image" name="imagepath" th:value="${picturePath}" >
<a href="#" class="btn btn-white fileinput-exists" data-dismiss="fileinput">清除</a>
</div>
</div>
</div>
<div class="form-group">

Loading…
Cancel
Save