Commit cc9c67cd by RuoYi

若依2.2版本发布

parent 9e8d80a6
......@@ -5,7 +5,7 @@
<groupId>com.ruoyi</groupId>
<artifactId>RuoYi</artifactId>
<version>2.1.0</version>
<version>2.2.0</version>
<packaging>jar</packaging>
<name>RuoYi</name>
......
......@@ -14,20 +14,16 @@ public class BusinessType
public static final String INSERT = "1";
/** 修改 */
public static final String UPDATE = "2";
/** 保存 */
public static final String SAVE = "3";
/** 删除 */
public static final String DELETE = "4";
public static final String DELETE = "3";
/** 授权 */
public static final String GRANT = "5";
public static final String GRANT = "4";
/** 导出 */
public static final String EXPORT = "6";
public static final String EXPORT = "5";
/** 导入 */
public static final String IMPORT = "7";
public static final String IMPORT = "6";
/** 强退 */
public static final String FORCE = "8";
/** 禁止访问 */
public static final String FORBID = "9";
public static final String FORCE = "7";
/** 生成代码 */
public static final String GENCODE = "10";
public static final String GENCODE = "8";
}
......@@ -122,7 +122,7 @@ public class LoginService
{
user.setLoginIp(ShiroUtils.getIp());
user.setLoginDate(DateUtils.getNowDate());
userService.updateUser(user);
userService.updateUserInfo(user);
}
}
......@@ -62,6 +62,17 @@ public class BaseController
}
/**
* 响应返回结果
*
* @param rows 影响行数
* @return 操作结果
*/
protected AjaxResult toAjax(int rows)
{
return rows > 0 ? success() : error();
}
/**
* 返回成功
*/
public AjaxResult success()
......
package com.ruoyi.framework.web.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import com.ruoyi.project.system.config.service.IConfigService;
/**
......@@ -9,7 +9,7 @@ import com.ruoyi.project.system.config.service.IConfigService;
*
* @author ruoyi
*/
@Component
@Service("config")
public class ConfigService
{
@Autowired
......@@ -21,7 +21,7 @@ public class ConfigService
* @param configName 参数名称
* @return 参数键值
*/
public String selectConfigByKey(String configKey)
public String getKey(String configKey)
{
return configService.selectConfigByKey(configKey);
}
......
......@@ -2,7 +2,7 @@ package com.ruoyi.framework.web.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import com.ruoyi.project.system.dict.domain.DictData;
import com.ruoyi.project.system.dict.service.IDictDataService;
......@@ -11,7 +11,7 @@ import com.ruoyi.project.system.dict.service.IDictDataService;
*
* @author ruoyi
*/
@Component
@Service("dict")
public class DictService
{
@Autowired
......@@ -23,8 +23,20 @@ public class DictService
* @param dictType 字典类型
* @return 参数键值
*/
public List<DictData> selectDictData(String dictType)
public List<DictData> getType(String dictType)
{
return dictDataService.selectDictDataByType(dictType);
}
/**
* 根据字典类型和字典键值查询字典数据信息
*
* @param dictType 字典类型
* @param dictValue 字典键值
* @return 字典标签
*/
public String getLabel(String dictType, String dictValue)
{
return dictDataService.selectDictLabel(dictType, dictValue);
}
}
package com.ruoyi.framework.shiro.service;
package com.ruoyi.framework.web.service;
import org.apache.shiro.SecurityUtils;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
/**
* RuoYi首创 js调用 thymeleaf 实现按钮权限可见性
*
* @author ruoyi
*/
@Component
@Service("permission")
public class PermissionService
{
public String hasPermi(String permission)
......
......@@ -2,12 +2,15 @@ package com.ruoyi.project.common;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.util.ResourceUtils;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -20,10 +23,14 @@ import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class CommonController
{
private static final Logger log = LoggerFactory.getLogger(CommonController.class);
@RequestMapping("common/download")
public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request)
{
String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1);
InputStream inputStream = null;
OutputStream os = null;
try
{
String filePath = ResourceUtils.getURL("classpath:").getPath() + "static/file/" + fileName;
......@@ -32,16 +39,14 @@ public class CommonController
response.setContentType("multipart/form-data");
response.setHeader("Content-Disposition", "attachment;fileName=" + setFileDownloadHeader(request, realFileName));
File file = new File(filePath);
InputStream inputStream = new FileInputStream(file);
OutputStream os = response.getOutputStream();
inputStream = new FileInputStream(file);
os = response.getOutputStream();
byte[] b = new byte[1024];
int length;
while ((length = inputStream.read(b)) > 0)
{
os.write(b, 0, length);
}
os.close();
inputStream.close();
if (delete && file.exists())
{
file.delete();
......@@ -49,7 +54,19 @@ public class CommonController
}
catch (Exception e)
{
e.printStackTrace();
log.error("下载文件失败", e);
}
finally
{
try
{
os.close();
inputStream.close();
}
catch (IOException e)
{
log.error("close close fail ", e);
}
}
}
......
......@@ -4,7 +4,7 @@ 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.Model;
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;
......@@ -94,13 +94,9 @@ public class JobController extends BaseController
@ResponseBody
public AjaxResult changeStatus(Job job)
{
if (jobService.changeStatus(job) > 0)
{
return success();
}
return error();
return toAjax(jobService.changeStatus(job));
}
/**
* 任务调度立即执行一次
*/
......@@ -110,50 +106,49 @@ public class JobController extends BaseController
@ResponseBody
public AjaxResult run(Job job)
{
if (jobService.run(job) > 0)
{
return success();
}
return error();
return toAjax(jobService.run(job));
}
/**
* 新增调度
*/
@Log(title = "定时任务", action = BusinessType.INSERT)
@RequiresPermissions("monitor:job:add")
@GetMapping("/add")
public String add(Model model)
public String add()
{
return prefix + "/add";
}
/**
* 新增保存调度
*/
@Log(title = "定时任务", action = BusinessType.INSERT)
@RequiresPermissions("monitor:job:add")
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(Job job)
{
return toAjax(jobService.insertJobCron(job));
}
/**
* 修改调度
*/
@Log(title = "定时任务", action = BusinessType.UPDATE)
@RequiresPermissions("monitor:job:edit")
@GetMapping("/edit/{jobId}")
public String edit(@PathVariable("jobId") Long jobId, Model model)
public String edit(@PathVariable("jobId") Long jobId, ModelMap mmap)
{
Job job = jobService.selectJobById(jobId);
model.addAttribute("job", job);
mmap.put("job", jobService.selectJobById(jobId));
return prefix + "/edit";
}
/**
* 保存调度
* 修改保存调度
*/
@Log(title = "定时任务", action = BusinessType.SAVE)
@RequiresPermissions("monitor:job:save")
@PostMapping("/save")
@Log(title = "定时任务", action = BusinessType.UPDATE)
@RequiresPermissions("monitor:job:edit")
@PostMapping("/edit")
@ResponseBody
public AjaxResult save(Job job)
public AjaxResult editSave(Job job)
{
if (jobService.saveJobCron(job) > 0)
{
return success();
}
return error();
return toAjax(jobService.updateJobCron(job));
}
}
......@@ -71,15 +71,6 @@ public class JobLogController extends BaseController
@ResponseBody
public AjaxResult remove(String ids)
{
try
{
jobLogService.deleteJobLogByIds(ids);
return success();
}
catch (Exception e)
{
e.printStackTrace();
return error(e.getMessage());
}
return toAjax(jobLogService.deleteJobLogByIds(ids));
}
}
......@@ -66,7 +66,7 @@ public interface IJobService
* @return 结果
*/
public int changeStatus(Job job);
/**
* 立即运行任务
*
......@@ -81,7 +81,7 @@ public interface IJobService
* @param job 调度信息
* @return 结果
*/
public int addJobCron(Job job);
public int insertJobCron(Job job);
/**
* 更新任务的时间表达式
......@@ -91,11 +91,4 @@ public interface IJobService
*/
public int updateJobCron(Job job);
/**
* 保存任务的时间表达式
*
* @param job 调度信息
* @return 结果
*/
public int saveJobCron(Job job);
}
......@@ -12,7 +12,7 @@ import com.ruoyi.project.monitor.job.mapper.JobLogMapper;
*
* @author ruoyi
*/
@Service("jobLogService")
@Service
public class JobLogServiceImpl implements IJobLogService
{
......
package com.ruoyi.project.monitor.job.service;
import java.util.List;
import javax.annotation.PostConstruct;
import org.quartz.CronTrigger;
import org.quartz.Scheduler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.common.constant.ScheduleConstants;
import com.ruoyi.common.support.Convert;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.security.ShiroUtils;
import com.ruoyi.project.monitor.job.domain.Job;
import com.ruoyi.project.monitor.job.mapper.JobMapper;
......@@ -22,7 +18,7 @@ import com.ruoyi.project.monitor.job.util.ScheduleUtils;
*
* @author ruoyi
*/
@Service("jobService")
@Service
public class JobServiceImpl implements IJobService
{
@Autowired
......@@ -166,7 +162,7 @@ public class JobServiceImpl implements IJobService
}
return rows;
}
/**
* 立即运行任务
*
......@@ -184,7 +180,7 @@ public class JobServiceImpl implements IJobService
* @param job 调度信息 调度信息
*/
@Override
public int addJobCron(Job job)
public int insertJobCron(Job job)
{
job.setCreateBy(ShiroUtils.getLoginName());
job.setStatus(ScheduleConstants.Status.PAUSE.getValue());
......@@ -204,6 +200,7 @@ public class JobServiceImpl implements IJobService
@Override
public int updateJobCron(Job job)
{
job.setUpdateBy(ShiroUtils.getLoginName());
int rows = jobMapper.updateJob(job);
if (rows > 0)
{
......@@ -212,25 +209,4 @@ public class JobServiceImpl implements IJobService
return rows;
}
/**
* 保存任务的时间表达式
*
* @param job 调度信息
*/
@Override
public int saveJobCron(Job job)
{
Long jobId = job.getJobId();
int rows = 0;
if (StringUtils.isNotNull(jobId))
{
rows = updateJobCron(job);
}
else
{
rows = addJobCron(job);
}
return rows;
}
}
......@@ -71,11 +71,6 @@ public class LogininforController extends BaseController
@ResponseBody
public AjaxResult remove(String ids)
{
int rows = logininforService.deleteLogininforByIds(ids);
if (rows > 0)
{
return success();
}
return error();
return toAjax(logininforService.deleteLogininforByIds(ids));
}
}
......@@ -14,7 +14,7 @@ public class Logininfor extends BaseEntity
private static final long serialVersionUID = 1L;
/** ID */
@Excel(name = "序号")
private Integer infoId;
private Long infoId;
/** 用户账号 */
@Excel(name = "用户账号")
private String loginName;
......@@ -40,12 +40,12 @@ public class Logininfor extends BaseEntity
@Excel(name = "访问时间")
private Date loginTime;
public Integer getInfoId()
public Long getInfoId()
{
return infoId;
}
public void setInfoId(Integer infoId)
public void setInfoId(Long infoId)
{
this.infoId = infoId;
}
......
......@@ -12,7 +12,7 @@ import com.ruoyi.project.monitor.logininfor.mapper.LogininforMapper;
*
* @author ruoyi
*/
@Service("logininforService")
@Service
public class LogininforServiceImpl implements ILogininforService
{
......
......@@ -15,7 +15,7 @@ import com.ruoyi.project.monitor.online.mapper.UserOnlineMapper;
*
* @author ruoyi
*/
@Service("userOnlineService")
@Service
public class UserOnlineServiceImpl implements IUserOnlineService
{
@Autowired
......
......@@ -4,7 +4,7 @@ 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.Model;
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;
......@@ -72,20 +72,14 @@ public class OperlogController extends BaseController
@ResponseBody
public AjaxResult remove(String ids)
{
int rows = operLogService.deleteOperLogByIds(ids);
if (rows > 0)
{
return success();
}
return error();
return toAjax(operLogService.deleteOperLogByIds(ids));
}
@RequiresPermissions("monitor:operlog:detail")
@GetMapping("/detail/{operId}")
public String detail(@PathVariable("operId") Long deptId, Model model)
public String detail(@PathVariable("operId") Long deptId, ModelMap mmap)
{
OperLog operLog = operLogService.selectOperLogById(deptId);
model.addAttribute("operLog", operLog);
mmap.put("operLog", operLogService.selectOperLogById(deptId));
return prefix + "/detail";
}
}
......@@ -16,7 +16,7 @@ public class OperLog extends BaseEntity
/** 日志主键 */
@Excel(name = "操作序号")
private Integer operId;
private Long operId;
/** 操作模块 */
@Excel(name = "操作模块")
......@@ -70,12 +70,12 @@ public class OperLog extends BaseEntity
@Excel(name = "操作时间")
private Date operTime;
public Integer getOperId()
public Long getOperId()
{
return operId;
}
public void setOperId(Integer operId)
public void setOperId(Long operId)
{
this.operId = operId;
}
......
......@@ -12,7 +12,7 @@ import com.ruoyi.project.monitor.operlog.mapper.OperLogMapper;
*
* @author ruoyi
*/
@Service("operLogService")
@Service
public class OperLogServiceImpl implements IOperLogService
{
@Autowired
......
......@@ -4,7 +4,7 @@ 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.Model;
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;
......@@ -35,7 +35,7 @@ public class ConfigController extends BaseController
@RequiresPermissions("system:config:view")
@GetMapping()
public String index()
public String config()
{
return prefix + "/config";
}
......@@ -52,7 +52,6 @@ public class ConfigController extends BaseController
List<Config> list = configService.selectConfigList(config);
return getDataTable(list);
}
@Log(title = "参数管理", action = BusinessType.EXPORT)
@PostMapping("/export")
......@@ -74,8 +73,6 @@ public class ConfigController extends BaseController
/**
* 新增参数配置
*/
@RequiresPermissions("system:config:add")
@Log(title = "参数管理", action = BusinessType.INSERT)
@GetMapping("/add")
public String add()
{
......@@ -83,32 +80,37 @@ public class ConfigController extends BaseController
}
/**
* 新增保存参数配置
*/
@RequiresPermissions("system:config:add")
@Log(title = "参数管理", action = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(Config config)
{
return toAjax(configService.insertConfig(config));
}
/**
* 修改参数配置
*/
@RequiresPermissions("system:config:edit")
@Log(title = "参数管理", action = BusinessType.UPDATE)
@GetMapping("/edit/{configId}")
public String edit(@PathVariable("configId") Integer configId, Model model)
public String edit(@PathVariable("configId") Long configId, ModelMap mmap)
{
Config config = configService.selectConfigById(configId);
model.addAttribute("config", config);
mmap.addAttribute("config", configService.selectConfigById(configId));
return prefix + "/edit";
}
/**
* 保存参数配置
* 修改保存参数配置
*/
@RequiresPermissions("system:config:save")
@Log(title = "参数管理", action = BusinessType.SAVE)
@PostMapping("/save")
@RequiresPermissions("system:config:edit")
@Log(title = "参数管理", action = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult save(Config config)
public AjaxResult editSave(Config config)
{
if (configService.saveConfig(config) > 0)
{
return success();
}
return error();
return toAjax(configService.updateConfig(config));
}
/**
......@@ -120,11 +122,7 @@ public class ConfigController extends BaseController
@ResponseBody
public AjaxResult remove(String ids)
{
if (configService.deleteConfigByIds(ids) > 0)
{
return success();
}
return error();
return toAjax(configService.deleteConfigByIds(ids));
}
/**
......
......@@ -14,7 +14,7 @@ public class Config extends BaseEntity
/** 参数主键 */
@Excel(name = "参数主键")
private Integer configId;
private Long configId;
/** 参数名称 */
@Excel(name = "参数名称")
......@@ -32,12 +32,12 @@ public class Config extends BaseEntity
@Excel(name = "系统内置")
private String configType;
public Integer getConfigId()
public Long getConfigId()
{
return configId;
}
public void setConfigId(Integer configId)
public void setConfigId(Long configId)
{
this.configId = configId;
}
......
......@@ -10,22 +10,13 @@ import java.util.List;
*/
public interface ConfigMapper
{
/**
* 查询参数配置信息
*
* @param configId 参数配置ID
* @return 参数配置信息
*/
public Config selectConfigById(Integer configId);
/**
* 根据键名查询参数配置信息
*
* @param configKey 参数键名
* @param configId 参数配置信息
* @return 参数配置信息
*/
public Config selectConfigByKey(String configKey);
public Config selectConfig(Config config);
/**
* 查询参数配置列表
......@@ -36,6 +27,14 @@ public interface ConfigMapper
public List<Config> selectConfigList(Config config);
/**
* 根据键名查询参数配置信息
*
* @param configKey 参数键名
* @return 参数配置信息
*/
public Config checkConfigKeyUnique(String configKey);
/**
* 新增参数配置
*
* @param config 参数配置信息
......@@ -52,14 +51,6 @@ public interface ConfigMapper
public int updateConfig(Config config);
/**
* 删除参数配置
*
* @param configId 参数配置ID
* @return 结果
*/
public int deleteConfigById(Integer configId);
/**
* 批量删除参数配置
*
* @param configIds 需要删除的数据ID
......
......@@ -6,6 +6,7 @@ import org.springframework.stereotype.Service;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.support.Convert;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.security.ShiroUtils;
import com.ruoyi.project.system.config.domain.Config;
import com.ruoyi.project.system.config.mapper.ConfigMapper;
......@@ -27,9 +28,11 @@ public class ConfigServiceImpl implements IConfigService
* @return 参数配置信息
*/
@Override
public Config selectConfigById(Integer configId)
public Config selectConfigById(Long configId)
{
return configMapper.selectConfigById(configId);
Config config = new Config();
config.setConfigId(configId);
return configMapper.selectConfig(config);
}
/**
......@@ -41,8 +44,10 @@ public class ConfigServiceImpl implements IConfigService
@Override
public String selectConfigByKey(String configKey)
{
Config config = configMapper.selectConfigByKey(configKey);
return StringUtils.isNotNull(config) ? config.getConfigValue() : "";
Config config = new Config();
config.setConfigKey(configKey);
Config retConfig = configMapper.selectConfig(config);
return StringUtils.isNotNull(retConfig) ? retConfig.getConfigValue() : "";
}
/**
......@@ -66,6 +71,7 @@ public class ConfigServiceImpl implements IConfigService
@Override
public int insertConfig(Config config)
{
config.setCreateBy(ShiroUtils.getLoginName());
return configMapper.insertConfig(config);
}
......@@ -78,44 +84,11 @@ public class ConfigServiceImpl implements IConfigService
@Override
public int updateConfig(Config config)
{
config.setUpdateBy(ShiroUtils.getLoginName());
return configMapper.updateConfig(config);
}
/**
* 保存参数配置
*
* @param config 参数配置信息
* @return 结果
*/
@Override
public int saveConfig(Config config)
{
Integer configId = config.getConfigId();
int rows = 0;
if (StringUtils.isNotNull(configId))
{
rows = configMapper.updateConfig(config);
}
else
{
rows = configMapper.insertConfig(config);
}
return rows;
}
/**
* 删除参数配置信息
*
* @param configId 参数配置ID
* @return 结果
*/
@Override
public int deleteConfigById(Integer configId)
{
return configMapper.deleteConfigById(configId);
}
/**
* 批量删除参数配置对象
*
* @param configIds 需要删除的数据ID
......@@ -136,14 +109,9 @@ public class ConfigServiceImpl implements IConfigService
@Override
public String checkConfigKeyUnique(Config config)
{
if (config.getConfigId() == null)
{
config.setConfigId(-1);
}
Integer configId = config.getConfigId();
Config info = configMapper.selectConfigByKey(config.getConfigKey());
if (StringUtils.isNotNull(info) && StringUtils.isNotNull(info.getConfigId())
&& info.getConfigId().intValue() != configId.intValue())
Long configId = StringUtils.isNull(config.getConfigId()) ? -1L : config.getConfigId();
Config info = configMapper.checkConfigKeyUnique(config.getConfigKey());
if (StringUtils.isNotNull(info) && info.getConfigId().longValue() != configId.longValue())
{
return UserConstants.CONFIG_KEY_NOT_UNIQUE;
}
......
......@@ -17,7 +17,7 @@ public interface IConfigService
* @param configId 参数配置ID
* @return 参数配置信息
*/
public Config selectConfigById(Integer configId);
public Config selectConfigById(Long configId);
/**
* 根据键名查询参数配置信息
......@@ -52,22 +52,6 @@ public interface IConfigService
public int updateConfig(Config config);
/**
* 保存参数配置
*
* @param config 参数配置信息
* @return 结果
*/
public int saveConfig(Config config);
/**
* 删除参数配置信息
*
* @param configId 参数配置ID
* @return 结果
*/
public int deleteConfigById(Integer configId);
/**
* 批量删除参数配置信息
*
* @param ids 需要删除的数据ID
......
......@@ -5,7 +5,7 @@ import java.util.Map;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
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;
......@@ -49,45 +49,47 @@ public class DeptController extends BaseController
}
/**
* 修改
* 新增部门
*/
@Log(title = "部门管理", action = BusinessType.UPDATE)
@RequiresPermissions("system:dept:edit")
@GetMapping("/edit/{deptId}")
public String edit(@PathVariable("deptId") Long deptId, Model model)
@GetMapping("/add/{parentId}")
public String add(@PathVariable("parentId") Long parentId, ModelMap mmap)
{
Dept dept = deptService.selectDeptById(deptId);
model.addAttribute("dept", dept);
return prefix + "/edit";
mmap.put("dept", deptService.selectDeptById(parentId));
return prefix + "/add";
}
/**
* 新增
* 新增保存部门
*/
@Log(title = "部门管理", action = BusinessType.INSERT)
@RequiresPermissions("system:dept:add")
@GetMapping("/add/{parentId}")
public String add(@PathVariable("parentId") Long parentId, Model model)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(Dept dept)
{
Dept dept = deptService.selectDeptById(parentId);
model.addAttribute("dept", dept);
return prefix + "/add";
return toAjax(deptService.insertDept(dept));
}
/**
* 修改
*/
@GetMapping("/edit/{deptId}")
public String edit(@PathVariable("deptId") Long deptId, ModelMap mmap)
{
mmap.put("dept", deptService.selectDeptById(deptId));
return prefix + "/edit";
}
/**
* 保存
*/
@Log(title = "部门管理", action = BusinessType.SAVE)
@RequiresPermissions("system:dept:save")
@PostMapping("/save")
@Log(title = "部门管理", action = BusinessType.UPDATE)
@RequiresPermissions("system:dept:edit")
@PostMapping("/edit")
@ResponseBody
public AjaxResult save(Dept dept)
public AjaxResult editSave(Dept dept)
{
if (deptService.saveDept(dept) > 0)
{
return success();
}
return error();
return toAjax(deptService.updateDept(dept));
}
/**
......@@ -107,11 +109,7 @@ public class DeptController extends BaseController
{
return error(1, "部门存在用户,不允许删除");
}
if (deptService.deleteDeptById(deptId) > 0)
{
return success();
}
return error();
return toAjax(deptService.deleteDeptById(deptId));
}
/**
......@@ -133,9 +131,9 @@ public class DeptController extends BaseController
* 选择部门树
*/
@GetMapping("/selectDeptTree/{deptId}")
public String selectDeptTree(@PathVariable("deptId") Long deptId, Model model)
public String selectDeptTree(@PathVariable("deptId") Long deptId, ModelMap mmap)
{
model.addAttribute("treeName", deptService.selectDeptById(deptId).getDeptName());
mmap.put("treeName", deptService.selectDeptById(deptId).getDeptName());
return prefix + "/tree";
}
......
......@@ -5,7 +5,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.security.ShiroUtils;
......@@ -17,7 +17,7 @@ import com.ruoyi.project.system.dept.mapper.DeptMapper;
*
* @author ruoyi
*/
@Repository("deptService")
@Service
public class DeptServiceImpl implements IDeptService
{
@Autowired
......@@ -111,24 +111,29 @@ public class DeptServiceImpl implements IDeptService
}
/**
* 保存部门信息
* 新增保存部门信息
*
* @param dept 部门信息
* @return 结果
*/
@Override
public int saveDept(Dept dept)
public int insertDept(Dept dept)
{
if (StringUtils.isNotNull(dept.getDeptId()))
{
dept.setUpdateBy(ShiroUtils.getLoginName());
return deptMapper.updateDept(dept);
}
else
{
dept.setCreateBy(ShiroUtils.getLoginName());
return deptMapper.insertDept(dept);
}
dept.setCreateBy(ShiroUtils.getLoginName());
return deptMapper.insertDept(dept);
}
/**
* 修改保存部门信息
*
* @param dept 部门信息
* @return 结果
*/
@Override
public int updateDept(Dept dept)
{
dept.setUpdateBy(ShiroUtils.getLoginName());
return deptMapper.updateDept(dept);
}
/**
......@@ -152,14 +157,9 @@ public class DeptServiceImpl implements IDeptService
@Override
public String checkDeptNameUnique(Dept dept)
{
if (dept.getDeptId() == null)
{
dept.setDeptId(-1L);
}
Long deptId = dept.getDeptId();
Long deptId = StringUtils.isNull(dept.getDeptId()) ? -1L : dept.getDeptId();
Dept info = deptMapper.checkDeptNameUnique(dept.getDeptName());
if (StringUtils.isNotNull(info) && StringUtils.isNotNull(info.getDeptId())
&& info.getDeptId().longValue() != deptId.longValue())
if (StringUtils.isNotNull(info) && info.getDeptId().longValue() != deptId.longValue())
{
return UserConstants.DEPT_NAME_NOT_UNIQUE;
}
......
......@@ -58,12 +58,20 @@ public interface IDeptService
public int deleteDeptById(Long deptId);
/**
* 保存部门信息
* 新增保存部门信息
*
* @param dept 部门信息
* @return 结果
*/
public int saveDept(Dept dept);
public int insertDept(Dept dept);
/**
* 修改保存部门信息
*
* @param dept 部门信息
* @return 结果
*/
public int updateDept(Dept dept);
/**
* 根据部门ID查询信息
......
......@@ -4,7 +4,7 @@ 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.Model;
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;
......@@ -68,44 +68,47 @@ public class DictDataController extends BaseController
}
/**
* 修改字典类型
* 新增字典类型
*/
@Log(title = "字典数据", action = BusinessType.UPDATE)
@RequiresPermissions("system:dict:edit")
@GetMapping("/edit/{dictCode}")
public String edit(@PathVariable("dictCode") Long dictCode, Model model)
@GetMapping("/add/{dictType}")
public String add(@PathVariable("dictType") String dictType, ModelMap mmap)
{
DictData dict = dictDataService.selectDictDataById(dictCode);
model.addAttribute("dict", dict);
return prefix + "/edit";
mmap.put("dictType", dictType);
return prefix + "/add";
}
/**
* 新增字典类型
* 新增保存字典类型
*/
@Log(title = "字典数据", action = BusinessType.INSERT)
@RequiresPermissions("system:dict:add")
@GetMapping("/add/{dictType}")
public String add(@PathVariable("dictType") String dictType, Model model)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(DictData dict)
{
model.addAttribute("dictType", dictType);
return prefix + "/add";
return toAjax(dictDataService.insertDictData(dict));
}
/**
* 修改字典类型
*/
@GetMapping("/edit/{dictCode}")
public String edit(@PathVariable("dictCode") Long dictCode, ModelMap mmap)
{
mmap.put("dict", dictDataService.selectDictDataById(dictCode));
return prefix + "/edit";
}
/**
* 保存字典类型
* 修改保存字典类型
*/
@Log(title = "字典数据", action = BusinessType.SAVE)
@RequiresPermissions("system:dict:save")
@PostMapping("/save")
@Log(title = "字典数据", action = BusinessType.UPDATE)
@RequiresPermissions("system:dict:edit")
@PostMapping("/edit")
@ResponseBody
public AjaxResult save(DictData dict)
public AjaxResult editSave(DictData dict)
{
if (dictDataService.saveDictData(dict) > 0)
{
return success();
}
return error();
return toAjax(dictDataService.updateDictData(dict));
}
@Log(title = "字典数据", action = BusinessType.DELETE)
......@@ -114,11 +117,6 @@ public class DictDataController extends BaseController
@ResponseBody
public AjaxResult remove(String ids)
{
int rows = dictDataService.deleteDictDataByIds(ids);
if (rows > 0)
{
return success();
}
return error();
return toAjax(dictDataService.deleteDictDataByIds(ids));
}
}
......@@ -4,7 +4,7 @@ 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.Model;
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;
......@@ -68,43 +68,46 @@ public class DictTypeController extends BaseController
}
/**
* 修改字典类型
* 新增字典类型
*/
@Log(title = "字典类型", action = BusinessType.UPDATE)
@RequiresPermissions("system:dict:edit")
@GetMapping("/edit/{dictId}")
public String edit(@PathVariable("dictId") Long dictId, Model model)
@GetMapping("/add")
public String add()
{
DictType dict = dictTypeService.selectDictTypeById(dictId);
model.addAttribute("dict", dict);
return prefix + "/edit";
return prefix + "/add";
}
/**
* 新增字典类型
* 新增保存字典类型
*/
@Log(title = "字典类型", action = BusinessType.INSERT)
@RequiresPermissions("system:dict:add")
@GetMapping("/add")
public String add()
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(DictType dict)
{
return prefix + "/add";
return toAjax(dictTypeService.insertDictType(dict));
}
/**
* 保存字典类型
* 修改字典类型
*/
@Log(title = "字典类型", action = BusinessType.SAVE)
@RequiresPermissions("system:dict:save")
@PostMapping("/save")
@GetMapping("/edit/{dictId}")
public String edit(@PathVariable("dictId") Long dictId, ModelMap mmap)
{
mmap.put("dict", dictTypeService.selectDictTypeById(dictId));
return prefix + "/edit";
}
/**
* 修改保存字典类型
*/
@Log(title = "字典类型", action = BusinessType.UPDATE)
@RequiresPermissions("system:dict:edit")
@PostMapping("/edit")
@ResponseBody
public AjaxResult save(DictType dict)
public AjaxResult editSave(DictType dict)
{
if (dictTypeService.saveDictType(dict) > 0)
{
return success();
}
return error();
return toAjax(dictTypeService.updateDictType(dict));
}
@Log(title = "字典类型", action = BusinessType.DELETE)
......@@ -115,8 +118,7 @@ public class DictTypeController extends BaseController
{
try
{
dictTypeService.deleteDictTypeByIds(ids);
return success();
return toAjax(dictTypeService.deleteDictTypeByIds(ids));
}
catch (Exception e)
{
......@@ -129,12 +131,10 @@ public class DictTypeController extends BaseController
*/
@RequiresPermissions("system:dict:list")
@GetMapping("/detail/{dictId}")
public String detail(@PathVariable("dictId") Long dictId, Model model)
public String detail(@PathVariable("dictId") Long dictId, ModelMap mmap)
{
DictType dict = dictTypeService.selectDictTypeById(dictId);
List<DictType> dictTypeList = dictTypeService.selectDictTypeAll();
model.addAttribute("dict", dict);
model.addAttribute("dictList", dictTypeList);
mmap.put("dict", dictTypeService.selectDictTypeById(dictId));
mmap.put("dictList", dictTypeService.selectDictTypeAll());
return "system/dict/data/data";
}
......
......@@ -36,6 +36,9 @@ public class DictData extends BaseEntity
@Excel(name = "字典样式")
private String cssClass;
/** 表格字典样式 */
private String listClass;
/** 是否默认(Y是 N否) */
@Excel(name = "是否默认")
private String isDefault;
......@@ -104,6 +107,16 @@ public class DictData extends BaseEntity
this.cssClass = cssClass;
}
public String getListClass()
{
return listClass;
}
public void setListClass(String listClass)
{
this.listClass = listClass;
}
public String getIsDefault()
{
return isDefault;
......
package com.ruoyi.project.system.dict.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.ruoyi.project.system.dict.domain.DictData;
/**
......@@ -18,7 +21,7 @@ public interface DictDataMapper
* @return 字典数据集合信息
*/
public List<DictData> selectDictDataList(DictData dictData);
/**
* 根据字典类型查询字典数据
*
......@@ -28,13 +31,22 @@ public interface DictDataMapper
public List<DictData> selectDictDataByType(String dictType);
/**
* 根据字典类型和字典键值查询字典数据信息
*
* @param dictType 字典类型
* @param dictValue 字典键值
* @return 字典标签
*/
public String selectDictLabel(@Param("dictType") String dictType, @Param("dictValue") String dictValue);
/**
* 根据字典数据ID查询信息
*
* @param dictCode 字典数据ID
* @return 字典数据
*/
public DictData selectDictDataById(Long dictCode);
/**
* 查询字典数据
*
......@@ -42,7 +54,7 @@ public interface DictDataMapper
* @return 字典数据
*/
public int countDictDataByType(String dictType);
/**
* 通过字典ID删除字典数据信息
*
......@@ -50,7 +62,7 @@ public interface DictDataMapper
* @return 结果
*/
public int deleteDictDataById(Long dictCode);
/**
* 批量删除字典数据
*
......
......@@ -4,7 +4,6 @@ import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.common.support.Convert;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.security.ShiroUtils;
import com.ruoyi.project.system.dict.domain.DictData;
import com.ruoyi.project.system.dict.mapper.DictDataMapper;
......@@ -14,7 +13,7 @@ import com.ruoyi.project.system.dict.mapper.DictDataMapper;
*
* @author ruoyi
*/
@Service("dictDataService")
@Service
public class DictDataServiceImpl implements IDictDataService
{
@Autowired
......@@ -45,6 +44,18 @@ public class DictDataServiceImpl implements IDictDataService
}
/**
* 根据字典类型和字典键值查询字典数据信息
*
* @param dictType 字典类型
* @param dictValue 字典键值
* @return 字典标签
*/
public String selectDictLabel(String dictType, String dictValue)
{
return dictDataMapper.selectDictLabel(dictType, dictValue);
}
/**
* 根据字典数据ID查询信息
*
* @param dictCode 字典数据ID
......@@ -81,25 +92,29 @@ public class DictDataServiceImpl implements IDictDataService
}
/**
* 保存字典数据信息
* 新增保存字典数据信息
*
* @param dictData 字典数据信息
* @return 结果
*/
@Override
public int insertDictData(DictData dictData)
{
dictData.setCreateBy(ShiroUtils.getLoginName());
return dictDataMapper.insertDictData(dictData);
}
/**
* 修改保存字典数据信息
*
* @param dictData 字典数据信息
* @return 结果
*/
@Override
public int saveDictData(DictData dictData)
public int updateDictData(DictData dictData)
{
Long dictCode = dictData.getDictCode();
if (StringUtils.isNotNull(dictCode))
{
dictData.setUpdateBy(ShiroUtils.getLoginName());
return dictDataMapper.updateDictData(dictData);
}
else
{
dictData.setCreateBy(ShiroUtils.getLoginName());
return dictDataMapper.insertDictData(dictData);
}
dictData.setUpdateBy(ShiroUtils.getLoginName());
return dictDataMapper.updateDictData(dictData);
}
}
......@@ -16,7 +16,7 @@ import com.ruoyi.project.system.dict.mapper.DictTypeMapper;
*
* @author ruoyi
*/
@Service("dictTypeService")
@Service
public class DictTypeServiceImpl implements IDictTypeService
{
@Autowired
......@@ -95,25 +95,29 @@ public class DictTypeServiceImpl implements IDictTypeService
}
/**
* 保存字典类型信息
* 新增保存字典类型信息
*
* @param dictType 字典类型信息
* @return 结果
*/
@Override
public int saveDictType(DictType dictType)
public int insertDictType(DictType dictType)
{
Long dictId = dictType.getDictId();
if (StringUtils.isNotNull(dictId))
{
dictType.setUpdateBy(ShiroUtils.getLoginName());
return dictTypeMapper.updateDictType(dictType);
}
else
{
dictType.setCreateBy(ShiroUtils.getLoginName());
return dictTypeMapper.insertDictType(dictType);
}
dictType.setCreateBy(ShiroUtils.getLoginName());
return dictTypeMapper.insertDictType(dictType);
}
/**
* 修改保存字典类型信息
*
* @param dictType 字典类型信息
* @return 结果
*/
@Override
public int updateDictType(DictType dictType)
{
dictType.setUpdateBy(ShiroUtils.getLoginName());
return dictTypeMapper.updateDictType(dictType);
}
/**
......@@ -125,11 +129,7 @@ public class DictTypeServiceImpl implements IDictTypeService
@Override
public String checkDictTypeUnique(DictType dict)
{
if (dict.getDictId() == null)
{
dict.setDictId(-1L);
}
Long dictId = dict.getDictId();
Long dictId = StringUtils.isNull(dict.getDictId()) ? -1L : dict.getDictId();
DictType dictType = dictTypeMapper.checkDictTypeUnique(dict.getDictType());
if (StringUtils.isNotNull(dictType) && dictType.getDictId() != dictId)
{
......
......@@ -18,7 +18,7 @@ public interface IDictDataService
* @return 字典数据集合信息
*/
public List<DictData> selectDictDataList(DictData dictData);
/**
* 根据字典类型查询字典数据
*
......@@ -26,7 +26,16 @@ public interface IDictDataService
* @return 字典数据集合信息
*/
public List<DictData> selectDictDataByType(String dictType);
/**
* 根据字典类型和字典键值查询字典数据信息
*
* @param dictType 字典类型
* @param dictValue 字典键值
* @return 字典标签
*/
public String selectDictLabel(String dictType, String dictValue);
/**
* 根据字典数据ID查询信息
*
......@@ -34,7 +43,7 @@ public interface IDictDataService
* @return 字典数据
*/
public DictData selectDictDataById(Long dictCode);
/**
* 通过字典ID删除字典数据信息
*
......@@ -52,11 +61,19 @@ public interface IDictDataService
public int deleteDictDataByIds(String ids);
/**
* 保存字典数据信息
* 新增保存字典数据信息
*
* @param dictData 字典数据信息
* @return 结果
*/
public int insertDictData(DictData dictData);
/**
* 修改保存字典数据信息
*
* @param dictData 字典数据信息
* @return 结果
*/
public int saveDictData(DictData dictData);
public int updateDictData(DictData dictData);
}
......@@ -17,7 +17,7 @@ public interface IDictTypeService
* @return 字典类型集合信息
*/
public List<DictType> selectDictTypeList(DictType dictType);
/**
* 根据所有字典类型
*
......@@ -32,7 +32,7 @@ public interface IDictTypeService
* @return 字典类型
*/
public DictType selectDictTypeById(Long dictId);
/**
* 通过字典ID删除字典信息
*
......@@ -41,22 +41,29 @@ public interface IDictTypeService
*/
public int deleteDictTypeById(Long dictId);
/**
* 批量删除字典类型
*
* @param ids 需要删除的数据
* @return 结果
*/
public int deleteDictTypeByIds(String ids) throws Exception;
public int deleteDictTypeByIds(String ids) throws Exception;
/**
* 新增保存字典类型信息
*
* @param dictType 字典类型信息
* @return 结果
*/
public int insertDictType(DictType dictType);
/**
* 保存字典类型信息
* 修改保存字典类型信息
*
* @param dictType 字典类型信息
* @return 结果
*/
public int saveDictType(DictType dictType);
public int updateDictType(DictType dictType);
/**
* 校验字典类型称是否唯一
......
......@@ -5,7 +5,7 @@ import java.util.Map;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
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;
......@@ -67,33 +67,14 @@ public class MenuController extends BaseController
{
return error(1, "菜单已分配,不允许删除");
}
if (menuService.deleteMenuById(menuId) > 0)
{
return success();
}
return error();
}
/**
* 修改菜单
*/
@Log(title = "菜单管理", action = BusinessType.UPDATE)
@RequiresPermissions("system:menu:edit")
@GetMapping("/edit/{menuId}")
public String edit(@PathVariable("menuId") Long menuId, Model model)
{
Menu menu = menuService.selectMenuById(menuId);
model.addAttribute("menu", menu);
return prefix + "/edit";
return toAjax(menuService.deleteMenuById(menuId));
}
/**
* 新增
*/
@Log(title = "菜单管理", action = BusinessType.INSERT)
@RequiresPermissions("system:menu:add")
@GetMapping("/add/{parentId}")
public String add(@PathVariable("parentId") Long parentId, Model model)
public String add(@PathVariable("parentId") Long parentId, ModelMap mmap)
{
Menu menu = null;
if (0L != parentId)
......@@ -106,24 +87,42 @@ public class MenuController extends BaseController
menu.setMenuId(0L);
menu.setMenuName("主目录");
}
model.addAttribute("menu", menu);
mmap.put("menu", menu);
return prefix + "/add";
}
/**
* 保存菜单
* 新增保存菜单
*/
@Log(title = "菜单管理", action = BusinessType.SAVE)
@RequiresPermissions("system:menu:save")
@PostMapping("/save")
@Log(title = "菜单管理", action = BusinessType.INSERT)
@RequiresPermissions("system:menu:add")
@PostMapping("/add")
@ResponseBody
public AjaxResult save(Menu menu)
public AjaxResult addSave(Menu menu)
{
if (menuService.saveMenu(menu) > 0)
{
return success();
}
return error();
return toAjax(menuService.insertMenu(menu));
}
/**
* 修改菜单
*/
@GetMapping("/edit/{menuId}")
public String edit(@PathVariable("menuId") Long menuId, ModelMap mmap)
{
mmap.put("menu", menuService.selectMenuById(menuId));
return prefix + "/edit";
}
/**
* 修改保存菜单
*/
@Log(title = "菜单管理", action = BusinessType.UPDATE)
@RequiresPermissions("system:menu:edit")
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(Menu menu)
{
return toAjax(menuService.updateMenu(menu));
}
/**
......@@ -176,9 +175,9 @@ public class MenuController extends BaseController
* 选择菜单树
*/
@GetMapping("/selectMenuTree/{menuId}")
public String selectMenuTree(@PathVariable("menuId") Long menuId, Model model)
public String selectMenuTree(@PathVariable("menuId") Long menuId, ModelMap mmap)
{
model.addAttribute("treeName", menuService.selectMenuById(menuId).getMenuName());
mmap.put("treeName", menuService.selectMenuById(menuId).getMenuName());
return prefix + "/tree";
}
}
\ No newline at end of file
......@@ -100,12 +100,20 @@ public interface IMenuService
public int selectCountRoleMenuByMenuId(Long menuId);
/**
* 保存菜单信息
* 新增保存菜单信息
*
* @param menu 菜单信息
* @return 结果
*/
public int saveMenu(Menu menu);
public int insertMenu(Menu menu);
/**
* 修改保存菜单信息
*
* @param menu 菜单信息
* @return 结果
*/
public int updateMenu(Menu menu);
/**
* 校验菜单名称是否唯一
......
......@@ -25,7 +25,7 @@ import com.ruoyi.project.system.role.mapper.RoleMenuMapper;
*
* @author ruoyi
*/
@Service("menuService")
@Service
public class MenuServiceImpl implements IMenuService
{
public static final String PREMISSION_STRING = "perms[\"{0}\"]";
......@@ -245,27 +245,31 @@ public class MenuServiceImpl implements IMenuService
}
/**
* 保存菜单信息
* 新增保存菜单信息
*
* @param menu 菜单信息
* @return 结果
*/
@Override
public int saveMenu(Menu menu)
public int insertMenu(Menu menu)
{
Long menuId = menu.getMenuId();
if (StringUtils.isNotNull(menuId))
{
menu.setUpdateBy(ShiroUtils.getLoginName());
ShiroUtils.clearCachedAuthorizationInfo();
return menuMapper.updateMenu(menu);
}
else
{
menu.setCreateBy(ShiroUtils.getLoginName());
ShiroUtils.clearCachedAuthorizationInfo();
return menuMapper.insertMenu(menu);
}
menu.setCreateBy(ShiroUtils.getLoginName());
ShiroUtils.clearCachedAuthorizationInfo();
return menuMapper.insertMenu(menu);
}
/**
* 修改保存菜单信息
*
* @param menu 菜单信息
* @return 结果
*/
@Override
public int updateMenu(Menu menu)
{
menu.setUpdateBy(ShiroUtils.getLoginName());
ShiroUtils.clearCachedAuthorizationInfo();
return menuMapper.updateMenu(menu);
}
/**
......@@ -277,14 +281,9 @@ public class MenuServiceImpl implements IMenuService
@Override
public String checkMenuNameUnique(Menu menu)
{
if (menu.getMenuId() == null)
{
menu.setMenuId(-1L);
}
Long menuId = menu.getMenuId();
Long menuId = StringUtils.isNull(menu.getMenuId()) ? -1L : menu.getMenuId();
Menu info = menuMapper.checkMenuNameUnique(menu.getMenuName());
if (StringUtils.isNotNull(info) && StringUtils.isNotNull(info.getMenuId())
&& info.getMenuId().longValue() != menuId.longValue())
if (StringUtils.isNotNull(info) && info.getMenuId().longValue() != menuId.longValue())
{
return UserConstants.MENU_NAME_NOT_UNIQUE;
}
......
......@@ -4,19 +4,19 @@ 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.Model;
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.project.system.notice.domain.Notice;
import com.ruoyi.project.system.notice.service.INoticeService;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.constant.BusinessType;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.project.system.notice.domain.Notice;
import com.ruoyi.project.system.notice.service.INoticeService;
/**
* 公告 信息操作处理
......@@ -55,8 +55,6 @@ public class NoticeController extends BaseController
/**
* 新增公告
*/
@RequiresPermissions("system:notice:add")
@Log(title = "通知公告", action = BusinessType.INSERT)
@GetMapping("/add")
public String add()
{
......@@ -64,32 +62,37 @@ public class NoticeController extends BaseController
}
/**
* 新增保存公告
*/
@RequiresPermissions("system:notice:add")
@Log(title = "通知公告", action = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(Notice notice)
{
return toAjax(noticeService.insertNotice(notice));
}
/**
* 修改公告
*/
@RequiresPermissions("system:notice:edit")
@Log(title = "通知公告", action = BusinessType.UPDATE)
@GetMapping("/edit/{noticeId}")
public String edit(@PathVariable("noticeId") Integer noticeId, Model model)
public String edit(@PathVariable("noticeId") Long noticeId, ModelMap mmap)
{
Notice notice = noticeService.selectNoticeById(noticeId);
model.addAttribute("notice", notice);
mmap.put("notice", noticeService.selectNoticeById(noticeId));
return prefix + "/edit";
}
/**
* 保存公告
* 修改保存公告
*/
@RequiresPermissions("system:notice:save")
@Log(title = "通知公告", action = BusinessType.SAVE)
@PostMapping("/save")
@RequiresPermissions("system:notice:edit")
@Log(title = "通知公告", action = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult save(Notice notice)
public AjaxResult editSave(Notice notice)
{
if (noticeService.saveNotice(notice) > 0)
{
return success();
}
return error();
return toAjax(noticeService.updateNotice(notice));
}
/**
......@@ -101,12 +104,7 @@ public class NoticeController extends BaseController
@ResponseBody
public AjaxResult remove(String ids)
{
int rows = noticeService.deleteNoticeByIds(ids);
if (rows > 0)
{
return success();
}
return error();
return toAjax(noticeService.deleteNoticeByIds(ids));
}
}
......@@ -12,7 +12,7 @@ public class Notice extends BaseEntity
private static final long serialVersionUID = 1L;
/** 公告ID */
private Integer noticeId;
private Long noticeId;
/** 公告标题 */
private String noticeTitle;
/** 公告类型(1通知 2公告) */
......@@ -22,14 +22,14 @@ public class Notice extends BaseEntity
/** 公告状态(0正常 1关闭) */
private String status;
public void setNoticeId(Integer noticeId)
public Long getNoticeId()
{
this.noticeId = noticeId;
return noticeId;
}
public Integer getNoticeId()
public void setNoticeId(Long noticeId)
{
return noticeId;
this.noticeId = noticeId;
}
public void setNoticeTitle(String noticeTitle)
......
......@@ -16,7 +16,7 @@ public interface NoticeMapper
* @param noticeId 公告ID
* @return 公告信息
*/
public Notice selectNoticeById(Integer noticeId);
public Notice selectNoticeById(Long noticeId);
/**
* 查询公告列表
......
......@@ -16,7 +16,7 @@ public interface INoticeService
* @param noticeId 公告ID
* @return 公告信息
*/
public Notice selectNoticeById(Integer noticeId);
public Notice selectNoticeById(Long noticeId);
/**
* 查询公告列表
......@@ -43,14 +43,6 @@ public interface INoticeService
public int updateNotice(Notice notice);
/**
* 保存公告
*
* @param notice 公告信息
* @return 结果
*/
public int saveNotice(Notice notice);
/**
* 删除公告信息
*
* @param ids 需要删除的数据ID
......
......@@ -3,7 +3,6 @@ package com.ruoyi.project.system.notice.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.security.ShiroUtils;
import com.ruoyi.project.system.notice.mapper.NoticeMapper;
import com.ruoyi.project.system.notice.domain.Notice;
......@@ -29,7 +28,7 @@ public class NoticeServiceImpl implements INoticeService
* @return 公告信息
*/
@Override
public Notice selectNoticeById(Integer noticeId)
public Notice selectNoticeById(Long noticeId)
{
return noticeMapper.selectNoticeById(noticeId);
}
......@@ -55,6 +54,7 @@ public class NoticeServiceImpl implements INoticeService
@Override
public int insertNotice(Notice notice)
{
notice.setCreateBy(ShiroUtils.getLoginName());
return noticeMapper.insertNotice(notice);
}
......@@ -67,36 +67,11 @@ public class NoticeServiceImpl implements INoticeService
@Override
public int updateNotice(Notice notice)
{
notice.setUpdateBy(ShiroUtils.getLoginName());
return noticeMapper.updateNotice(notice);
}
/**
* 保存公告
*
* @param notice 公告信息
* @return 结果
*/
@Override
public int saveNotice(Notice notice)
{
Integer noticeId = notice.getNoticeId();
int rows = 0;
if (StringUtils.isNotNull(noticeId))
{
notice.setUpdateBy(ShiroUtils.getLoginName());
// 修改公告
rows = noticeMapper.updateNotice(notice);
}
else
{
notice.setCreateBy(ShiroUtils.getLoginName());
// 新增公告
rows = noticeMapper.insertNotice(notice);
}
return rows;
}
/**
* 删除公告对象
*
* @param ids 需要删除的数据ID
......
......@@ -4,7 +4,7 @@ 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.Model;
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;
......@@ -75,8 +75,7 @@ public class PostController extends BaseController
{
try
{
postService.deletePostByIds(ids);
return success();
return toAjax(postService.deletePostByIds(ids));
}
catch (Exception e)
{
......@@ -87,41 +86,44 @@ public class PostController extends BaseController
/**
* 新增岗位
*/
@Log(title = "岗位管理", action = BusinessType.INSERT)
@RequiresPermissions("system:post:add")
@GetMapping("/add")
public String add(Model model)
public String add()
{
return prefix + "/add";
}
/**
* 新增保存岗位
*/
@RequiresPermissions("system:post:add")
@Log(title = "岗位管理", action = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(Post post)
{
return toAjax(postService.insertPost(post));
}
/**
* 修改岗位
*/
@Log(title = "岗位管理", action = BusinessType.UPDATE)
@RequiresPermissions("system:post:edit")
@GetMapping("/edit/{postId}")
public String edit(@PathVariable("postId") Long postId, Model model)
public String edit(@PathVariable("postId") Long postId, ModelMap mmap)
{
Post post = postService.selectPostById(postId);
model.addAttribute("post", post);
mmap.put("post", postService.selectPostById(postId));
return prefix + "/edit";
}
/**
* 保存岗位
* 修改保存岗位
*/
@Log(title = "岗位管理", action = BusinessType.SAVE)
@RequiresPermissions("system:post:save")
@PostMapping("/save")
@RequiresPermissions("system:post:edit")
@Log(title = "岗位管理", action = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult save(Post post)
public AjaxResult editSave(Post post)
{
if (postService.savePost(post) > 0)
{
return success();
}
return error();
return toAjax(postService.updatePost(post));
}
}
......@@ -43,14 +43,6 @@ public interface PostMapper
public Post selectPostById(Long postId);
/**
* 通过岗位ID删除岗位信息
*
* @param postId 岗位ID
* @return 结果
*/
public int deletePostById(Long postId);
/**
* 批量删除岗位信息
*
* @param ids 需要删除的数据ID
......
......@@ -42,28 +42,28 @@ public interface IPostService
public Post selectPostById(Long postId);
/**
* 通过岗位ID删除岗位信息
* 批量删除岗位信息
*
* @param postId 岗位ID
* @return 结果
* @param ids 需要删除的数据ID
*/
public boolean deletePostById(Long postId);
public int deletePostByIds(String ids) throws Exception;
/**
* 批量删除岗位信息
* 新增保存岗位信息
*
* @param ids 需要删除的数据ID
* @param post 岗位信息
* @return 结果
*/
public void deletePostByIds(String ids) throws Exception;
public int insertPost(Post post);
/**
* 保存岗位信息
* 修改保存岗位信息
*
* @param post 岗位信息
* @return 结果
*/
public int savePost(Post post);
public int updatePost(Post post);
/**
* 通过岗位ID查询岗位使用数量
*
......
......@@ -3,9 +3,7 @@ package com.ruoyi.project.system.post.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.common.support.Convert;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.security.ShiroUtils;
import com.ruoyi.project.system.post.domain.Post;
import com.ruoyi.project.system.post.mapper.PostMapper;
......@@ -16,7 +14,7 @@ import com.ruoyi.project.system.user.mapper.UserPostMapper;
*
* @author ruoyi
*/
@Service("postService")
@Service
public class PostServiceImpl implements IPostService
{
@Autowired
......@@ -86,25 +84,13 @@ public class PostServiceImpl implements IPostService
}
/**
* 通过岗位ID删除岗位信息
*
* @param postId 岗位ID
* @return 结果
*/
@Override
public boolean deletePostById(Long postId)
{
return postMapper.deletePostById(postId) > 0 ? true : false;
}
/**
* 批量删除岗位信息
*
* @param ids 需要删除的数据ID
* @throws Exception
*/
@Override
public void deletePostByIds(String ids) throws Exception
public int deletePostByIds(String ids) throws Exception
{
Long[] postIds = Convert.toLongArray(ids);
for (Long postId : postIds)
......@@ -115,33 +101,33 @@ public class PostServiceImpl implements IPostService
throw new Exception(String.format("%1$s已分配,不能删除", post.getPostName()));
}
}
postMapper.deletePostByIds(postIds);
return postMapper.deletePostByIds(postIds);
}
/**
* 保存岗位信息
* 新增保存岗位信息
*
* @param post 岗位信息
* @return 结果
*/
@Override
public int savePost(Post post)
public int insertPost(Post post)
{
Long postId = post.getPostId();
int count = 0;
if (StringUtils.isNotNull(postId))
{
post.setUpdateBy(ShiroUtils.getLoginName());
// 修改岗位信息
count = postMapper.updatePost(post);
}
else
{
post.setCreateBy(ShiroUtils.getLoginName());
// 新增岗位信息
count = postMapper.insertPost(post);
}
return count;
post.setCreateBy(ShiroUtils.getLoginName());
return postMapper.insertPost(post);
}
/**
* 修改保存岗位信息
*
* @param post 岗位信息
* @return 结果
*/
@Override
public int updatePost(Post post)
{
post.setUpdateBy(ShiroUtils.getLoginName());
return postMapper.updatePost(post);
}
/**
......
......@@ -5,7 +5,7 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.ui.Model;
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;
......@@ -72,42 +72,47 @@ public class RoleController extends BaseController
/**
* 新增角色
*/
@RequiresPermissions("system:role:add")
@Log(title = "角色管理", action = BusinessType.INSERT)
@GetMapping("/add")
public String add(Model model)
public String add()
{
return prefix + "/add";
}
/**
* 新增保存角色
*/
@RequiresPermissions("system:role:add")
@Log(title = "角色管理", action = BusinessType.INSERT)
@PostMapping("/add")
@Transactional(rollbackFor = Exception.class)
@ResponseBody
public AjaxResult addSave(Role role)
{
return toAjax(roleService.insertRole(role));
}
/**
* 修改角色
*/
@RequiresPermissions("system:role:edit")
@Log(title = "角色管理", action = BusinessType.UPDATE)
@GetMapping("/edit/{roleId}")
public String edit(@PathVariable("roleId") Long roleId, Model model)
public String edit(@PathVariable("roleId") Long roleId, ModelMap mmap)
{
Role role = roleService.selectRoleById(roleId);
model.addAttribute("role", role);
mmap.put("role", roleService.selectRoleById(roleId));
return prefix + "/edit";
}
/**
* 保存角色
* 修改保存角色
*/
@RequiresPermissions("system:role:save")
@Log(title = "角色管理", action = BusinessType.SAVE)
@PostMapping("/save")
@RequiresPermissions("system:role:edit")
@Log(title = "角色管理", action = BusinessType.UPDATE)
@PostMapping("/edit")
@Transactional(rollbackFor = Exception.class)
@ResponseBody
public AjaxResult save(Role role)
public AjaxResult editSave(Role role)
{
if (roleService.saveRole(role) > 0)
{
return success();
}
return error();
return toAjax(roleService.updateRole(role));
}
@RequiresPermissions("system:role:remove")
......@@ -118,8 +123,7 @@ public class RoleController extends BaseController
{
try
{
roleService.deleteRoleByIds(ids);
return success();
return toAjax(roleService.deleteRoleByIds(ids));
}
catch (Exception e)
{
......
......@@ -64,16 +64,24 @@ public interface IRoleService
*
* @param ids 需要删除的数据ID
*/
public void deleteRoleByIds(String ids) throws Exception;
public int deleteRoleByIds(String ids) throws Exception;
/**
* 保存角色信息
* 新增保存角色信息
*
* @param role 角色信息
* @return 结果
*/
public int saveRole(Role role);
public int insertRole(Role role);
/**
* 修改保存角色信息
*
* @param role 角色信息
* @return 结果
*/
public int updateRole(Role role);
/**
* 校验角色名称是否唯一
*
......@@ -81,7 +89,7 @@ public interface IRoleService
* @return 结果
*/
public String checkRoleNameUnique(Role role);
/**
* 通过角色ID查询角色使用数量
*
......
......@@ -22,7 +22,7 @@ import com.ruoyi.project.system.user.mapper.UserRoleMapper;
*
* @author ruoyi
*/
@Service("roleService")
@Service
public class RoleServiceImpl implements IRoleService
{
......@@ -135,7 +135,7 @@ public class RoleServiceImpl implements IRoleService
* @throws Exception
*/
@Override
public void deleteRoleByIds(String ids) throws Exception
public int deleteRoleByIds(String ids) throws Exception
{
Long[] roleIds = Convert.toLongArray(ids);
for (Long roleId : roleIds)
......@@ -146,33 +146,39 @@ public class RoleServiceImpl implements IRoleService
throw new Exception(String.format("%1$s已分配,不能删除", role.getRoleName()));
}
}
roleMapper.deleteRoleByIds(roleIds);
return roleMapper.deleteRoleByIds(roleIds);
}
/**
* 保存角色信息
* 新增保存角色信息
*
* @param role 角色信息
* @return 结果
*/
@Override
public int saveRole(Role role)
public int insertRole(Role role)
{
Long roleId = role.getRoleId();
if (StringUtils.isNotNull(roleId))
{
role.setUpdateBy(ShiroUtils.getLoginName());
// 修改角色信息
roleMapper.updateRole(role);
// 删除角色与菜单关联
roleMenuMapper.deleteRoleMenuByRoleId(roleId);
}
else
{
role.setCreateBy(ShiroUtils.getLoginName());
// 新增角色信息
roleMapper.insertRole(role);
}
role.setCreateBy(ShiroUtils.getLoginName());
// 新增角色信息
roleMapper.insertRole(role);
ShiroUtils.clearCachedAuthorizationInfo();
return insertRoleMenu(role);
}
/**
* 修改保存角色信息
*
* @param role 角色信息
* @return 结果
*/
@Override
public int updateRole(Role role)
{
role.setUpdateBy(ShiroUtils.getLoginName());
// 修改角色信息
roleMapper.updateRole(role);
// 删除角色与菜单关联
roleMenuMapper.deleteRoleMenuByRoleId(role.getRoleId());
ShiroUtils.clearCachedAuthorizationInfo();
return insertRoleMenu(role);
}
......@@ -210,13 +216,9 @@ public class RoleServiceImpl implements IRoleService
@Override
public String checkRoleNameUnique(Role role)
{
if (role.getRoleId() == null)
{
role.setRoleId(-1L);
}
Long roleId = role.getRoleId();
Long roleId = StringUtils.isNull(role.getRoleId()) ? -1L : role.getRoleId();
Role info = roleMapper.checkRoleNameUnique(role.getRoleName());
if (StringUtils.isNotNull(info) && StringUtils.isNotNull(info.getRoleId()) && info.getRoleId() != roleId)
if (StringUtils.isNotNull(info) && info.getRoleId().longValue() != roleId.longValue())
{
return UserConstants.ROLE_NAME_NOT_UNIQUE;
}
......
......@@ -3,7 +3,7 @@ package com.ruoyi.project.system.user.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import com.ruoyi.framework.config.RuoYiConfig;
import com.ruoyi.framework.web.controller.BaseController;
......@@ -27,23 +27,23 @@ public class IndexController extends BaseController
// 系统首页
@GetMapping("/index")
public String index(Model model)
public String index(ModelMap mmap)
{
// 取身份信息
User user = getUser();
// 根据用户id取出菜单
List<Menu> menus = menuService.selectMenusByUserId(user.getUserId());
model.addAttribute("menus", menus);
model.addAttribute("user", user);
model.addAttribute("copyrightYear", ruoYiConfig.getCopyrightYear());
mmap.put("menus", menus);
mmap.put("user", user);
mmap.put("copyrightYear", ruoYiConfig.getCopyrightYear());
return "index";
}
// 系统介绍
@GetMapping("/system/main")
public String main(Model model)
public String main(ModelMap mmap)
{
model.addAttribute("version", ruoYiConfig.getVersion());
mmap.put("version", ruoYiConfig.getVersion());
return "main";
}
......
......@@ -7,7 +7,6 @@ import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.subject.Subject;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;
......@@ -26,7 +25,7 @@ public class LoginController extends BaseController
{
@GetMapping("/login")
public String login(HttpServletRequest request, HttpServletResponse response, Model model)
public String login(HttpServletRequest request, HttpServletResponse response)
{
// 如果是Ajax请求,返回Json字符串。
if (ServletUtils.isAjaxRequest((HttpServletRequest) request))
......
......@@ -5,7 +5,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
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;
......@@ -18,6 +18,7 @@ import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.constant.BusinessType;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.framework.web.service.DictService;
import com.ruoyi.project.system.user.domain.User;
import com.ruoyi.project.system.user.service.IUserService;
......@@ -37,27 +38,20 @@ public class ProfileController extends BaseController
@Autowired
private IUserService userService;
@Autowired
private DictService dict;
/**
* 个人信息
*/
@GetMapping()
public String profile(Model model)
public String profile(ModelMap mmap)
{
User user = getUser();
String sex = user.getSex();
if ("0".equals(sex))
{
user.setSex("性别:男");
}
else if ("1".equals(sex))
{
user.setSex("性别:女");
}
String roleGroup = userService.selectUserRoleGroup(user.getUserId());
String postGroup = userService.selectUserPostGroup(user.getUserId());
model.addAttribute("user", user);
model.addAttribute("roleGroup", roleGroup);
model.addAttribute("postGroup", postGroup);
user.setSex(dict.getLabel("sys_user_sex", user.getSex()));
mmap.put("user", user);
mmap.put("roleGroup", userService.selectUserRoleGroup(user.getUserId()));
mmap.put("postGroup", userService.selectUserPostGroup(user.getUserId()));
return prefix + "/profile";
}
......@@ -75,10 +69,9 @@ public class ProfileController extends BaseController
}
@GetMapping("/resetPwd/{userId}")
public String resetPwd(@PathVariable("userId") Long userId, Model model)
public String resetPwd(@PathVariable("userId") Long userId, ModelMap mmap)
{
User user = userService.selectUserById(userId);
model.addAttribute("user", user);
mmap.put("user", userService.selectUserById(userId));
return prefix + "/resetPwd";
}
......@@ -99,36 +92,32 @@ public class ProfileController extends BaseController
/**
* 修改用户
*/
@Log(title = "个人信息", action = BusinessType.UPDATE)
@GetMapping("/edit/{userId}")
public String edit(@PathVariable("userId") Long userId, Model model)
public String edit(@PathVariable("userId") Long userId, ModelMap mmap)
{
User user = userService.selectUserById(userId);
model.addAttribute("user", user);
mmap.put("user", userService.selectUserById(userId));
return prefix + "/edit";
}
/**
* 修改头像
*/
@Log(title = "个人信息", action = BusinessType.UPDATE)
@GetMapping("/avatar/{userId}")
public String avatar(@PathVariable("userId") Long userId, Model model)
public String avatar(@PathVariable("userId") Long userId, ModelMap mmap)
{
User user = userService.selectUserById(userId);
model.addAttribute("user", user);
mmap.put("user", userService.selectUserById(userId));
return prefix + "/avatar";
}
/**
* 修改用户
*/
@Log(title = "个人信息", action = BusinessType.SAVE)
@Log(title = "个人信息", action = BusinessType.UPDATE)
@PostMapping("/update")
@ResponseBody
public AjaxResult update(User user)
{
if (userService.updateUser(user) > 0)
if (userService.updateUserInfo(user) > 0)
{
setUser(userService.selectUserById(user.getUserId()));
return success();
......@@ -139,7 +128,7 @@ public class ProfileController extends BaseController
/**
* 保存头像
*/
@Log(title = "个人信息", action = BusinessType.SAVE)
@Log(title = "个人信息", action = BusinessType.UPDATE)
@PostMapping("/updateAvatar")
@ResponseBody
public AjaxResult updateAvatar(User user, @RequestParam("avatarfile") MultipartFile file)
......@@ -150,7 +139,7 @@ public class ProfileController extends BaseController
{
String avatar = FileUploadUtils.upload(file);
user.setAvatar(avatar);
if (userService.updateUser(user) > 0)
if (userService.updateUserInfo(user) > 0)
{
setUser(userService.selectUserById(user.getUserId()));
return success();
......
package com.ruoyi.project.system.user.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.transaction.annotation.Transactional;
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.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
......@@ -7,19 +18,10 @@ import com.ruoyi.framework.aspectj.lang.constant.BusinessType;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.project.system.post.domain.Post;
import com.ruoyi.project.system.post.service.IPostService;
import com.ruoyi.project.system.role.domain.Role;
import com.ruoyi.project.system.role.service.IRoleService;
import com.ruoyi.project.system.user.domain.User;
import com.ruoyi.project.system.user.service.IUserService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 用户信息
......@@ -76,59 +78,78 @@ public class UserController extends BaseController
}
/**
* 新增用户
*/
@GetMapping("/add")
public String add(ModelMap mmap)
{
mmap.put("roles", roleService.selectRoleAll());
mmap.put("posts", postService.selectPostAll());
return prefix + "/add";
}
/**
* 新增保存用户
*/
@RequiresPermissions("system:user:add")
@Log(title = "用户管理", action = BusinessType.INSERT)
@PostMapping("/add")
@Transactional(rollbackFor = Exception.class)
@ResponseBody
public AjaxResult addSave(User user)
{
if (StringUtils.isNotNull(user.getUserId()) && User.isAdmin(user.getUserId()))
{
return error("不允许修改超级管理员用户");
}
return toAjax(userService.insertUser(user));
}
/**
* 修改用户
*/
@RequiresPermissions("system:user:edit")
@Log(title = "用户管理", action = BusinessType.UPDATE)
@GetMapping("/edit/{userId}")
public String edit(@PathVariable("userId") Long userId, Model model)
public String edit(@PathVariable("userId") Long userId, ModelMap mmap)
{
User user = userService.selectUserById(userId);
List<Role> roles = roleService.selectRolesByUserId(userId);
List<Post> posts = postService.selectPostsByUserId(userId);
model.addAttribute("roles", roles);
model.addAttribute("posts", posts);
model.addAttribute("user", user);
mmap.put("user", userService.selectUserById(userId));
mmap.put("roles", roleService.selectRolesByUserId(userId));
mmap.put("posts", postService.selectPostsByUserId(userId));
return prefix + "/edit";
}
/**
* 新增用户
* 修改保存用户
*/
@RequiresPermissions("system:user:add")
@Log(title = "用户管理", action = BusinessType.INSERT)
@GetMapping("/add")
public String add(Model model)
@RequiresPermissions("system:user:edit")
@Log(title = "用户管理", action = BusinessType.UPDATE)
@PostMapping("/edit")
@Transactional(rollbackFor = Exception.class)
@ResponseBody
public AjaxResult editSave(User user)
{
List<Role> roles = roleService.selectRoleAll();
List<Post> posts = postService.selectPostAll();
model.addAttribute("roles", roles);
model.addAttribute("posts", posts);
return prefix + "/add";
if (StringUtils.isNotNull(user.getUserId()) && User.isAdmin(user.getUserId()))
{
return error("不允许修改超级管理员用户");
}
return toAjax(userService.updateUser(user));
}
@RequiresPermissions("system:user:resetPwd")
@Log(title = "重置密码", action = BusinessType.UPDATE)
@GetMapping("/resetPwd/{userId}")
public String resetPwd(@PathVariable("userId") Long userId, Model model)
public String resetPwd(@PathVariable("userId") Long userId, ModelMap mmap)
{
User user = userService.selectUserById(userId);
model.addAttribute("user", user);
mmap.put("user", userService.selectUserById(userId));
return prefix + "/resetPwd";
}
@RequiresPermissions("system:user:resetPwd")
@Log(title = "重置密码", action = BusinessType.SAVE)
@Log(title = "重置密码", action = BusinessType.UPDATE)
@PostMapping("/resetPwd")
@ResponseBody
public AjaxResult resetPwd(User user)
{
int rows = userService.resetUserPwd(user);
if (rows > 0)
{
return success();
}
return error();
return toAjax(userService.resetUserPwd(user));
}
@RequiresPermissions("system:user:remove")
......@@ -139,8 +160,7 @@ public class UserController extends BaseController
{
try
{
userService.deleteUserByIds(ids);
return success();
return toAjax(userService.deleteUserByIds(ids));
}
catch (Exception e)
{
......@@ -149,23 +169,6 @@ public class UserController extends BaseController
}
/**
* 保存用户
*/
@RequiresPermissions("system:user:save")
@Log(title = "用户管理", action = BusinessType.SAVE)
@PostMapping("/save")
@Transactional(rollbackFor = Exception.class)
@ResponseBody
public AjaxResult save(User user)
{
if (StringUtils.isNotNull(user.getUserId()) && User.isAdmin(user.getUserId()))
{
return error("不允许修改超级管理员用户");
}
return userService.saveUser(user) > 0 ? success() : error();
}
/**
* 校验用户名
*/
@PostMapping("/checkLoginNameUnique")
......
......@@ -64,7 +64,7 @@ public interface IUserService
*
* @param ids 需要删除的数据ID
*/
public void deleteUserByIds(String ids) throws Exception;
public int deleteUserByIds(String ids) throws Exception;
/**
* 保存用户信息
......@@ -72,10 +72,10 @@ public interface IUserService
* @param user 用户信息
* @return 结果
*/
public int saveUser(User user);
public int insertUser(User user);
/**
* 修改用户信息
* 保存用户信息
*
* @param user 用户信息
* @return 结果
......@@ -83,6 +83,14 @@ public interface IUserService
public int updateUser(User user);
/**
* 修改用户详细信息
*
* @param user 用户信息
* @return 结果
*/
public int updateUserInfo(User user);
/**
* 修改用户密码信息
*
* @param user 用户信息
......
......@@ -25,7 +25,7 @@ import com.ruoyi.project.system.user.mapper.UserRoleMapper;
*
* @author ruoyi
*/
@Service("userService")
@Service
public class UserServiceImpl implements IUserService
{
@Autowired
......@@ -130,7 +130,7 @@ public class UserServiceImpl implements IUserService
* @return 结果
*/
@Override
public void deleteUserByIds(String ids) throws Exception
public int deleteUserByIds(String ids) throws Exception
{
Long[] userIds = Convert.toLongArray(ids);
for (Long userId : userIds)
......@@ -140,52 +140,32 @@ public class UserServiceImpl implements IUserService
throw new Exception("不允许删除超级管理员用户");
}
}
userMapper.deleteUserByIds(userIds);
return userMapper.deleteUserByIds(userIds);
}
/**
* 保存用户信息
* 新增保存用户信息
*
* @param user 用户信息
* @return 结果
*/
@Override
public int saveUser(User user)
public int insertUser(User user)
{
int count = 0;
Long userId = user.getUserId();
if (StringUtils.isNotNull(userId))
{
user.setUpdateBy(ShiroUtils.getLoginName());
// 修改用户信息
count = updateUser(user);
// 删除用户与角色关联
userRoleMapper.deleteUserRoleByUserId(userId);
// 新增用户与角色管理
insertUserRole(user);
// 删除用户与岗位关联
userPostMapper.deleteUserPostByUserId(userId);
// 新增用户与岗位管理
insertUserPost(user);
}
else
{
user.randomSalt();
user.setPassword(passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt()));
user.setCreateBy(ShiroUtils.getLoginName());
// 新增用户信息
count = userMapper.insertUser(user);
// 新增用户岗位关联
insertUserPost(user);
// 新增用户与角色管理
insertUserRole(user);
}
return count;
user.randomSalt();
user.setPassword(passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt()));
user.setCreateBy(ShiroUtils.getLoginName());
// 新增用户信息
int rows = userMapper.insertUser(user);
// 新增用户岗位关联
insertUserPost(user);
// 新增用户与角色管理
insertUserRole(user);
return rows;
}
/**
* 修改用户信息
* 修改保存用户信息
*
* @param user 用户信息
* @return 结果
......@@ -193,6 +173,28 @@ public class UserServiceImpl implements IUserService
@Override
public int updateUser(User user)
{
Long userId = user.getUserId();
user.setUpdateBy(ShiroUtils.getLoginName());
// 删除用户与角色关联
userRoleMapper.deleteUserRoleByUserId(userId);
// 新增用户与角色管理
insertUserRole(user);
// 删除用户与岗位关联
userPostMapper.deleteUserPostByUserId(userId);
// 新增用户与岗位管理
insertUserPost(user);
return userMapper.updateUser(user);
}
/**
* 修改用户个人详细信息
*
* @param user 用户信息
* @return 结果
*/
@Override
public int updateUserInfo(User user)
{
return userMapper.updateUser(user);
}
......@@ -280,14 +282,9 @@ public class UserServiceImpl implements IUserService
@Override
public String checkPhoneUnique(User user)
{
if (user.getUserId() == null)
{
user.setUserId(-1L);
}
Long userId = user.getUserId();
Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
User info = userMapper.checkPhoneUnique(user.getPhonenumber());
if (StringUtils.isNotNull(info) && StringUtils.isNotNull(info.getUserId())
&& info.getUserId().longValue() != userId.longValue())
if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue())
{
return UserConstants.USER_PHONE_NOT_UNIQUE;
}
......@@ -303,14 +300,9 @@ public class UserServiceImpl implements IUserService
@Override
public String checkEmailUnique(User user)
{
if (user.getUserId() == null)
{
user.setUserId(-1L);
}
Long userId = user.getUserId();
Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
User info = userMapper.checkEmailUnique(user.getEmail());
if (StringUtils.isNotNull(info) && StringUtils.isNotNull(info.getUserId())
&& info.getUserId().longValue() != userId.longValue())
if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue())
{
return UserConstants.USER_EMAIL_NOT_UNIQUE;
}
......
......@@ -28,7 +28,7 @@ import com.ruoyi.project.tool.gen.util.VelocityInitializer;
*
* @author ruoyi
*/
@Service("genService")
@Service
public class GenServiceImpl implements IGenService
{
@Autowired
......
# 项目名称、版本、版权年份
ruoyi:
name: RuoYi
version: 2.1.0
version: 2.2.0
copyrightYear: 2018
profile: D:/profile/
......
......@@ -20,14 +20,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select config_id, config_name, config_key, config_value, config_type, create_by, create_time, update_by, update_time, remark from sys_config
</sql>
<select id="selectConfigById" parameterType="Integer" resultMap="ConfigResult">
<include refid="selectConfigVo"/>
where config_id = #{configId}
</select>
<!-- 查询条件 -->
<sql id="sqlwhereSearch">
<where>
<if test="configId !=null">
and config_id = #{configId}
</if>
<if test="configKey !=null and configKey != ''">
and config_key = #{configKey}
</if>
</where>
</sql>
<select id="selectConfigByKey" parameterType="String" resultMap="ConfigResult">
<select id="selectConfig" parameterType="Config" resultMap="ConfigResult">
<include refid="selectConfigVo"/>
where config_key = #{configKey}
<include refid="sqlwhereSearch"/>
</select>
<select id="selectConfigList" parameterType="Config" resultMap="ConfigResult">
......@@ -51,6 +58,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
</select>
<select id="checkConfigKeyUnique" parameterType="String" resultMap="ConfigResult">
<include refid="selectConfigVo"/>
where config_key = #{configKey}
</select>
<insert id="insertConfig" parameterType="Config">
insert into sys_config (
<if test="configName != null and configName != '' ">config_name,</if>
......@@ -85,10 +97,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where config_id = #{configId}
</update>
<delete id="deleteConfigById" parameterType="Integer">
delete from sys_config where config_id = #{value}
</delete>
<delete id="deleteConfigByIds" parameterType="String">
delete from sys_config where config_id in
<foreach item="configId" collection="array" open="(" separator="," close=")">
......
......@@ -11,7 +11,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="dictValue" column="dict_value" />
<result property="dictType" column="dict_type" />
<result property="cssClass" column="css_class" />
<result property="isDefault" column="is_default" />
<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" />
......@@ -20,7 +21,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectDictDataVo">
select dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, is_default, status, create_by, create_time, remark from sys_dict_data
select dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, remark from sys_dict_data
</sql>
<select id="selectDictDataList" parameterType="DictData" resultMap="DictDataResult">
......@@ -43,6 +44,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where dict_type = #{dictType} order by dict_sort asc
</select>
<select id="selectDictLabel" resultType="String">
select dict_label from sys_dict_data
where dict_type = #{dictType} and dict_value = #{dictValue}
</select>
<select id="selectDictDataById" parameterType="Long" resultMap="DictDataResult">
<include refid="selectDictDataVo"/>
where dict_code = #{dictCode}
......@@ -71,6 +77,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="dictValue != null and dictValue != ''">dict_value = #{dictValue},</if>
<if test="dictType != null and dictType != ''">dict_type = #{dictType},</if>
<if test="cssClass != null and cssClass != ''">css_class = #{cssClass},</if>
<if test="listClass != null and listClass != ''">list_class = #{listClass},</if>
<if test="isDefault != null and isDefault != ''">is_default = #{isDefault},</if>
<if test="status != null">status = #{status},</if>
<if test="remark != null and remark != ''">remark = #{remark},</if>
......@@ -88,6 +95,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="dictValue != null and dictValue != ''">dict_value,</if>
<if test="dictType != null and dictType != ''">dict_type,</if>
<if test="cssClass != null and cssClass != ''">css_class,</if>
<if test="listClass != null and listClass != ''">list_class,</if>
<if test="isDefault != null and isDefault != ''">is_default,</if>
<if test="status != null">status,</if>
<if test="remark != null and remark != ''">remark,</if>
......@@ -99,6 +107,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="dictValue != null and dictValue != ''">#{dictValue},</if>
<if test="dictType != null and dictType != ''">#{dictType},</if>
<if test="cssClass != null and cssClass != ''">#{cssClass},</if>
<if test="listClass != null and listClass != ''">#{listClass},</if>
<if test="isDefault != null and isDefault != ''">#{isDefault},</if>
<if test="status != null">#{status},</if>
<if test="remark != null and remark != ''">#{remark},</if>
......
......@@ -21,7 +21,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select notice_id, notice_title, notice_type, notice_content, status, create_by, create_time, update_by, update_time, remark from sys_notice
</sql>
<select id="selectNoticeById" parameterType="Integer" resultMap="NoticeResult">
<select id="selectNoticeById" parameterType="Long" resultMap="NoticeResult">
<include refid="selectNoticeVo"/>
where notice_id = #{noticeId}
</select>
......
......@@ -53,10 +53,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where post_id = #{postId}
</select>
<delete id="deletePostById" parameterType="Long">
delete from sys_post where post_id = #{postId}
</delete>
<delete id="deletePostByIds" parameterType="Long">
delete from sys_post where post_id in
<foreach collection="array" item="postId" open="(" separator="," close=")">
......
......@@ -187,7 +187,6 @@ $(function() {
});
function menuItem() {
$.modal.loading("数据加载中,请稍后...");
// 获取标识数据
var dataUrl = $(this).attr('href'),
dataIndex = $(this).data('index'),
......@@ -221,12 +220,17 @@ $(function() {
// 添加选项卡对应的iframe
var str1 = '<iframe class="RuoYi_iframe" name="iframe' + dataIndex + '" width="100%" height="100%" src="' + dataUrl + '" frameborder="0" data-id="' + dataUrl + '" seamless></iframe>';
$('.mainContent').find('iframe.RuoYi_iframe').hide().parents('.mainContent').append(str1);
$.modal.loading("数据加载中,请稍后...");
$('.mainContent iframe:visible').load(function () {
$.modal.closeLoading();
});
// 添加选项卡
$('.menuTabs .page-tabs-content').append(str);
scrollToTab($('.menuTab.active'));
}
$.modal.closeLoading();
return false;
}
......
......@@ -95,6 +95,17 @@
return $.map($('#bootstrap-table').bootstrapTable('getSelections'), function (row) {
return row[$.table._option.columns[1].field];
});
},
// 回显数据字典
selectDictLabel: function(_datas, _value) {
var actions = [];
$.each(_datas, function(index, dict) {
if (dict.dictValue == _value) {
actions.push("<span class='badge badge-" + dict.listClass + "'>" + dict.dictLabel + "</span>");
return false;
}
});
return actions.join('');
}
},
// 表格树封装处理
......
......@@ -40,8 +40,8 @@
<script th:src="@{/ajax/libs/blockUI/jquery.blockUI.js}"></script>
<script th:src="@{/ajax/libs/layer/layer.min.js}"></script>
<script th:src="@{/ajax/libs/layui/layui.js}"></script>
<script th:src="@{/ruoyi/js/common.js?v=2.1.0}"></script>
<script th:src="@{/ruoyi/js/ry-ui.min.js?v=2.1.0}"></script>
<script th:src="@{/ruoyi/js/common.js?v=2.2.0}"></script>
<script th:src="@{/ruoyi/js/ry-ui.min.js?v=2.2.0}"></script>
<script src="http://tajs.qq.com/stats?sId=62048022"></script>
<script th:inline="javascript"> var ctx = [[@{/}]]; </script>
</div>
......@@ -15,12 +15,12 @@
<link th:href="@{/css/font-awesome.css}" rel="stylesheet"/>
<link th:href="@{/css/animate.css}" rel="stylesheet"/>
<link th:href="@{/css/style.css}" rel="stylesheet"/>
<link th:href="@{/ruoyi/css/ry-ui.min.css?v=2.1.0}" rel="stylesheet"/>
<link th:href="@{/ruoyi/css/ry-ui.min.css?v=2.2.0}" rel="stylesheet"/>
<style type="text/css">
.nav > li:hover .dropdown-menu {display: block;}
</style>
</head>
<body class="fixed-sidebar full-height-layout gray-bg" style="overflow: hidden" th:classappend="${@configService.selectConfigByKey('sys.index.skinName')}">
<body class="fixed-sidebar full-height-layout gray-bg" style="overflow: hidden" th:classappend="${@config.getKey('sys.index.skinName')}">
<div id="wrapper">
<!--左侧导航开始-->
......@@ -136,7 +136,7 @@
<script th:src="@{/js/plugins/slimscroll/jquery.slimscroll.min.js}"></script>
<script th:src="@{/ajax/libs/blockUI/jquery.blockUI.js}"></script>
<script src="http://tajs.qq.com/stats?sId=62048022"></script>
<script th:src="@{/ruoyi/js/ry-ui.min.js?v=2.1.0}"></script>
<script th:src="@{/ruoyi/js/ry-ui.min.js?v=2.2.0}"></script>
<script th:src="@{/ruoyi/index.js}"></script>
<script th:src="@{/ajax/libs/fullscreen/jquery.fullscreen.js}"></script>
</body>
......
......@@ -12,7 +12,7 @@
<link href="../static/css/style.css" th:href="@{css/style.css}" rel="stylesheet"/>
<link href="../static/css/login.min.css" th:href="@{css/login.min.css}" rel="stylesheet"/>
<link href="../static/ajax/libs/iCheck/custom.css" th:href="@{/ajax/libs/iCheck/custom.css}" rel="stylesheet"/>
<link href="../static/ruoyi/css/ry-ui.min.css" th:href="@{/ruoyi/css/ry-ui.min.css?v=2.1.0}" rel="stylesheet"/>
<link href="../static/ruoyi/css/ry-ui.min.css" th:href="@{/ruoyi/css/ry-ui.min.css?v=2.2.0}" rel="stylesheet"/>
<!--[if lt IE 9]>
<meta http-equiv="refresh" content="0;ie.html" />
<![endif]-->
......@@ -81,7 +81,7 @@
<script src="../static/ajax/libs/iCheck/icheck.min.js" th:src="@{/ajax/libs/iCheck/icheck.min.js}"></script>
<script src="../static/ajax/libs/blockUI/jquery.blockUI.js" th:src="@{/ajax/libs/blockUI/jquery.blockUI.js}"></script>
<script src="http://tajs.qq.com/stats?sId=62048022"></script>
<script src="../static/ruoyi/js/ry-ui.min.js" th:src="@{/ruoyi/js/ry-ui.min.js?v=2.1.0}"></script>
<script src="../static/ruoyi/js/ry-ui.min.js" th:src="@{/ruoyi/js/ry-ui.min.js?v=2.2.0}"></script>
<script src="../static/ruoyi/login.js" th:src="@{/ruoyi/login.js}"></script>
</body>
</html>
......@@ -97,10 +97,34 @@
<div class="panel panel-default">
<div class="panel-heading">
<h5 class="panel-title">
<a data-toggle="collapse" data-parent="#version" href="#v20">v2.1.0</a><code class="pull-right">2018.07.10</code>
<a data-toggle="collapse" data-parent="#version" href="#v22">v2.2.0</a><code class="pull-right">2018.07.23</code>
</h5>
</div>
<div id="v20" class="panel-collapse collapse in">
<div id="v22" class="panel-collapse collapse in">
<div class="panel-body">
<ol>
<li>修复批量生成代码异常问题</li>
<li>修复定时器保存失败问题</li>
<li>修复热部署转换问题</li>
<li>支持查询&统一样式(菜单管理,部门管理)</li>
<li>大多数功能支持时间查询</li>
<li>去掉自定义导出注解column列变更为自动匹配</li>
<li>新增任务执行策略</li>
<li>操作详细动态显示类型</li>
<li>支持动态回显字典数据</li>
<li>后台代码优化调整</li>
<li>其他细节优化</li>
</ol>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h5 class="panel-title">
<a data-toggle="collapse" data-parent="#version" href="#v21">v2.1.0</a><code class="pull-right">2018.07.10</code>
</h5>
</div>
<div id="v21" class="panel-collapse collapse">
<div class="panel-body">
<ol>
<li>新增登陆超时提醒</li>
......
......@@ -46,7 +46,7 @@
</div>
<div class="form-group">
<label class="col-sm-3 control-label">状态:</label>
<div class="col-sm-8" th:with="type=${@dictService.selectDictData('sys_job_status')}">
<div class="col-sm-8" th:with="type=${@dict.getType('sys_job_status')}">
<div th:each="dict : ${type}" th:class="${dict['cssClass']}">
<input type="radio" th:id="${dict['dictCode']}" name="status" th:value="${dict['dictValue']}" th:checked="${dict['isDefault'] == 'Y' ? true : false}">
<label th:for="${dict['dictCode']}" th:text="${dict['dictLabel']}"></label>
......@@ -85,7 +85,7 @@
},
},
submitHandler:function(form){
$.operate.save(prefix + "/save", $('#form-job-add').serialize());
$.operate.save(prefix + "/add", $('#form-job-add').serialize());
}
});
</script>
......
......@@ -47,7 +47,7 @@
</div>
<div class="form-group">
<label class="col-sm-3 control-label">状态:</label>
<div class="col-sm-8" th:with="type=${@dictService.selectDictData('sys_job_status')}">
<div class="col-sm-8" th:with="type=${@dict.getType('sys_job_status')}">
<div th:each="dict : ${type}" th:class="${dict['cssClass']}">
<input type="radio" th:id="${dict['dictCode']}" name="status" th:value="${dict['dictValue']}" th:field="*{status}">
<label th:for="${dict['dictCode']}" th:text="${dict['dictLabel']}"></label>
......@@ -86,7 +86,7 @@
},
},
submitHandler:function(form){
$.operate.save(prefix + "/save", $('#form-job-edit').serialize());
$.operate.save(prefix + "/edit", $('#form-job-edit').serialize());
}
});
</script>
......
......@@ -18,7 +18,7 @@
方法名称:<input type="text" name="methodName"/>
</li>
<li>
任务状态:<select name="status" th:with="type=${@dictService.selectDictData('sys_job_status')}">
任务状态:<select name="status" th:with="type=${@dict.getType('sys_job_status')}">
<option value="">所有</option>
<option th:each="e : ${type}" th:text="${e['dictLabel']}" th:value="${e['dictValue']}"></option>
</select>
......@@ -51,9 +51,10 @@
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
var editFlag = [[${@permissionService.hasPermi('monitor:job:edit')}]];
var removeFlag = [[${@permissionService.hasPermi('monitor:job:remove')}]];
var statusFlag = [[${@permissionService.hasPermi('monitor:job:changeStatus')}]];
var editFlag = [[${@permission.hasPermi('monitor:job:edit')}]];
var removeFlag = [[${@permission.hasPermi('monitor:job:remove')}]];
var statusFlag = [[${@permission.hasPermi('monitor:job:changeStatus')}]];
var datas = [[${@dict.getType('sys_job_status')}]];
var prefix = ctx + "monitor/job"
$(function() {
......@@ -102,11 +103,7 @@
title: '任务状态',
align: 'center',
formatter: function(value, row, index) {
if (value == 0) {
return '<span class="badge badge-primary">正常</span>';
} else if (value == 1) {
return '<span class="badge badge-danger">暂停</span>';
}
return $.table.selectDictLabel(datas, value);
}
},
{
......
......@@ -18,7 +18,7 @@
<label>方法名称:</label><input type="text" name="methodName"/>
</li>
<li>
<label>执行状态:</label><select name="status" th:with="type=${@dictService.selectDictData('sys_common_status')}">
<label>执行状态:</label><select name="status" th:with="type=${@dict.getType('sys_common_status')}">
<option value="">所有</option>
<option th:each="e : ${type}" th:text="${e['dictLabel']}" th:value="${e['dictValue']}"></option>
</select>
......@@ -51,7 +51,8 @@
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
var removeFlag = [[${@permissionService.hasPermi('monitor:job:remove')}]];
var removeFlag = [[${@permission.hasPermi('monitor:job:remove')}]];
var datas = [[${@dict.getType('sys_job_status')}]];
var prefix = ctx + "monitor/jobLog"
$(function() {
......@@ -98,11 +99,7 @@
title: '状态',
align: 'center',
formatter: function(value, row, index) {
if (value == 0) {
return '<span class="badge badge-primary">正常</span>';
} else if (value == 1) {
return '<span class="badge badge-danger">失败</span>';
}
return $.table.selectDictLabel(datas, value);
}
},
{
......
......@@ -18,7 +18,7 @@
<label>登录名称:</label><input type="text" name="loginName"/>
</li>
<li>
<label>登录状态:</label><select name="status" th:with="type=${@dictService.selectDictData('sys_common_status')}">
<label>登录状态:</label><select name="status" th:with="type=${@dict.getType('sys_common_status')}">
<option value="">所有</option>
<option th:each="e : ${type}" th:text="${e['dictLabel']}" th:value="${e['dictValue']}"></option>
</select>
......@@ -51,7 +51,8 @@
</div>
<div th:include="include :: footer"></div>
<script type="text/javascript">
<script th:inline="javascript">
var datas = [[${@dict.getType('sys_common_status')}]];
var prefix = ctx + "monitor/logininfor"
$(function() {
......@@ -96,11 +97,7 @@
title: '登录状态',
align: 'center',
formatter: function(value, row, index) {
if (value == 0) {
return '<span class="badge badge-primary">成功</span>';
} else if (value == 1) {
return '<span class="badge badge-danger">失败</span>';
}
return $.table.selectDictLabel(datas, value);
}
},
{
......
......@@ -38,7 +38,7 @@
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
var forceFlag = [[${@permissionService.hasPermi('monitor:online:forceLogout')}]];
var forceFlag = [[${@permission.hasPermi('monitor:online:forceLogout')}]];
var prefix = ctx + "monitor/online"
$(function() {
......
......@@ -8,7 +8,7 @@
<form class="form-horizontal m-t" id="signupForm">
<div class="form-group">
<label class="col-sm-2 control-label">操作模块:</label>
<div class="form-control-static" th:text="${operLog.title} + ' / ' + ${operLog.action}">
<div class="form-control-static" th:text="${operLog.title} + ' / ' + ${@dict.getLabel('sys_oper_type',operLog.action)}">
</div>
</div>
<div class="form-group">
......
......@@ -18,7 +18,7 @@
<label>操作人员: </label><input type="text" name="operName"/>
</li>
<li>
<label>操作类型: </label><select name="action" th:with="type=${@dictService.selectDictData('sys_oper_type')}">
<label>操作类型: </label><select name="action" th:with="type=${@dict.getType('sys_oper_type')}">
<option value="">所有</option>
<option th:each="e : ${type}" th:text="${e['dictLabel']}" th:value="${e['dictValue']}"></option>
</select>
......@@ -52,7 +52,8 @@
<div th:include="include :: footer"></div>
<script th:inline="javascript">
var detailFlag = [[${@permissionService.hasPermi('monitor:operlog:detail')}]];
var detailFlag = [[${@permission.hasPermi('monitor:operlog:detail')}]];
var datas = [[${@dict.getType('sys_oper_type')}]];
var prefix = ctx + "monitor/operlog"
$(function() {
......@@ -80,27 +81,7 @@
title: '操作类型',
align: 'center',
formatter: function(value, row, index) {
if (value == 1) {
return '<span class="badge badge-primary">新增</span>';
} else if (value == 2) {
return '<span class="badge badge-primary">修改</span>';
} else if (value == 3) {
return '<span class="badge badge-warning">保存</span>';
} else if (value == 4) {
return '<span class="badge badge-danger">删除</span>';
} else if (value == 5) {
return '<span class="badge badge-primary">授权</span>';
} else if (value == 6) {
return '<span class="badge badge-warning">导出</span>';
} else if (value == 7) {
return '<span class="badge badge-warning">导入</span>';
} else if (value == 8) {
return '<span class="badge badge-danger">强退</span>';
} else if (value == 9) {
return '<span class="badge badge-danger">禁止访问</span>';
} else if (value == 10) {
return '<span class="badge badge-warning">生成代码</span>';
}
return $.table.selectDictLabel(datas, value);
}
},
{
......
......@@ -25,7 +25,7 @@
</div>
<div class="form-group">
<label class="col-sm-3 control-label">系统内置:</label>
<div class="col-sm-8" th:with="type=${@dictService.selectDictData('sys_yes_no')}">
<div class="col-sm-8" th:with="type=${@dict.getType('sys_yes_no')}">
<div th:each="dict : ${type}" th:class="${dict['cssClass']}">
<input type="radio" th:id="${dict['dictCode']}" name="configType" th:value="${dict['dictValue']}" th:checked="${dict['isDefault'] == 'Y' ? true : false}">
<label th:for="${dict['dictCode']}" th:text="${dict['dictLabel']}"></label>
......@@ -82,7 +82,7 @@
}
},
submitHandler: function(form) {
$.operate.save(prefix + "/save", $('#form-config-add').serialize());
$.operate.save(prefix + "/add", $('#form-config-add').serialize());
}
});
</script>
......
......@@ -17,7 +17,7 @@
参数键名:<input type="text" name="configKey"/>
</li>
<li>
系统内置:<select name="configType" th:with="type=${@dictService.selectDictData('sys_yes_no')}">
系统内置:<select name="configType" th:with="type=${@dict.getType('sys_yes_no')}">
<option value="">所有</option>
<option th:each="e : ${type}" th:text="${e['dictLabel']}" th:value="${e['dictValue']}"></option>
</select>
......@@ -52,8 +52,9 @@
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
var editFlag = [[${@permissionService.hasPermi('system:config:edit')}]];
var removeFlag = [[${@permissionService.hasPermi('system:config:remove')}]];
var editFlag = [[${@permission.hasPermi('system:config:edit')}]];
var removeFlag = [[${@permission.hasPermi('system:config:remove')}]];
var datas = [[${@dict.getType('sys_yes_no')}]];
var prefix = ctx + "system/config"
$(function() {
......@@ -92,11 +93,7 @@
title: '系统内置',
align: 'center',
formatter: function(value, row, index) {
if (value == 'Y') {
return '<span class="badge badge-primary">是</span>';
} else if (value == 'N') {
return '<span class="badge badge-danger">否</span>';
}
return $.table.selectDictLabel(datas, value);
}
},
{
......
......@@ -26,7 +26,7 @@
</div>
<div class="form-group">
<label class="col-sm-3 control-label">系统内置:</label>
<div class="col-sm-8" th:with="type=${@dictService.selectDictData('sys_yes_no')}">
<div class="col-sm-8" th:with="type=${@dict.getType('sys_yes_no')}">
<div th:each="dict : ${type}" th:class="${dict['cssClass']}">
<input type="radio" th:id="${dict['dictCode']}" name="configType" th:value="${dict['dictValue']}" th:field="*{configType}">
<label th:for="${dict['dictCode']}" th:text="${dict['dictLabel']}"></label>
......@@ -86,7 +86,7 @@
}
},
submitHandler: function(form) {
$.operate.save(prefix + "/save", $('#form-config-edit').serialize());
$.operate.save(prefix + "/edit", $('#form-config-edit').serialize());
}
});
</script>
......
......@@ -44,7 +44,7 @@
</div>
<div class="form-group">
<label class="col-sm-3 control-label">部门状态:</label>
<div class="col-sm-8" th:with="type=${@dictService.selectDictData('sys_normal_disable')}">
<div class="col-sm-8" th:with="type=${@dict.getType('sys_normal_disable')}">
<div th:each="dict : ${type}" th:class="${dict['cssClass']}">
<input type="radio" th:id="${dict['dictCode']}" name="status" th:value="${dict['dictValue']}" th:checked="${dict['isDefault'] == 'Y' ? true : false}">
<label th:for="${dict['dictCode']}" th:text="${dict['dictLabel']}"></label>
......@@ -94,7 +94,7 @@
}
},
submitHandler:function(form){
$.operate.save(prefix + "/save", $('#form-dept-add').serialize());
$.operate.save(prefix + "/add", $('#form-dept-add').serialize());
}
});
......
......@@ -14,7 +14,7 @@
部门名称:<input type="text" name="deptName"/>
</li>
<li>
部门状态:<select name="status" th:with="type=${@dictService.selectDictData('sys_normal_disable')}">
部门状态:<select name="status" th:with="type=${@dict.getType('sys_normal_disable')}">
<option value="">所有</option>
<option th:each="e : ${type}" th:text="${e['dictLabel']}" th:value="${e['dictValue']}"></option>
</select>
......@@ -39,9 +39,10 @@
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
var addFlag = [[${@permissionService.hasPermi('system:dept:add')}]];
var editFlag = [[${@permissionService.hasPermi('system:dept:edit')}]];
var removeFlag = [[${@permissionService.hasPermi('system:dept:remove')}]];
var addFlag = [[${@permission.hasPermi('system:dept:add')}]];
var editFlag = [[${@permission.hasPermi('system:dept:edit')}]];
var removeFlag = [[${@permission.hasPermi('system:dept:remove')}]];
var datas = [[${@dict.getType('sys_normal_disable')}]];
var prefix = ctx + "system/dept"
window.onload = function() {
......@@ -71,11 +72,7 @@
title: '状态',
align: "center",
formatter: function(item, index) {
if (item.status == '0') {
return '<span class="badge badge-primary">正常</span>';
} else if (item.status == '1') {
return '<span class="badge badge-danger">停用</span>';
}
return $.table.selectDictLabel(datas, item.status);
}
},
{
......
......@@ -45,7 +45,7 @@
</div>
<div class="form-group">
<label class="col-sm-3 control-label">部门状态:</label>
<div class="col-sm-8" th:with="type=${@dictService.selectDictData('sys_normal_disable')}">
<div class="col-sm-8" th:with="type=${@dict.getType('sys_normal_disable')}">
<div th:each="dict : ${type}" th:class="${dict['cssClass']}">
<input type="radio" th:id="${dict['dictCode']}" name="status" th:value="${dict['dictValue']}" th:field="*{status}">
<label th:for="${dict['dictCode']}" th:text="${dict['dictLabel']}"></label>
......@@ -97,7 +97,7 @@
}
},
submitHandler:function(form){
$.operate.save(prefix + "/save", $('#form-dept-edit').serialize());
$.operate.save(prefix + "/edit", $('#form-dept-edit').serialize());
}
});
......
......@@ -30,8 +30,14 @@
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">回显样式:</label>
<div class="col-sm-8">
<input class="form-control" type="text" id="listClass" name="listClass">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">系统默认:</label>
<div class="col-sm-8" th:with="type=${@dictService.selectDictData('sys_yes_no')}">
<div class="col-sm-8" th:with="type=${@dict.getType('sys_yes_no')}">
<div th:each="dict : ${type}" th:class="${dict['cssClass']}">
<input type="radio" th:id="${dict['dictCode']}" name="isDefault" th:value="${dict['dictValue']}" th:checked="${dict['isDefault'] == 'Y' ? true : false}">
<label th:for="${dict['dictCode']}" th:text="${dict['dictLabel']}"></label>
......@@ -46,7 +52,7 @@
</div>
<div class="form-group">
<label class="col-sm-3 control-label">状态:</label>
<div class="col-sm-8" th:with="type=${@dictService.selectDictData('sys_normal_disable')}">
<div class="col-sm-8" th:with="type=${@dict.getType('sys_normal_disable')}">
<div th:each="dict : ${type}" th:class="${dict['cssClass']}">
<input type="radio" th:id="${dict['dictCode']}" name="status" th:value="${dict['dictValue']}" th:checked="${dict['isDefault'] == 'Y' ? true : false}">
<label th:for="${dict['dictCode']}" th:text="${dict['dictLabel']}"></label>
......@@ -86,7 +92,7 @@
},
},
submitHandler:function(form){
$.operate.save(prefix + "/save", $('#form-dict-add').serialize());
$.operate.save(prefix + "/add", $('#form-dict-add').serialize());
}
});
</script>
......
......@@ -20,7 +20,7 @@
字典标签:<input type="text" name="dictLabel"/>
</li>
<li>
数据状态:<select name="status" th:with="type=${@dictService.selectDictData('sys_normal_disable')}">
数据状态:<select name="status" th:with="type=${@dict.getType('sys_normal_disable')}">
<option value="">所有</option>
<option th:each="e : ${type}" th:text="${e['dictLabel']}" th:value="${e['dictValue']}"></option>
</select>
......@@ -51,8 +51,9 @@
<div th:include="include :: footer"></div>
<script th:src="@{/ajax/libs/select/select2.js}"></script>
<script th:inline="javascript">
var editFlag = [[${@permissionService.hasPermi('system:dict:edit')}]];
var removeFlag = [[${@permissionService.hasPermi('system:dict:remove')}]];
var editFlag = [[${@permission.hasPermi('system:dict:edit')}]];
var removeFlag = [[${@permission.hasPermi('system:dict:remove')}]];
var datas = [[${@dict.getType('sys_normal_disable')}]];
var prefix = ctx + "system/dict/data"
$(function() {
......@@ -92,11 +93,7 @@
title: '状态',
align: 'center',
formatter: function(value, row, index) {
if (value == 0) {
return '<span class="badge badge-primary">正常</span>';
} else if (value == 1) {
return '<span class="badge badge-danger">停用</span>';
}
return $.table.selectDictLabel(datas, value);
}
},
{
......
......@@ -31,8 +31,14 @@
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">回显样式:</label>
<div class="col-sm-8">
<input class="form-control" type="text" id="listClass" name="listClass" th:field="*{listClass}">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">系统默认:</label>
<div class="col-sm-8" th:with="type=${@dictService.selectDictData('sys_yes_no')}">
<div class="col-sm-8" th:with="type=${@dict.getType('sys_yes_no')}">
<div th:each="dict : ${type}" th:class="${dict['cssClass']}">
<input type="radio" th:id="${dict['dictCode']}" name="isDefault" th:value="${dict['dictValue']}" th:field="*{isDefault}">
<label th:for="${dict['dictCode']}" th:text="${dict['dictLabel']}"></label>
......@@ -47,7 +53,7 @@
</div>
<div class="form-group">
<label class="col-sm-3 control-label">状态:</label>
<div class="col-sm-8" th:with="type=${@dictService.selectDictData('sys_normal_disable')}">
<div class="col-sm-8" th:with="type=${@dict.getType('sys_normal_disable')}">
<div th:each="dict : ${type}" th:class="${dict['cssClass']}">
<input type="radio" th:id="${dict['dictCode']}" name="status" th:value="${dict['dictValue']}" th:field="*{status}">
<label th:for="${dict['dictCode']}" th:text="${dict['dictLabel']}"></label>
......@@ -87,7 +93,7 @@
},
},
submitHandler:function(form){
$.operate.save(prefix + "/save", $('#form-dict-edit').serialize());
$.operate.save(prefix + "/edit", $('#form-dict-edit').serialize());
}
});
</script>
......
......@@ -19,7 +19,7 @@
</div>
<div class="form-group">
<label class="col-sm-3 control-label">状态:</label>
<div class="col-sm-8" th:with="type=${@dictService.selectDictData('sys_normal_disable')}">
<div class="col-sm-8" th:with="type=${@dict.getType('sys_normal_disable')}">
<div th:each="dict : ${type}" th:class="${dict['cssClass']}">
<input type="radio" th:id="${dict['dictCode']}" name="status" th:value="${dict['dictValue']}" th:checked="${dict['isDefault'] == 'Y' ? true : false}">
<label th:for="${dict['dictCode']}" th:text="${dict['dictLabel']}"></label>
......@@ -75,7 +75,7 @@
}
},
submitHandler:function(form){
$.operate.save(prefix + "/save", $('#form-dict-add').serialize());
$.operate.save(prefix + "/add", $('#form-dict-add').serialize());
}
});
</script>
......
......@@ -20,7 +20,7 @@
</div>
<div class="form-group">
<label class="col-sm-3 control-label">状态:</label>
<div class="col-sm-8" th:with="type=${@dictService.selectDictData('sys_normal_disable')}">
<div class="col-sm-8" th:with="type=${@dict.getType('sys_normal_disable')}">
<div th:each="dict : ${type}" th:class="${dict['cssClass']}">
<input type="radio" th:id="${dict['dictCode']}" name="status" th:value="${dict['dictValue']}" th:field="*{status}">
<label th:for="${dict['dictCode']}" th:text="${dict['dictLabel']}"></label>
......@@ -79,7 +79,7 @@
}
},
submitHandler:function(form){
$.operate.save(prefix + "/save", $('#form-dict-edit').serialize());
$.operate.save(prefix + "/edit", $('#form-dict-edit').serialize());
}
});
</script>
......
......@@ -18,7 +18,7 @@
字典类型:<input type="text" name="dictType"/>
</li>
<li>
字典状态:<select name="status" th:with="type=${@dictService.selectDictData('sys_normal_disable')}">
字典状态:<select name="status" th:with="type=${@dict.getType('sys_normal_disable')}">
<option value="">所有</option>
<option th:each="e : ${type}" th:text="${e['dictLabel']}" th:value="${e['dictValue']}"></option>
</select>
......@@ -54,9 +54,10 @@
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
var editFlag = [[${@permissionService.hasPermi('system:dict:edit')}]];
var listFlag = [[${@permissionService.hasPermi('system:dict:list')}]];
var removeFlag = [[${@permissionService.hasPermi('system:dict:remove')}]];
var editFlag = [[${@permission.hasPermi('system:dict:edit')}]];
var listFlag = [[${@permission.hasPermi('system:dict:list')}]];
var removeFlag = [[${@permission.hasPermi('system:dict:remove')}]];
var datas = [[${@dict.getType('sys_normal_disable')}]];
var prefix = ctx + "system/dict"
$(function() {
......@@ -96,11 +97,7 @@
title: '状态',
align: 'center',
formatter: function(value, row, index) {
if (value == 0) {
return '<span class="badge badge-primary">正常</span>';
} else if (value == 1) {
return '<span class="badge badge-danger">停用</span>';
}
return $.table.selectDictLabel(datas, value);
}
},
{
......
......@@ -58,7 +58,7 @@
</div>
<div class="form-group">
<label class="col-sm-3 control-label">菜单状态:</label>
<div class="col-sm-8" th:with="type=${@dictService.selectDictData('sys_show_hide')}">
<div class="col-sm-8" th:with="type=${@dict.getType('sys_show_hide')}">
<div th:each="dict : ${type}" th:class="${dict['cssClass']}">
<input type="radio" th:id="${dict['dictCode']}" name="visible" th:value="${dict['dictValue']}" th:checked="${dict['isDefault'] == 'Y' ? true : false}">
<label th:for="${dict['dictCode']}" th:text="${dict['dictLabel']}"></label>
......@@ -107,7 +107,7 @@
}
},
submitHandler:function(form){
$.operate.save(prefix + "/save", $('#form-menu-add').serialize());
$.operate.save(prefix + "/add", $('#form-menu-add').serialize());
}
});
......
......@@ -59,7 +59,7 @@
</div>
<div class="form-group">
<label class="col-sm-3 control-label">菜单状态:</label>
<div class="col-sm-8" th:with="type=${@dictService.selectDictData('sys_show_hide')}">
<div class="col-sm-8" th:with="type=${@dict.getType('sys_show_hide')}">
<div th:each="dict : ${type}" th:class="${dict['cssClass']}">
<input type="radio" th:id="${dict['dictCode']}" name="visible" th:value="${dict['dictValue']}" th:field="*{visible}">
<label th:for="${dict['dictCode']}" th:text="${dict['dictLabel']}"></label>
......@@ -117,7 +117,7 @@
}
},
submitHandler:function(form){
$.operate.save(prefix + "/save", $('#form-menu-edit').serialize());
$.operate.save(prefix + "/edit", $('#form-menu-edit').serialize());
}
});
......
......@@ -14,7 +14,7 @@
菜单名称:<input type="text" name="menuName"/>
</li>
<li>
菜单状态:<select name="visible" th:with="type=${@dictService.selectDictData('sys_show_hide')}">
菜单状态:<select name="visible" th:with="type=${@dict.getType('sys_show_hide')}">
<option value="">所有</option>
<option th:each="e : ${type}" th:text="${e['dictLabel']}" th:value="${e['dictValue']}"></option>
</select>
......@@ -40,9 +40,10 @@
<div th:include="include :: footer"></div>
<script th:inline="javascript">
var addFlag = [[${@permissionService.hasPermi('system:menu:add')}]];
var editFlag = [[${@permissionService.hasPermi('system:menu:edit')}]];
var removeFlag = [[${@permissionService.hasPermi('system:menu:remove')}]];
var addFlag = [[${@permission.hasPermi('system:menu:add')}]];
var editFlag = [[${@permission.hasPermi('system:menu:edit')}]];
var removeFlag = [[${@permission.hasPermi('system:menu:remove')}]];
var datas = [[${@dict.getType('sys_show_hide')}]];
var prefix = ctx + "system/menu"
window.onload = function() {
......@@ -106,11 +107,7 @@
width: '10%',
align: "center",
formatter: function(row, index) {
if (row.visible == 0) {
return '<span class="badge badge-primary">显示</span>';
} else if (row.visible == 1) {
return '<span class="badge badge-danger">隐藏</span>';
}
return $.table.selectDictLabel(datas, row.visible);
}
},
{
......
......@@ -16,7 +16,7 @@
<div class="form-group">
<label class="col-sm-3 control-label">公告类型:</label>
<div class="col-sm-8">
<select name="noticeType" class="form-control m-b" th:with="type=${@dictService.selectDictData('sys_notice_type')}">
<select name="noticeType" class="form-control m-b" th:with="type=${@dict.getType('sys_notice_type')}">
<option th:each="dict : ${type}" th:text="${dict['dictLabel']}" th:value="${dict['dictValue']}"></option>
</select>
</div>
......@@ -30,7 +30,7 @@
</div>
<div class="form-group">
<label class="col-sm-3 control-label">公告状态:</label>
<div class="col-sm-8" th:with="type=${@dictService.selectDictData('sys_notice_status')}">
<div class="col-sm-8" th:with="type=${@dict.getType('sys_notice_status')}">
<div th:each="dict : ${type}" th:class="${dict['cssClass']}">
<input type="radio" th:id="${dict['dictCode']}" name="status" th:value="${dict['dictValue']}" th:checked="${dict['isDefault'] == 'Y' ? true : false}">
<label th:for="${dict['dictCode']}" th:text="${dict['dictLabel']}"></label>
......@@ -65,7 +65,7 @@
submitHandler: function(form) {
var sHTML = $('.summernote').code();
$("#noticeContent").val(sHTML);
$.operate.save(prefix + "/save", $('#form-notice-add').serialize());
$.operate.save(prefix + "/add", $('#form-notice-add').serialize());
}
});
</script>
......
......@@ -17,7 +17,7 @@
<div class="form-group">
<label class="col-sm-3 control-label">公告类型:</label>
<div class="col-sm-8">
<select name="noticeType" class="form-control m-b" th:with="type=${@dictService.selectDictData('sys_notice_type')}">
<select name="noticeType" class="form-control m-b" th:with="type=${@dict.getType('sys_notice_type')}">
<option th:each="dict : ${type}" th:text="${dict['dictLabel']}" th:value="${dict['dictValue']}" th:field="*{noticeType}"></option>
</select>
</div>
......@@ -31,7 +31,7 @@
</div>
<div class="form-group">
<label class="col-sm-3 control-label">公告状态:</label>
<div class="col-sm-8" th:with="type=${@dictService.selectDictData('sys_notice_status')}">
<div class="col-sm-8" th:with="type=${@dict.getType('sys_notice_status')}">
<div th:each="dict : ${type}" th:class="${dict['cssClass']}">
<input type="radio" th:id="${dict['dictCode']}" name="status" th:value="${dict['dictValue']}" th:field="*{status}">
<label th:for="${dict['dictCode']}" th:text="${dict['dictLabel']}"></label>
......@@ -69,7 +69,7 @@
submitHandler: function(form) {
var sHTML = $('.summernote').code();
$("#noticeContent").val(sHTML);
$.operate.save(prefix + "/save", $('#form-notice-edit').serialize());
$.operate.save(prefix + "/edit", $('#form-notice-edit').serialize());
}
});
</script>
......
......@@ -17,7 +17,7 @@
操作人员:<input type="text" name="createBy"/>
</li>
<li>
公告类型:<select name="noticeType" th:with="type=${@dictService.selectDictData('sys_notice_type')}">
公告类型:<select name="noticeType" th:with="type=${@dict.getType('sys_notice_type')}">
<option value="">所有</option>
<option th:each="e : ${type}" th:text="${e['dictLabel']}" th:value="${e['dictValue']}"></option>
</select>
......@@ -46,8 +46,10 @@
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
var editFlag = [[${@permissionService.hasPermi('system:notice:edit')}]];
var removeFlag = [[${@permissionService.hasPermi('system:notice:remove')}]];
var editFlag = [[${@permission.hasPermi('system:notice:edit')}]];
var removeFlag = [[${@permission.hasPermi('system:notice:remove')}]];
var types = [[${@dict.getType('sys_notice_type')}]];
var datas = [[${@dict.getType('sys_notice_status')}]];
var prefix = ctx + "system/notice"
$(function() {
......@@ -74,11 +76,7 @@
title: '公告类型',
align: 'center',
formatter: function(value, row, index) {
if (value == '1') {
return '<span class="label label-warning">通知</span>';
} else if (value == '2') {
return '<span class="badge badge-success">公告</span>';
}
return $.table.selectDictLabel(types, value);
}
},
{
......@@ -86,11 +84,7 @@
title: '状态',
align: 'center',
formatter: function(value, row, index) {
if (value == '0') {
return '<span class="badge badge-primary">正常</span>';
} else if (value == '1') {
return '<span class="badge badge-danger">关闭</span>';
}
return $.table.selectDictLabel(datas, value);
}
},
{
......
......@@ -25,7 +25,7 @@
</div>
<div class="form-group">
<label class="col-sm-3 control-label">岗位状态:</label>
<div class="col-sm-8" th:with="type=${@dictService.selectDictData('sys_normal_disable')}">
<div class="col-sm-8" th:with="type=${@dict.getType('sys_normal_disable')}">
<div th:each="dict : ${type}" th:class="${dict['cssClass']}">
<input type="radio" th:id="${dict['dictCode']}" name="status" th:value="${dict['dictValue']}" th:checked="${dict['isDefault'] == 'Y' ? true : false}">
<label th:for="${dict['dictCode']}" th:text="${dict['dictLabel']}"></label>
......@@ -64,7 +64,7 @@
},
},
submitHandler:function(form){
$.operate.save(prefix + "/save", $('#form-post-add').serialize());
$.operate.save(prefix + "/add", $('#form-post-add').serialize());
}
});
</script>
......
......@@ -26,7 +26,7 @@
</div>
<div class="form-group">
<label class="col-sm-3 control-label">岗位状态:</label>
<div class="col-sm-8" th:with="type=${@dictService.selectDictData('sys_normal_disable')}">
<div class="col-sm-8" th:with="type=${@dict.getType('sys_normal_disable')}">
<div th:each="dict : ${type}" th:class="${dict['cssClass']}">
<input type="radio" th:id="${dict['dictCode']}" name="status" th:value="${dict['dictValue']}" th:field="*{status}">
<label th:for="${dict['dictCode']}" th:text="${dict['dictLabel']}"></label>
......@@ -65,7 +65,7 @@
},
},
submitHandler:function(form){
$.operate.save(prefix + "/save", $('#form-post-edit').serialize());
$.operate.save(prefix + "/edit", $('#form-post-edit').serialize());
}
});
</script>
......
......@@ -18,7 +18,7 @@
岗位名称:<input type="text" name="postName"/>
</li>
<li>
岗位状态:<select name="status" th:with="type=${@dictService.selectDictData('sys_normal_disable')}">
岗位状态:<select name="status" th:with="type=${@dict.getType('sys_normal_disable')}">
<option value="">所有</option>
<option th:each="e : ${type}" th:text="${e['dictLabel']}" th:value="${e['dictValue']}"></option>
</select>
......@@ -48,8 +48,9 @@
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
var editFlag = [[${@permissionService.hasPermi('system:post:edit')}]];
var removeFlag = [[${@permissionService.hasPermi('system:post:remove')}]];
var editFlag = [[${@permission.hasPermi('system:post:edit')}]];
var removeFlag = [[${@permission.hasPermi('system:post:remove')}]];
var datas = [[${@dict.getType('sys_normal_disable')}]];
var prefix = ctx + "system/post"
$(function() {
......@@ -90,11 +91,7 @@
title: '状态',
align: 'center',
formatter: function(value, row, index) {
if (value == 0) {
return '<span class="badge badge-primary">正常</span>';
} else if (value == 1) {
return '<span class="badge badge-danger">停用</span>';
}
return $.table.selectDictLabel(datas, value);
}
},
{
......
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