Pre Merge pull request !21 from 弋戈辉/feature-ygh

This commit is contained in:
弋戈辉
2020-05-17 20:48:04 +08:00
committed by Gitee
59 changed files with 4498 additions and 955 deletions

View File

@ -0,0 +1,103 @@
package com.ruoyi.project.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.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.project.system.domain.PCommForm;
import com.ruoyi.project.system.service.IPCommFormService;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.web.page.TableDataInfo;
/**
* 数据模型Controller
*
* @author ruoyi
* @date 2020-05-14
*/
@RestController
@RequestMapping("/system/form")
public class PCommFormController extends BaseController
{
@Autowired
private IPCommFormService pCommFormService;
/**
* 查询数据模型列表
*/
@PreAuthorize("@ss.hasPermi('system:form:list')")
@GetMapping("/list")
public TableDataInfo list(PCommForm pCommForm)
{
startPage();
List<PCommForm> list = pCommFormService.selectPCommFormList(pCommForm);
return getDataTable(list);
}
/**
* 导出数据模型列表
*/
@PreAuthorize("@ss.hasPermi('system:form:export')")
@Log(title = "数据模型", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(PCommForm pCommForm)
{
List<PCommForm> list = pCommFormService.selectPCommFormList(pCommForm);
ExcelUtil<PCommForm> util = new ExcelUtil<PCommForm>(PCommForm.class);
return util.exportExcel(list, "form");
}
/**
* 获取数据模型详细信息
*/
@PreAuthorize("@ss.hasPermi('system:form:query')")
@GetMapping(value = "/{formId}")
public AjaxResult getInfo(@PathVariable("formId") Long formId)
{
return AjaxResult.success(pCommFormService.selectPCommFormById(formId));
}
/**
* 新增数据模型
*/
@PreAuthorize("@ss.hasPermi('system:form:add')")
@Log(title = "数据模型", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody PCommForm pCommForm)
{
return toAjax(pCommFormService.insertPCommForm(pCommForm));
}
/**
* 修改数据模型
*/
@PreAuthorize("@ss.hasPermi('system:form:edit')")
@Log(title = "数据模型", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody PCommForm pCommForm)
{
return toAjax(pCommFormService.updatePCommForm(pCommForm));
}
/**
* 删除数据模型
*/
@PreAuthorize("@ss.hasPermi('system:form:remove')")
@Log(title = "数据模型", businessType = BusinessType.DELETE)
@DeleteMapping("/{formIds}")
public AjaxResult remove(@PathVariable Long[] formIds)
{
return toAjax(pCommFormService.deletePCommFormByIds(formIds));
}
}

View File

@ -0,0 +1,112 @@
package com.ruoyi.project.system.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.framework.aspectj.lang.annotation.Excel;
import com.ruoyi.framework.web.domain.BaseEntity;
/**
* 数据模型对象 p_comm_form
*
* @author ruoyi
* @date 2020-05-14
*/
public class PCommForm extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 编号 */
private Long formId;
/** 表单名称 */
@Excel(name = "表单名称")
private String formName;
/** 表单描述 */
@Excel(name = "表单描述")
private String formComment;
/** 实体类名称 */
@Excel(name = "实体类名称")
private String tableName;
/** 表单配置json */
@Excel(name = "表单配置json")
private String options;
/** 版本号 */
@Excel(name = "版本号")
private String versionName;
public void setFormId(Long formId)
{
this.formId = formId;
}
public Long getFormId()
{
return formId;
}
public void setFormName(String formName)
{
this.formName = formName;
}
public String getFormName()
{
return formName;
}
public void setFormComment(String formComment)
{
this.formComment = formComment;
}
public String getFormComment()
{
return formComment;
}
public void setTableName(String tableName)
{
this.tableName = tableName;
}
public String getTableName()
{
return tableName;
}
public void setOptions(String options)
{
this.options = options;
}
public String getOptions()
{
return options;
}
public void setVersionName(String versionName)
{
this.versionName = versionName;
}
public String getVersionName()
{
return versionName;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("formId", getFormId())
.append("formName", getFormName())
.append("formComment", getFormComment())
.append("tableName", getTableName())
.append("options", getOptions())
.append("versionName", getVersionName())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}

View File

@ -0,0 +1,61 @@
package com.ruoyi.project.system.mapper;
import java.util.List;
import com.ruoyi.project.system.domain.PCommForm;
/**
* 数据模型Mapper接口
*
* @author ruoyi
* @date 2020-05-14
*/
public interface PCommFormMapper
{
/**
* 查询数据模型
*
* @param formId 数据模型ID
* @return 数据模型
*/
public PCommForm selectPCommFormById(Long formId);
/**
* 查询数据模型列表
*
* @param pCommForm 数据模型
* @return 数据模型集合
*/
public List<PCommForm> selectPCommFormList(PCommForm pCommForm);
/**
* 新增数据模型
*
* @param pCommForm 数据模型
* @return 结果
*/
public int insertPCommForm(PCommForm pCommForm);
/**
* 修改数据模型
*
* @param pCommForm 数据模型
* @return 结果
*/
public int updatePCommForm(PCommForm pCommForm);
/**
* 删除数据模型
*
* @param formId 数据模型ID
* @return 结果
*/
public int deletePCommFormById(Long formId);
/**
* 批量删除数据模型
*
* @param formIds 需要删除的数据ID
* @return 结果
*/
public int deletePCommFormByIds(Long[] formIds);
}

View File

@ -0,0 +1,61 @@
package com.ruoyi.project.system.service;
import java.util.List;
import com.ruoyi.project.system.domain.PCommForm;
/**
* 数据模型Service接口
*
* @author ruoyi
* @date 2020-05-14
*/
public interface IPCommFormService
{
/**
* 查询数据模型
*
* @param formId 数据模型ID
* @return 数据模型
*/
public PCommForm selectPCommFormById(Long formId);
/**
* 查询数据模型列表
*
* @param pCommForm 数据模型
* @return 数据模型集合
*/
public List<PCommForm> selectPCommFormList(PCommForm pCommForm);
/**
* 新增数据模型
*
* @param pCommForm 数据模型
* @return 结果
*/
public int insertPCommForm(PCommForm pCommForm);
/**
* 修改数据模型
*
* @param pCommForm 数据模型
* @return 结果
*/
public int updatePCommForm(PCommForm pCommForm);
/**
* 批量删除数据模型
*
* @param formIds 需要删除的数据模型ID
* @return 结果
*/
public int deletePCommFormByIds(Long[] formIds);
/**
* 删除数据模型信息
*
* @param formId 数据模型ID
* @return 结果
*/
public int deletePCommFormById(Long formId);
}

View File

@ -0,0 +1,96 @@
package com.ruoyi.project.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.project.system.mapper.PCommFormMapper;
import com.ruoyi.project.system.domain.PCommForm;
import com.ruoyi.project.system.service.IPCommFormService;
/**
* 数据模型Service业务层处理
*
* @author ruoyi
* @date 2020-05-14
*/
@Service
public class PCommFormServiceImpl implements IPCommFormService
{
@Autowired
private PCommFormMapper pCommFormMapper;
/**
* 查询数据模型
*
* @param formId 数据模型ID
* @return 数据模型
*/
@Override
public PCommForm selectPCommFormById(Long formId)
{
return pCommFormMapper.selectPCommFormById(formId);
}
/**
* 查询数据模型列表
*
* @param pCommForm 数据模型
* @return 数据模型
*/
@Override
public List<PCommForm> selectPCommFormList(PCommForm pCommForm)
{
return pCommFormMapper.selectPCommFormList(pCommForm);
}
/**
* 新增数据模型
*
* @param pCommForm 数据模型
* @return 结果
*/
@Override
public int insertPCommForm(PCommForm pCommForm)
{
pCommForm.setCreateTime(DateUtils.getNowDate());
return pCommFormMapper.insertPCommForm(pCommForm);
}
/**
* 修改数据模型
*
* @param pCommForm 数据模型
* @return 结果
*/
@Override
public int updatePCommForm(PCommForm pCommForm)
{
pCommForm.setUpdateTime(DateUtils.getNowDate());
return pCommFormMapper.updatePCommForm(pCommForm);
}
/**
* 批量删除数据模型
*
* @param formIds 需要删除的数据模型ID
* @return 结果
*/
@Override
public int deletePCommFormByIds(Long[] formIds)
{
return pCommFormMapper.deletePCommFormByIds(formIds);
}
/**
* 删除数据模型信息
*
* @param formId 数据模型ID
* @return 结果
*/
@Override
public int deletePCommFormById(Long formId)
{
return pCommFormMapper.deletePCommFormById(formId);
}
}

View File

@ -6,9 +6,9 @@ spring:
druid:
# 主库数据源
master:
url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
password: password
url: jdbc:mysql://49.233.38.252:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: ckma
password: ckma
# 从库数据源
slave:
# 从数据源开关/默认关闭

View File

@ -16,7 +16,7 @@ ruoyi:
# 开发环境配置
server:
# 服务器的HTTP端口默认为8080
port: 8080
port: 8888
servlet:
# 应用的访问路径
context-path: /
@ -57,14 +57,14 @@ spring:
# redis 配置
redis:
# 地址
host: localhost
host: 49.233.38.252
# 端口默认为6379
port: 6379
port: 16379
# 密码
password:
password: ckma
# 连接超时时间
timeout: 10s
lettuce:
jedis:
pool:
# 连接池中的最小空闲连接
min-idle: 0

View File

@ -0,0 +1,93 @@
<?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.project.system.mapper.PCommFormMapper">
<resultMap type="PCommForm" id="PCommFormResult">
<result property="formId" column="form_id" />
<result property="formName" column="form_name" />
<result property="formComment" column="form_comment" />
<result property="tableName" column="table_name" />
<result property="options" column="options" />
<result property="versionName" column="version_name" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectPCommFormVo">
select form_id, form_name, form_comment, table_name, options, version_name, create_by, create_time, update_by, update_time, remark from p_comm_form
</sql>
<select id="selectPCommFormList" parameterType="PCommForm" resultMap="PCommFormResult">
<include refid="selectPCommFormVo"/>
<where>
<if test="formName != null and formName != ''"> and form_name like concat('%', #{formName}, '%')</if>
</where>
</select>
<select id="selectPCommFormById" parameterType="Long" resultMap="PCommFormResult">
<include refid="selectPCommFormVo"/>
where form_id = #{formId}
</select>
<insert id="insertPCommForm" parameterType="PCommForm" useGeneratedKeys="true" keyProperty="formId">
insert into p_comm_form
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="formName != null and formName != ''">form_name,</if>
<if test="formComment != null and formComment != ''">form_comment,</if>
<if test="tableName != null and tableName != ''">table_name,</if>
<if test="options != null and options != ''">options,</if>
<if test="versionName != null and versionName != ''">version_name,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="createTime != null ">create_time,</if>
<if test="updateBy != null and updateBy != ''">update_by,</if>
<if test="updateTime != null ">update_time,</if>
<if test="remark != null and remark != ''">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="formName != null and formName != ''">#{formName},</if>
<if test="formComment != null and formComment != ''">#{formComment},</if>
<if test="tableName != null and tableName != ''">#{tableName},</if>
<if test="options != null and options != ''">#{options},</if>
<if test="versionName != null and versionName != ''">#{versionName},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="createTime != null ">#{createTime},</if>
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
<if test="updateTime != null ">#{updateTime},</if>
<if test="remark != null and remark != ''">#{remark},</if>
</trim>
</insert>
<update id="updatePCommForm" parameterType="PCommForm">
update p_comm_form
<trim prefix="SET" suffixOverrides=",">
<if test="formName != null and formName != ''">form_name = #{formName},</if>
<if test="formComment != null and formComment != ''">form_comment = #{formComment},</if>
<if test="tableName != null and tableName != ''">table_name = #{tableName},</if>
<if test="options != null and options != ''">options = #{options},</if>
<if test="versionName != null and versionName != ''">version_name = #{versionName},</if>
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
<if test="createTime != null ">create_time = #{createTime},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="updateTime != null ">update_time = #{updateTime},</if>
<if test="remark != null and remark != ''">remark = #{remark},</if>
</trim>
where form_id = #{formId}
</update>
<delete id="deletePCommFormById" parameterType="Long">
delete from p_comm_form where form_id = #{formId}
</delete>
<delete id="deletePCommFormByIds" parameterType="String">
delete from p_comm_form where form_id in
<foreach item="formId" collection="array" open="(" separator="," close=")">
#{formId}
</foreach>
</delete>
</mapper>