This commit is contained in:
parent
181af797d8
commit
b6fee1744e
|
|
@ -8,7 +8,7 @@ import org.springframework.stereotype.Component;
|
|||
/**
|
||||
* 读取代码生成相关配置
|
||||
*
|
||||
* @author ruoyi
|
||||
* @author hchyun
|
||||
*/
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = "gen")
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ import com.hchyun.generator.service.IGenTableService;
|
|||
/**
|
||||
* 代码生成 操作处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @author hchyun
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/tool/gen")
|
||||
|
|
@ -198,7 +198,7 @@ public class GenController extends BaseController {
|
|||
response.reset();
|
||||
response.addHeader("Access-Control-Allow-Origin" , "*");
|
||||
response.addHeader("Access-Control-Expose-Headers" , "Content-Disposition");
|
||||
response.setHeader("Content-Disposition" , "attachment; filename=\"ruoyi.zip\"");
|
||||
response.setHeader("Content-Disposition" , "attachment; filename=\"hchyun.zip\"");
|
||||
response.addHeader("Content-Length" , "" + data.length);
|
||||
response.setContentType("application/octet-stream; charset=UTF-8");
|
||||
IOUtils.write(data, response.getOutputStream());
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import com.hchyun.generator.entity.GenTableColumn;
|
|||
/**
|
||||
* 业务字段 数据层
|
||||
*
|
||||
* @author ruoyi
|
||||
* @author hchyun
|
||||
*/
|
||||
public interface GenTableColumnDao
|
||||
{
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import org.apache.ibatis.annotations.Param;
|
|||
/**
|
||||
* 业务 数据层
|
||||
*
|
||||
* @author ruoyi
|
||||
* @author hchyun
|
||||
*/
|
||||
public interface GenTableDao
|
||||
{
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import com.hchyun.common.utils.StringUtils;
|
|||
/**
|
||||
* 业务表 gen_table
|
||||
*
|
||||
* @author ruoyi
|
||||
* @author hchyun
|
||||
*/
|
||||
public class GenTable extends BaseEntity
|
||||
{
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import com.hchyun.common.utils.StringUtils;
|
|||
/**
|
||||
* 代码生成业务字段表 gen_table_column
|
||||
*
|
||||
* @author ruoyi
|
||||
* @author hchyun
|
||||
*/
|
||||
public class GenTableColumn extends BaseEntity
|
||||
{
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import com.hchyun.generator.dao.GenTableColumnDao;
|
|||
/**
|
||||
* 业务字段 服务层实现
|
||||
*
|
||||
* @author ruoyi
|
||||
* @author hchyun
|
||||
*/
|
||||
@Service
|
||||
public class GenTableColumnServiceImpl implements IGenTableColumnService
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ import com.hchyun.generator.util.VelocityUtils;
|
|||
/**
|
||||
* 业务 服务层实现
|
||||
*
|
||||
* @author ruoyi
|
||||
* @author hchyun
|
||||
*/
|
||||
@Service
|
||||
public class GenTableServiceImpl implements IGenTableService {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import com.hchyun.generator.entity.GenTableColumn;
|
|||
/**
|
||||
* 业务字段 服务层
|
||||
*
|
||||
* @author ruoyi
|
||||
* @author hchyun
|
||||
*/
|
||||
public interface IGenTableColumnService
|
||||
{
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import com.hchyun.generator.entity.GenTable;
|
|||
/**
|
||||
* 业务 服务层
|
||||
*
|
||||
* @author ruoyi
|
||||
* @author hchyun
|
||||
*/
|
||||
public interface IGenTableService
|
||||
{
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import com.hchyun.generator.entity.GenTableColumn;
|
|||
/**
|
||||
* 代码生成器 工具类
|
||||
*
|
||||
* @author ruoyi
|
||||
* @author hchyun
|
||||
*/
|
||||
public class GenUtils
|
||||
{
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import com.hchyun.common.constant.Constants;
|
|||
/**
|
||||
* VelocityEngine工厂
|
||||
*
|
||||
* @author ruoyi
|
||||
* @author hchyun
|
||||
*/
|
||||
public class VelocityInitializer
|
||||
{
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import com.hchyun.generator.entity.GenTableColumn;
|
|||
/**
|
||||
* 模板处理工具类
|
||||
*
|
||||
* @author ruoyi
|
||||
* @author hchyun
|
||||
*/
|
||||
public class VelocityUtils
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
# 代码生成
|
||||
gen:
|
||||
# 作者
|
||||
author: ruoyi
|
||||
author: hchyun
|
||||
# 默认生成包路径 system 需改成自己的模块名称 如 system monitor tool
|
||||
packageName: com.ruoyi.system
|
||||
packageName: com.hchyun.system
|
||||
# 自动去除表前缀,默认是false
|
||||
autoRemovePre: false
|
||||
# 表前缀(生成类名不会包含表前缀,多个用逗号分隔)
|
||||
|
|
|
|||
|
|
@ -11,15 +11,15 @@ 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.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import ${packageName}.domain.${ClassName};
|
||||
import ${packageName}.service.I${ClassName}Service;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.hchyun.common.annotation.Log;
|
||||
import com.hchyun.common.core.controller.BaseController;
|
||||
import com.hchyun.common.core.domain.AjaxResult;
|
||||
import com.hchyun.common.enums.BusinessType;
|
||||
import ${packageName}.entity.${ClassName};
|
||||
import ${packageName}.service.${ClassName}Service;
|
||||
import com.hchyun.common.utils.poi.ExcelUtil;
|
||||
#if($table.crud || $table.sub)
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.hchyun.common.core.page.TableDataInfo;
|
||||
#elseif($table.tree)
|
||||
#end
|
||||
|
||||
|
|
@ -34,7 +34,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
|
|||
public class ${ClassName}Controller extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private I${ClassName}Service ${className}Service;
|
||||
private ${ClassName}Service ${className}Service;
|
||||
|
||||
/**
|
||||
* 查询${functionName}列表
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package ${packageName}.mapper;
|
||||
package ${packageName}.dao;
|
||||
|
||||
import java.util.List;
|
||||
import ${packageName}.entity.${ClassName};
|
||||
|
|
@ -12,7 +12,7 @@ import ${packageName}.entity.${subClassName};
|
|||
* @author ${author}
|
||||
* @date ${datetime}
|
||||
*/
|
||||
public interface ${ClassName}Mapper
|
||||
public interface ${ClassName}Dao
|
||||
{
|
||||
/**
|
||||
* 查询${functionName}
|
||||
|
|
|
|||
|
|
@ -3,13 +3,9 @@ package ${packageName}.entity;
|
|||
#foreach ($import in $importList)
|
||||
import ${import};
|
||||
#end
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.hchyun.common.annotation.Excel;
|
||||
#if($table.crud || $table.sub)
|
||||
import com.ruoyi.common.core.entity.BaseEntity;
|
||||
#elseif($table.tree)
|
||||
import com.ruoyi.common.core.entity.TreeEntity;
|
||||
#end
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import ${packageName}.entity.${ClassName};
|
|||
* @author ${author}
|
||||
* @date ${datetime}
|
||||
*/
|
||||
public interface I${ClassName}Service
|
||||
public interface ${ClassName}Service
|
||||
{
|
||||
/**
|
||||
* 查询${functionName}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ package ${packageName}.service.impl;
|
|||
import java.util.List;
|
||||
#foreach ($column in $columns)
|
||||
#if($column.javaField == 'createTime' || $column.javaField == 'updateTime')
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.hchyun.common.utils.DateUtils;
|
||||
#break
|
||||
#end
|
||||
#end
|
||||
|
|
@ -11,11 +11,11 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.stereotype.Service;
|
||||
#if($table.sub)
|
||||
import java.util.ArrayList;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.hchyun.common.utils.StringUtils;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import ${packageName}.entity.${subClassName};
|
||||
#end
|
||||
import ${packageName}.mapper.${ClassName}Mapper;
|
||||
import ${packageName}.dao.${ClassName}Dao;
|
||||
import ${packageName}.entity.${ClassName};
|
||||
import ${packageName}.service.I${ClassName}Service;
|
||||
|
||||
|
|
@ -26,10 +26,10 @@ import ${packageName}.service.I${ClassName}Service;
|
|||
* @date ${datetime}
|
||||
*/
|
||||
@Service
|
||||
public class ${ClassName}ServiceImpl implements I${ClassName}Service
|
||||
public class ${ClassName}ServiceImpl implements ${ClassName}Service
|
||||
{
|
||||
@Autowired
|
||||
private ${ClassName}Mapper ${className}Mapper;
|
||||
private ${ClassName}Dao ${className}Dao;
|
||||
|
||||
/**
|
||||
* 查询${functionName}
|
||||
|
|
@ -40,7 +40,7 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service
|
|||
@Override
|
||||
public ${ClassName} select${ClassName}ById(${pkColumn.javaType} ${pkColumn.javaField})
|
||||
{
|
||||
return ${className}Mapper.select${ClassName}ById(${pkColumn.javaField});
|
||||
return ${className}Dao.select${ClassName}ById(${pkColumn.javaField});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -52,7 +52,7 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service
|
|||
@Override
|
||||
public List<${ClassName}> select${ClassName}List(${ClassName} ${className})
|
||||
{
|
||||
return ${className}Mapper.select${ClassName}List(${className});
|
||||
return ${className}Dao.select${ClassName}List(${className});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -73,11 +73,11 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service
|
|||
#end
|
||||
#end
|
||||
#if($table.sub)
|
||||
int rows = ${className}Mapper.insert${ClassName}(${className});
|
||||
int rows = ${className}Dao.insert${ClassName}(${className});
|
||||
insert${subClassName}(${className});
|
||||
return rows;
|
||||
#else
|
||||
return ${className}Mapper.insert${ClassName}(${className});
|
||||
return ${className}Dao.insert${ClassName}(${className});
|
||||
#end
|
||||
}
|
||||
|
||||
|
|
@ -99,10 +99,10 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service
|
|||
#end
|
||||
#end
|
||||
#if($table.sub)
|
||||
${className}Mapper.delete${subClassName}By${subTableFkClassName}(${className}.get${pkColumn.capJavaField}());
|
||||
${className}Dao.delete${subClassName}By${subTableFkClassName}(${className}.get${pkColumn.capJavaField}());
|
||||
insert${subClassName}(${className});
|
||||
#end
|
||||
return ${className}Mapper.update${ClassName}(${className});
|
||||
return ${className}Dao.update${ClassName}(${className});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -118,9 +118,9 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service
|
|||
public int delete${ClassName}ByIds(${pkColumn.javaType}[] ${pkColumn.javaField}s)
|
||||
{
|
||||
#if($table.sub)
|
||||
${className}Mapper.delete${subClassName}By${subTableFkClassName}s(${pkColumn.javaField}s);
|
||||
${className}Dao.delete${subClassName}By${subTableFkClassName}s(${pkColumn.javaField}s);
|
||||
#end
|
||||
return ${className}Mapper.delete${ClassName}ByIds(${pkColumn.javaField}s);
|
||||
return ${className}Dao.delete${ClassName}ByIds(${pkColumn.javaField}s);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -133,9 +133,9 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service
|
|||
public int delete${ClassName}ById(${pkColumn.javaType} ${pkColumn.javaField})
|
||||
{
|
||||
#if($table.sub)
|
||||
${className}Mapper.delete${subClassName}By${subTableFkClassName}(${pkColumn.javaField});
|
||||
${className}Dao.delete${subClassName}By${subTableFkClassName}(${pkColumn.javaField});
|
||||
#end
|
||||
return ${className}Mapper.delete${ClassName}ById(${pkColumn.javaField});
|
||||
return ${className}Dao.delete${ClassName}ById(${pkColumn.javaField});
|
||||
}
|
||||
#if($table.sub)
|
||||
|
||||
|
|
@ -158,7 +158,7 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service
|
|||
}
|
||||
if (list.size() > 0)
|
||||
{
|
||||
${className}Mapper.batch${subClassName}(list);
|
||||
${className}Dao.batch${subClassName}(list);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,10 +3,7 @@ package ${packageName}.entity;
|
|||
#foreach ($import in $subImportList)
|
||||
import ${import};
|
||||
#end
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.entity.BaseEntity;
|
||||
import com.hchyun.common.annotation.Excel;
|
||||
|
||||
/**
|
||||
* ${subTable.functionName}对象 ${subTableName}
|
||||
|
|
|
|||
|
|
@ -1,103 +0,0 @@
|
|||
package com.ruoyi.system.controller;
|
||||
|
||||
import java.util.List;
|
||||
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.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.system.domain.SysStu;
|
||||
import com.ruoyi.system.service.ISysStuService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 学生Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-01-22
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/stu")
|
||||
public class SysStuController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysStuService sysStuService;
|
||||
|
||||
/**
|
||||
* 查询学生列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:stu:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysStu sysStu)
|
||||
{
|
||||
startPage();
|
||||
List<SysStu> list = sysStuService.selectSysStuList(sysStu);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出学生列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:stu:export')")
|
||||
@Log(title = "学生", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(SysStu sysStu)
|
||||
{
|
||||
List<SysStu> list = sysStuService.selectSysStuList(sysStu);
|
||||
ExcelUtil<SysStu> util = new ExcelUtil<SysStu>(SysStu.class);
|
||||
return util.exportExcel(list, "stu");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取学生详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:stu:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return AjaxResult.success(sysStuService.selectSysStuById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增学生
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:stu:add')")
|
||||
@Log(title = "学生", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SysStu sysStu)
|
||||
{
|
||||
return toAjax(sysStuService.insertSysStu(sysStu));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改学生
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:stu:edit')")
|
||||
@Log(title = "学生", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SysStu sysStu)
|
||||
{
|
||||
return toAjax(sysStuService.updateSysStu(sysStu));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除学生
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:stu:remove')")
|
||||
@Log(title = "学生", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(sysStuService.deleteSysStuByIds(ids));
|
||||
}
|
||||
}
|
||||
|
|
@ -1,61 +0,0 @@
|
|||
package com.ruoyi.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.entity.SysStu;
|
||||
|
||||
/**
|
||||
* 学生Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-01-22
|
||||
*/
|
||||
public interface SysStuMapper
|
||||
{
|
||||
/**
|
||||
* 查询学生
|
||||
*
|
||||
* @param id 学生ID
|
||||
* @return 学生
|
||||
*/
|
||||
public SysStu selectSysStuById(Long id);
|
||||
|
||||
/**
|
||||
* 查询学生列表
|
||||
*
|
||||
* @param sysStu 学生
|
||||
* @return 学生集合
|
||||
*/
|
||||
public List<SysStu> selectSysStuList(SysStu sysStu);
|
||||
|
||||
/**
|
||||
* 新增学生
|
||||
*
|
||||
* @param sysStu 学生
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertSysStu(SysStu sysStu);
|
||||
|
||||
/**
|
||||
* 修改学生
|
||||
*
|
||||
* @param sysStu 学生
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateSysStu(SysStu sysStu);
|
||||
|
||||
/**
|
||||
* 删除学生
|
||||
*
|
||||
* @param id 学生ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysStuById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除学生
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysStuByIds(Long[] ids);
|
||||
}
|
||||
|
|
@ -1,80 +0,0 @@
|
|||
package com.ruoyi.system.entity;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.entity.BaseEntity;
|
||||
|
||||
/**
|
||||
* 学生对象 sys_stu
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-01-22
|
||||
*/
|
||||
public class SysStu extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** id */
|
||||
private Long id;
|
||||
|
||||
/** 学生姓名 */
|
||||
@Excel(name = "学生姓名")
|
||||
private String name;
|
||||
|
||||
/** 电话 */
|
||||
@Excel(name = "电话")
|
||||
private Long tel;
|
||||
|
||||
/** 电子邮件 */
|
||||
@Excel(name = "电子邮件")
|
||||
private String email;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
public void setTel(Long tel)
|
||||
{
|
||||
this.tel = tel;
|
||||
}
|
||||
|
||||
public Long getTel()
|
||||
{
|
||||
return tel;
|
||||
}
|
||||
public void setEmail(String email)
|
||||
{
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public String getEmail()
|
||||
{
|
||||
return email;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("name", getName())
|
||||
.append("tel", getTel())
|
||||
.append("email", getEmail())
|
||||
.append("createTime", getCreateTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,61 +0,0 @@
|
|||
package com.ruoyi.system.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.entity.SysStu;
|
||||
|
||||
/**
|
||||
* 学生Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-01-22
|
||||
*/
|
||||
public interface ISysStuService
|
||||
{
|
||||
/**
|
||||
* 查询学生
|
||||
*
|
||||
* @param id 学生ID
|
||||
* @return 学生
|
||||
*/
|
||||
public SysStu selectSysStuById(Long id);
|
||||
|
||||
/**
|
||||
* 查询学生列表
|
||||
*
|
||||
* @param sysStu 学生
|
||||
* @return 学生集合
|
||||
*/
|
||||
public List<SysStu> selectSysStuList(SysStu sysStu);
|
||||
|
||||
/**
|
||||
* 新增学生
|
||||
*
|
||||
* @param sysStu 学生
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertSysStu(SysStu sysStu);
|
||||
|
||||
/**
|
||||
* 修改学生
|
||||
*
|
||||
* @param sysStu 学生
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateSysStu(SysStu sysStu);
|
||||
|
||||
/**
|
||||
* 批量删除学生
|
||||
*
|
||||
* @param ids 需要删除的学生ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysStuByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除学生信息
|
||||
*
|
||||
* @param id 学生ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysStuById(Long id);
|
||||
}
|
||||
|
|
@ -1,95 +0,0 @@
|
|||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.system.mapper.SysStuMapper;
|
||||
import com.ruoyi.system.entity.SysStu;
|
||||
import com.ruoyi.system.service.ISysStuService;
|
||||
|
||||
/**
|
||||
* 学生Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-01-22
|
||||
*/
|
||||
@Service
|
||||
public class SysStuServiceImpl implements ISysStuService
|
||||
{
|
||||
@Autowired
|
||||
private SysStuMapper sysStuMapper;
|
||||
|
||||
/**
|
||||
* 查询学生
|
||||
*
|
||||
* @param id 学生ID
|
||||
* @return 学生
|
||||
*/
|
||||
@Override
|
||||
public SysStu selectSysStuById(Long id)
|
||||
{
|
||||
return sysStuMapper.selectSysStuById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询学生列表
|
||||
*
|
||||
* @param sysStu 学生
|
||||
* @return 学生
|
||||
*/
|
||||
@Override
|
||||
public List<SysStu> selectSysStuList(SysStu sysStu)
|
||||
{
|
||||
return sysStuMapper.selectSysStuList(sysStu);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增学生
|
||||
*
|
||||
* @param sysStu 学生
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertSysStu(SysStu sysStu)
|
||||
{
|
||||
sysStu.setCreateTime(DateUtils.getNowDate());
|
||||
return sysStuMapper.insertSysStu(sysStu);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改学生
|
||||
*
|
||||
* @param sysStu 学生
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateSysStu(SysStu sysStu)
|
||||
{
|
||||
return sysStuMapper.updateSysStu(sysStu);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除学生
|
||||
*
|
||||
* @param ids 需要删除的学生ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSysStuByIds(Long[] ids)
|
||||
{
|
||||
return sysStuMapper.deleteSysStuByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除学生信息
|
||||
*
|
||||
* @param id 学生ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSysStuById(Long id)
|
||||
{
|
||||
return sysStuMapper.deleteSysStuById(id);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,70 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.system.dao.SysStuMapper">
|
||||
|
||||
<resultMap type="SysStu" id="SysStuResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="name" column="name" />
|
||||
<result property="tel" column="tel" />
|
||||
<result property="email" column="email" />
|
||||
<result property="createTime" column="create_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSysStuVo">
|
||||
select id, name, tel, email, create_time from sys_stu
|
||||
</sql>
|
||||
|
||||
<select id="selectSysStuList" parameterType="SysStu" resultMap="SysStuResult">
|
||||
<include refid="selectSysStuVo"/>
|
||||
<where>
|
||||
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||
<if test="tel != null "> and tel = #{tel}</if>
|
||||
<if test="email != null and email != ''"> and email = #{email}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectSysStuById" parameterType="Long" resultMap="SysStuResult">
|
||||
<include refid="selectSysStuVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertSysStu" parameterType="SysStu" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sys_stu
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null">name,</if>
|
||||
<if test="tel != null">tel,</if>
|
||||
<if test="email != null">email,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null">#{name},</if>
|
||||
<if test="tel != null">#{tel},</if>
|
||||
<if test="email != null">#{email},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateSysStu" parameterType="SysStu">
|
||||
update sys_stu
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="name != null">name = #{name},</if>
|
||||
<if test="tel != null">tel = #{tel},</if>
|
||||
<if test="email != null">email = #{email},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteSysStuById" parameterType="Long">
|
||||
delete from sys_stu where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteSysStuByIds" parameterType="String">
|
||||
delete from sys_stu where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue