This commit is contained in:
parent
6a8ec484f2
commit
8d25b00a41
|
|
@ -1,20 +0,0 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2018 HchYun
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
|
@ -0,0 +1,194 @@
|
|||
package com.hchyun.web.controller.system;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
|
||||
import com.hchyun.common.constant.ReturnConstants;
|
||||
import com.hchyun.common.core.controller.HcyBaseController;
|
||||
import com.hchyun.common.utils.ServerResult;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.hchyun.common.annotation.Log;
|
||||
import com.hchyun.common.core.entity.AjaxResult;
|
||||
import com.hchyun.common.enums.BusinessType;
|
||||
import com.hchyun.system.entity.Module;
|
||||
import com.hchyun.system.service.ModuleService;
|
||||
import com.hchyun.common.utils.poi.ExcelUtil;
|
||||
import com.hchyun.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 模块管理Controller
|
||||
*
|
||||
* @author hchyun
|
||||
* @date 2021-01-24
|
||||
*/
|
||||
@Api(value = "模块管理管理",tags = "模块管理管理")
|
||||
@RestController
|
||||
@RequestMapping("/system/module")
|
||||
public class ModuleController extends HcyBaseController {
|
||||
protected final Logger logger = LoggerFactory.getLogger(ModuleController.class);
|
||||
|
||||
@Autowired
|
||||
private ModuleService moduleService;
|
||||
|
||||
/**
|
||||
* 查询模块管理列表
|
||||
*/
|
||||
@ApiOperation("查询模块管理列表")
|
||||
@PreAuthorize("@ss.hasPermi('system:module:list')")
|
||||
@GetMapping("/list")
|
||||
public Serializable list(Module module) {
|
||||
try {
|
||||
startPage();
|
||||
ServerResult<List<Module>> serverResult = moduleService.selectModuleList(module);
|
||||
if (serverResult.isStart()) {
|
||||
return getDataTable(serverResult.getData());
|
||||
} else {
|
||||
return AjaxResult.info(serverResult.getMsg());
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
logger.error(e.getMessage());
|
||||
return AjaxResult.error(ReturnConstants.SYS_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出模块管理列表
|
||||
*/
|
||||
@ApiOperation("导出模块管理列表")
|
||||
@PreAuthorize("@ss.hasPermi('system:module:export')")
|
||||
@Log(title = "模块管理", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(Module module) {
|
||||
try {
|
||||
ServerResult<List<Module>> serverResult = moduleService.selectModuleList(module);
|
||||
ExcelUtil<Module> util = new ExcelUtil<Module>(Module. class);
|
||||
if (serverResult.isStart()) {
|
||||
return util.exportExcel(serverResult.getData(), "module");
|
||||
} else {
|
||||
return AjaxResult.error(serverResult.getMsg());
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
logger.error(e.getMessage());
|
||||
return AjaxResult.error(ReturnConstants.SYS_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取模块管理详细信息
|
||||
*/
|
||||
@ApiOperation("获取模块管理详细信息")
|
||||
@ApiImplicitParam(name = "id" , value = "模块管理id" , required = true, dataType = "Long" , paramType = "path")
|
||||
@PreAuthorize("@ss.hasPermi('system:module:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
try {
|
||||
ServerResult<Module> serverResult = moduleService.selectModuleById(id);
|
||||
if (serverResult.isStart()) {
|
||||
return AjaxResult.success(serverResult.getData());
|
||||
} else {
|
||||
return AjaxResult.info(serverResult.getMsg());
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
logger.error(e.getMessage());
|
||||
return AjaxResult.error(ReturnConstants.SYS_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增模块管理
|
||||
*/
|
||||
@ApiOperation("新增模块管理")
|
||||
@ApiImplicitParam(name = "module" , value = "新增模块管理信息" , dataType = "Module")
|
||||
@PreAuthorize("@ss.hasPermi('system:module:add')")
|
||||
@Log(title = "模块管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody Module module) {
|
||||
if (module.getmName() == null || module.getmName().equals("")) {
|
||||
return AjaxResult.error("模块名称不能为空!");
|
||||
}
|
||||
if (module.getmDescribe() == null || module.getmDescribe().equals("")) {
|
||||
return AjaxResult.error("模块描述不能为空!");
|
||||
}
|
||||
try {
|
||||
ServerResult<Integer> serverResult = moduleService.insertModule(module);
|
||||
if (serverResult.isStart()) {
|
||||
return AjaxResult.success();
|
||||
} else {
|
||||
return AjaxResult.error(serverResult.getMsg());
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
logger.error(e.getMessage());
|
||||
return AjaxResult.error(ReturnConstants.SYS_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改模块管理
|
||||
*/
|
||||
@ApiOperation("修改模块管理")
|
||||
@ApiImplicitParam(name = "module" , value = "修改模块管理信息" , dataType = "Module")
|
||||
@PreAuthorize("@ss.hasPermi('system:module:edit')")
|
||||
@Log(title = "模块管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody Module module) {
|
||||
try {
|
||||
|
||||
if (module.getmName() == null || module.getmName().equals("")) {
|
||||
return AjaxResult.error("模块名称不能为空!");
|
||||
}
|
||||
if (module.getmDescribe() == null || module.getmDescribe().equals("")) {
|
||||
return AjaxResult.error("模块描述不能为空!");
|
||||
}
|
||||
ServerResult<Integer> serverResult = moduleService.updateModule(module);
|
||||
if (serverResult.isStart()) {
|
||||
return AjaxResult.success();
|
||||
} else {
|
||||
return AjaxResult.error(serverResult.getMsg());
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
logger.error(e.getMessage());
|
||||
return AjaxResult.error(ReturnConstants.SYS_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除模块管理
|
||||
*/
|
||||
@ApiOperation("删除模块管理")
|
||||
@ApiImplicitParam(name = "ids" , value = "模块管理ids" , required = true, dataType = "Long" , paramType = "path")
|
||||
@PreAuthorize("@ss.hasPermi('system:module:remove')")
|
||||
@Log(title = "模块管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
try {
|
||||
if (ids.length<0){
|
||||
return AjaxResult.error("id不能为空!");
|
||||
}
|
||||
ServerResult<Integer> serverResult = moduleService.deleteModuleByIds(ids);
|
||||
if (serverResult.isStart()) {
|
||||
return AjaxResult.success();
|
||||
} else {
|
||||
return AjaxResult.error(serverResult.getMsg());
|
||||
}
|
||||
}catch (RuntimeException e){
|
||||
logger.error(e.getMessage());
|
||||
return AjaxResult.error(ReturnConstants.SYS_ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -94,9 +94,6 @@ public class ${ClassName}ServiceImpl implements ${ClassName}Service {
|
|||
public ServerResult<Integer> insert${ClassName}(${ClassName} ${className}) {
|
||||
try {
|
||||
#foreach ($column in $columns)
|
||||
#if($column.javaField == 'createTime')
|
||||
${className}.setCreateTime(DateUtils.getNowDate());
|
||||
#end
|
||||
#if($column.javaField == 'createBy')
|
||||
${className}.setCreateBy(SecurityUtils.getUserId());
|
||||
#end
|
||||
|
|
@ -133,9 +130,6 @@ public class ${ClassName}ServiceImpl implements ${ClassName}Service {
|
|||
public ServerResult<Integer> update${ClassName}(${ClassName} ${className}) {
|
||||
try {
|
||||
#foreach ($column in $columns)
|
||||
#if($column.javaField == 'updateTime')
|
||||
${className}.setUpdateTime(DateUtils.getNowDate());
|
||||
#end
|
||||
#if($column.javaField == 'updateBy')
|
||||
${className}.setUpdateBy(SecurityUtils.getUserId());
|
||||
#end
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@
|
|||
#elseif($column.list && $column.htmlType == "datetime")
|
||||
<el-table-column label="${comment}" align="center" prop="${javaField}" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.${javaField}, '{y}-{m}-{d}') }}</span>
|
||||
<span>{{ parseTime(scope.row.${javaField}, '{y}-{m}-{d} {h}:{m}:{s}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
#elseif($column.list && "" != $column.dictType)
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@
|
|||
#elseif($column.list && $column.htmlType == "datetime")
|
||||
<el-table-column label="${comment}" align="center" prop="${javaField}" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.${javaField}, '{y}-{m}-{d}') }}</span>
|
||||
<span>{{ parseTime(scope.row.${javaField}, '{y}-{m}-{d} {h}:{m}:{s}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
#elseif($column.list && "" != $column.dictType)
|
||||
|
|
|
|||
|
|
@ -3,43 +3,43 @@ package com.hchyun.quartz.config;
|
|||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.quartz.SchedulerFactoryBean;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* 定时任务配置
|
||||
*
|
||||
*
|
||||
* @author hchyun
|
||||
*/
|
||||
@Configuration
|
||||
public class ScheduleConfig
|
||||
{
|
||||
public class ScheduleConfig {
|
||||
@Bean
|
||||
public SchedulerFactoryBean schedulerFactoryBean(DataSource dataSource)
|
||||
{
|
||||
public SchedulerFactoryBean schedulerFactoryBean(DataSource dataSource) {
|
||||
SchedulerFactoryBean factory = new SchedulerFactoryBean();
|
||||
factory.setDataSource(dataSource);
|
||||
|
||||
// quartz参数
|
||||
Properties prop = new Properties();
|
||||
prop.put("org.quartz.scheduler.instanceName", "RuoyiScheduler");
|
||||
prop.put("org.quartz.scheduler.instanceId", "AUTO");
|
||||
// todo
|
||||
prop.put("org.quartz.scheduler.instanceName" , "RuoyiScheduler");
|
||||
prop.put("org.quartz.scheduler.instanceId" , "AUTO");
|
||||
// 线程池配置
|
||||
prop.put("org.quartz.threadPool.class", "org.quartz.simpl.SimpleThreadPool");
|
||||
prop.put("org.quartz.threadPool.threadCount", "20");
|
||||
prop.put("org.quartz.threadPool.threadPriority", "5");
|
||||
prop.put("org.quartz.threadPool.class" , "org.quartz.simpl.SimpleThreadPool");
|
||||
prop.put("org.quartz.threadPool.threadCount" , "20");
|
||||
prop.put("org.quartz.threadPool.threadPriority" , "5");
|
||||
// JobStore配置
|
||||
prop.put("org.quartz.jobStore.class", "org.quartz.impl.jdbcjobstore.JobStoreTX");
|
||||
prop.put("org.quartz.jobStore.class" , "org.quartz.impl.jdbcjobstore.JobStoreTX");
|
||||
// 集群配置
|
||||
prop.put("org.quartz.jobStore.isClustered", "true");
|
||||
prop.put("org.quartz.jobStore.clusterCheckinInterval", "15000");
|
||||
prop.put("org.quartz.jobStore.maxMisfiresToHandleAtATime", "1");
|
||||
prop.put("org.quartz.jobStore.txIsolationLevelSerializable", "true");
|
||||
prop.put("org.quartz.jobStore.isClustered" , "true");
|
||||
prop.put("org.quartz.jobStore.clusterCheckinInterval" , "15000");
|
||||
prop.put("org.quartz.jobStore.maxMisfiresToHandleAtATime" , "1");
|
||||
prop.put("org.quartz.jobStore.txIsolationLevelSerializable" , "true");
|
||||
|
||||
// sqlserver 启用
|
||||
// prop.put("org.quartz.jobStore.selectWithLockSQL", "SELECT * FROM {0}LOCKS UPDLOCK WHERE LOCK_NAME = ?");
|
||||
prop.put("org.quartz.jobStore.misfireThreshold", "12000");
|
||||
prop.put("org.quartz.jobStore.tablePrefix", "QRTZ_");
|
||||
prop.put("org.quartz.jobStore.misfireThreshold" , "12000");
|
||||
prop.put("org.quartz.jobStore.tablePrefix" , "QRTZ_");
|
||||
factory.setQuartzProperties(prop);
|
||||
|
||||
factory.setSchedulerName("RuoyiScheduler");
|
||||
|
|
|
|||
|
|
@ -0,0 +1,61 @@
|
|||
package com.hchyun.system.dao;
|
||||
|
||||
import java.util.List;
|
||||
import com.hchyun.system.entity.Module;
|
||||
|
||||
/**
|
||||
* 模块管理Mapper接口
|
||||
*
|
||||
* @author hchyun
|
||||
* @date 2021-01-24
|
||||
*/
|
||||
public interface ModuleDao
|
||||
{
|
||||
/**
|
||||
* 查询模块管理
|
||||
*
|
||||
* @param id 模块管理ID
|
||||
* @return 模块管理
|
||||
*/
|
||||
Module selectModuleById(Long id);
|
||||
|
||||
/**
|
||||
* 查询模块管理列表
|
||||
*
|
||||
* @param module 模块管理
|
||||
* @return 模块管理集合
|
||||
*/
|
||||
List<Module> selectModuleList(Module module);
|
||||
|
||||
/**
|
||||
* 新增模块管理
|
||||
*
|
||||
* @param module 模块管理
|
||||
* @return 结果
|
||||
*/
|
||||
int insertModule(Module module);
|
||||
|
||||
/**
|
||||
* 修改模块管理
|
||||
*
|
||||
* @param module 模块管理
|
||||
* @return 结果
|
||||
*/
|
||||
int updateModule(Module module);
|
||||
|
||||
/**
|
||||
* 删除模块管理
|
||||
*
|
||||
* @param id 模块管理ID
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteModuleById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除模块管理
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteModuleByIds(Long[] ids);
|
||||
}
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
package com.hchyun.system.entity;
|
||||
|
||||
import com.hchyun.common.annotation.Excel;
|
||||
import com.hchyun.common.core.entity.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
/**
|
||||
* 模块管理对象 sys_module
|
||||
*
|
||||
* @author hchyun
|
||||
* @date 2021-01-24
|
||||
*/
|
||||
@ApiModel("模块管理")
|
||||
public class Module extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 模块id */
|
||||
@ApiModelProperty("模块id")
|
||||
private Long id;
|
||||
|
||||
/** 模块名称 */
|
||||
@Excel(name = "模块名称")
|
||||
@ApiModelProperty("模块名称")
|
||||
private String mName;
|
||||
|
||||
/** 模块描述 */
|
||||
@Excel(name = "模块描述")
|
||||
@ApiModelProperty("模块描述")
|
||||
private String mDescribe;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setmName(String mName)
|
||||
{
|
||||
this.mName = mName;
|
||||
}
|
||||
|
||||
public String getmName()
|
||||
{
|
||||
return mName;
|
||||
}
|
||||
public void setmDescribe(String mDescribe)
|
||||
{
|
||||
this.mDescribe = mDescribe;
|
||||
}
|
||||
|
||||
public String getmDescribe()
|
||||
{
|
||||
return mDescribe;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("mName", getmName())
|
||||
.append("mDescribe", getmDescribe())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
package com.hchyun.system.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.hchyun.common.utils.ServerResult;
|
||||
import com.hchyun.system.entity.Module;
|
||||
|
||||
/**
|
||||
* 模块管理Service接口
|
||||
*
|
||||
* @author hchyun
|
||||
* @date 2021-01-24
|
||||
*/
|
||||
public interface ModuleService
|
||||
{
|
||||
/**
|
||||
* 查询模块管理
|
||||
*
|
||||
* @param id 模块管理ID
|
||||
* @return 模块管理
|
||||
*/
|
||||
ServerResult<Module> selectModuleById(Long id);
|
||||
|
||||
/**
|
||||
* 查询模块管理列表
|
||||
*
|
||||
* @param module 模块管理
|
||||
* @return 模块管理集合
|
||||
*/
|
||||
ServerResult<List<Module>> selectModuleList(Module module);
|
||||
|
||||
/**
|
||||
* 新增模块管理
|
||||
*
|
||||
* @param module 模块管理
|
||||
* @return 结果
|
||||
*/
|
||||
ServerResult<Integer> insertModule(Module module);
|
||||
|
||||
/**
|
||||
* 修改模块管理
|
||||
*
|
||||
* @param module 模块管理
|
||||
* @return 结果
|
||||
*/
|
||||
ServerResult<Integer> updateModule(Module module);
|
||||
|
||||
/**
|
||||
* 批量删除模块管理
|
||||
*
|
||||
* @param ids 需要删除的模块管理ID
|
||||
* @return 结果
|
||||
*/
|
||||
ServerResult<Integer> deleteModuleByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除模块管理信息
|
||||
*
|
||||
* @param id 模块管理ID
|
||||
* @return 结果
|
||||
*/
|
||||
ServerResult<Integer> deleteModuleById(Long id);
|
||||
}
|
||||
|
|
@ -0,0 +1,159 @@
|
|||
package com.hchyun.system.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.hchyun.common.constant.ReturnConstants;
|
||||
import com.hchyun.common.utils.DateUtils;
|
||||
import com.hchyun.common.utils.SecurityUtils;
|
||||
import com.hchyun.common.utils.DateUtils;
|
||||
import com.hchyun.common.utils.SecurityUtils;
|
||||
import com.hchyun.common.utils.ServerResult;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.hchyun.system.dao.ModuleDao;
|
||||
import com.hchyun.system.entity.Module;
|
||||
import com.hchyun.system.service.ModuleService;
|
||||
|
||||
/**
|
||||
* 模块管理Service业务层处理
|
||||
*
|
||||
* @author hchyun
|
||||
* @date 2021-01-24
|
||||
*/
|
||||
@Service
|
||||
public class ModuleServiceImpl implements ModuleService {
|
||||
private Logger logger = LoggerFactory.getLogger(ModuleServiceImpl.class);
|
||||
|
||||
@Autowired
|
||||
private ModuleDao moduleDao;
|
||||
|
||||
/**
|
||||
* 查询模块管理
|
||||
*
|
||||
* @param id 模块管理ID
|
||||
* @return 模块管理
|
||||
*/
|
||||
@Override
|
||||
public ServerResult<Module> selectModuleById(Long id) {
|
||||
try {
|
||||
Module module = moduleDao.selectModuleById(id);
|
||||
if (module != null){
|
||||
return new ServerResult<Module>(true,module);
|
||||
}else {
|
||||
return new ServerResult<Module>(false, ReturnConstants.RESULT_EMPTY);
|
||||
}
|
||||
}catch (RuntimeException e){
|
||||
logger.error(e.getMessage());
|
||||
return new ServerResult<Module>(false,ReturnConstants.DB_EX);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询模块管理列表
|
||||
*
|
||||
* @param module 模块管理
|
||||
* @return 模块管理
|
||||
*/
|
||||
@Override
|
||||
public ServerResult<List<Module>> selectModuleList(Module module) {
|
||||
try {
|
||||
List<Module> moduleList = moduleDao.selectModuleList(module);
|
||||
if (moduleList.size()>0){
|
||||
return new ServerResult<List<Module>>(true,moduleList);
|
||||
}else {
|
||||
return new ServerResult<List<Module>>(false,ReturnConstants.RESULT_EMPTY);
|
||||
}
|
||||
}catch (RuntimeException e){
|
||||
logger.error(e.getMessage());
|
||||
return new ServerResult<List<Module>>(false,ReturnConstants.DB_EX);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增模块管理
|
||||
*
|
||||
* @param module 模块管理
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public ServerResult<Integer> insertModule(Module module) {
|
||||
try {
|
||||
module.setCreateBy(SecurityUtils.getUserId());
|
||||
Integer renewal = moduleDao.insertModule(module);
|
||||
if (renewal >0){
|
||||
return new ServerResult<Integer>(true,renewal);
|
||||
}else {
|
||||
return new ServerResult<Integer>(false,ReturnConstants.SYS_FAILL);
|
||||
}
|
||||
}catch (RuntimeException e){
|
||||
logger.error(e.getMessage());
|
||||
return new ServerResult<Integer>(false,ReturnConstants.DB_EX);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改模块管理
|
||||
*
|
||||
* @param module 模块管理
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public ServerResult<Integer> updateModule(Module module) {
|
||||
try {
|
||||
module.setUpdateBy(SecurityUtils.getUserId());
|
||||
Integer renewal = moduleDao.updateModule(module);
|
||||
if (renewal >0){
|
||||
return new ServerResult<Integer>(true,renewal);
|
||||
}else {
|
||||
return new ServerResult<Integer>(false,ReturnConstants.SYS_FAILL);
|
||||
}
|
||||
}catch (RuntimeException e){
|
||||
logger.error(e.getMessage());
|
||||
return new ServerResult<Integer>(false,ReturnConstants.DB_EX);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除模块管理
|
||||
*
|
||||
* @param ids 需要删除的模块管理ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public ServerResult<Integer> deleteModuleByIds(Long[] ids) {
|
||||
try {
|
||||
Integer renewal = moduleDao.deleteModuleByIds(ids);
|
||||
if (renewal >0){
|
||||
return new ServerResult<Integer>(true,renewal);
|
||||
}else {
|
||||
return new ServerResult<Integer>(false,ReturnConstants.SYS_FAILL);
|
||||
}
|
||||
}catch (RuntimeException e){
|
||||
logger.error(e.getMessage());
|
||||
return new ServerResult<Integer>(false,ReturnConstants.DB_EX);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除模块管理信息
|
||||
*
|
||||
* @param id 模块管理ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public ServerResult<Integer> deleteModuleById(Long id) {
|
||||
try {
|
||||
Integer renewal = moduleDao.deleteModuleById(id);
|
||||
if (renewal >0){
|
||||
return new ServerResult<Integer>(true,renewal);
|
||||
}else {
|
||||
return new ServerResult<Integer>(false,ReturnConstants.SYS_FAILL);
|
||||
}
|
||||
}catch (RuntimeException e){
|
||||
logger.error(e.getMessage());
|
||||
return new ServerResult<Integer>(false,ReturnConstants.DB_EX);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.hchyun.system.dao.ModuleDao">
|
||||
|
||||
<resultMap type="Module" id="ModuleResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="mName" column="m_name" />
|
||||
<result property="mDescribe" column="m_describe" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectModuleVo">
|
||||
select id, m_name, m_describe, create_time, create_by, update_time, update_by from sys_module
|
||||
</sql>
|
||||
|
||||
<select id="selectModuleList" parameterType="Module" resultMap="ModuleResult">
|
||||
<include refid="selectModuleVo"/>
|
||||
<where>
|
||||
<if test="mName != null and mName != ''"> and m_name like concat('%', #{mName}, '%')</if>
|
||||
<if test="mDescribe != null and mDescribe != ''"> and m_describe like concat('%', #{mDescribe}, '%')</if>
|
||||
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> and create_time between #{params.beginCreateTime} and #{params.endCreateTime}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectModuleById" parameterType="Long" resultMap="ModuleResult">
|
||||
<include refid="selectModuleVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertModule" parameterType="Module" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sys_module
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="mName != null and mName != ''">m_name,</if>
|
||||
<if test="mDescribe != null and mDescribe != ''">m_describe,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="mName != null and mName != ''">#{mName},</if>
|
||||
<if test="mDescribe != null and mDescribe != ''">#{mDescribe},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateModule" parameterType="Module">
|
||||
update sys_module
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="mName != null and mName != ''">m_name = #{mName},</if>
|
||||
<if test="mDescribe != null and mDescribe != ''">m_describe = #{mDescribe},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteModuleById" parameterType="Long">
|
||||
delete from sys_module where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteModuleByIds" parameterType="String">
|
||||
delete from sys_module where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
|
|
@ -149,6 +149,7 @@ public class ResultsController extends HcyBaseController {
|
|||
@Log(title = "成绩", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody Results results) {
|
||||
// public AjaxResult edit(@RequestBody Map<String,Object> map) {
|
||||
try {
|
||||
|
||||
if (results.getJava() == null || results.getJava()<0) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue