生成代码增加 名称是否重复 及 制单人 时间的 默认 ,单据号的自动生成

This commit is contained in:
lin 2020-12-22 19:33:26 +08:00
parent 5d856d1368
commit 380ffabfe8
25 changed files with 1879 additions and 49 deletions

View File

@ -0,0 +1,125 @@
package com.ruoyi.province.platform.domain;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 营业面积对象 platf_company_area
*
* @author dalin
* @date 2020-12-22
*/
public class CompanyArea extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
private Long companyAreaId;
/** 名称 */
@Excel(name = "名称")
private String companyAreaName;
/** 单据号 */
@Excel(name = "单据号")
private String docNum;
/** 资料状态 */
@Excel(name = "资料状态")
private String status;
/** 删除标志) */
private String delFlag;
/** 制单人 */
@Excel(name = "制单人")
private String createByuserName;
/** 修改人 */
@Excel(name = "修改人")
private String updateByuserName;
public void setCompanyAreaId(Long companyAreaId)
{
this.companyAreaId = companyAreaId;
}
public Long getCompanyAreaId()
{
return companyAreaId;
}
public void setCompanyAreaName(String companyAreaName)
{
this.companyAreaName = companyAreaName;
}
public String getCompanyAreaName()
{
return companyAreaName;
}
public void setDocNum(String docNum)
{
this.docNum = docNum;
}
public String getDocNum()
{
return docNum;
}
public void setStatus(String status)
{
this.status = status;
}
public String getStatus()
{
return status;
}
public void setDelFlag(String delFlag)
{
this.delFlag = delFlag;
}
public String getDelFlag()
{
return delFlag;
}
public void setCreateByuserName(String createByuserName)
{
this.createByuserName = createByuserName;
}
public String getCreateByuserName()
{
return createByuserName;
}
public void setUpdateByuserName(String updateByuserName)
{
this.updateByuserName = updateByuserName;
}
public String getUpdateByuserName()
{
return updateByuserName;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("companyAreaId", getCompanyAreaId())
.append("companyAreaName", getCompanyAreaName())
.append("docNum", getDocNum())
.append("status", getStatus())
.append("remark", getRemark())
.append("delFlag", getDelFlag())
.append("createByuserName", getCreateByuserName())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateByuserName", getUpdateByuserName())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

View File

@ -0,0 +1,69 @@
package com.ruoyi.province.platform.mapper;
import java.util.List;
import com.ruoyi.province.platform.domain.CompanyArea;
/**
* 营业面积Mapper接口
*
* @author dalin
* @date 2020-12-22
*/
public interface CompanyAreaMapper
{
/**
* 查询营业面积
*
* @param companyAreaId 营业面积ID
* @return 营业面积
*/
public CompanyArea selectCompanyAreaById(Long companyAreaId);
/**
* 校验 营业面积 名称是否重复
*
* @param CompanyAreaName
* @return 营业面积
*/
public CompanyArea checkCompanyAreaUnique(String CompanyAreaName);
/**
* 查询营业面积列表
*
* @param companyArea 营业面积
* @return 营业面积集合
*/
public List<CompanyArea> selectCompanyAreaList(CompanyArea companyArea);
/**
* 新增营业面积
*
* @param companyArea 营业面积
* @return 结果
*/
public int insertCompanyArea(CompanyArea companyArea);
/**
* 修改营业面积
*
* @param companyArea 营业面积
* @return 结果
*/
public int updateCompanyArea(CompanyArea companyArea);
/**
* 删除营业面积
*
* @param companyAreaId 营业面积ID
* @return 结果
*/
public int deleteCompanyAreaById(Long companyAreaId);
/**
* 批量删除营业面积
*
* @param companyAreaIds 需要删除的数据ID
* @return 结果
*/
public int deleteCompanyAreaByIds(String[] companyAreaIds);
}

View File

@ -0,0 +1,69 @@
package com.ruoyi.province.platform.service;
import java.util.List;
import com.ruoyi.province.platform.domain.CompanyArea;
/**
* 营业面积Service接口
*
* @author dalin
* @date 2020-12-22
*/
public interface ICompanyAreaService
{
/**
* 查询营业面积
*
* @param companyAreaId 营业面积ID
* @return 营业面积
*/
public CompanyArea selectCompanyAreaById(Long companyAreaId);
/**
* 查询营业面积
*
* @param companyAreaId 营业面积ID
* @return 营业面积
*/
public String checkCompanyAreaUnique(CompanyArea companyArea);
/**
* 查询营业面积列表
*
* @param companyArea 营业面积
* @return 营业面积集合
*/
public List<CompanyArea> selectCompanyAreaList(CompanyArea companyArea);
/**
* 新增营业面积
*
* @param companyArea 营业面积
* @return 结果
*/
public int insertCompanyArea(CompanyArea companyArea);
/**
* 修改营业面积
*
* @param companyArea 营业面积
* @return 结果
*/
public int updateCompanyArea(CompanyArea companyArea);
/**
* 批量删除营业面积
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteCompanyAreaByIds(String ids);
/**
* 删除营业面积信息
*
* @param companyAreaId 营业面积ID
* @return 结果
*/
public int deleteCompanyAreaById(Long companyAreaId);
}

View File

@ -0,0 +1,118 @@
package com.ruoyi.province.platform.service.impl;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.province.platform.Constants.BussiConstants;
import com.ruoyi.province.platform.domain.CompanyArea;
import com.ruoyi.province.platform.mapper.CompanyAreaMapper;
import com.ruoyi.province.platform.service.ICompanyAreaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 营业面积Service业务层处理
*
* @author dalin
* @date 2020-12-22
*/
@Service
public class CompanyAreaServiceImpl implements ICompanyAreaService
{
@Autowired
private CompanyAreaMapper companyAreaMapper;
/**
* 查询营业面积
*
* @param companyAreaId 营业面积ID
* @return 营业面积
*/
@Override
public CompanyArea selectCompanyAreaById(Long companyAreaId)
{
return companyAreaMapper.selectCompanyAreaById(companyAreaId);
}
/**
* 查询营业面积
*
* @param companyAreaId 营业面积ID
* @return 营业面积
*/
@Override
public String checkCompanyAreaUnique(CompanyArea companyArea)
{
Long docId = StringUtils.isNull( companyArea.getCompanyAreaId() ) ? -1L : companyArea.getCompanyAreaId();
CompanyArea info = companyAreaMapper.checkCompanyAreaUnique( companyArea.getCompanyAreaName() );
if (StringUtils.isNotNull(info) && info.getCompanyAreaId().longValue() != docId.longValue())
{
return BussiConstants.DOC_NAME_NOT_UNIQUE;
}
return BussiConstants.DOC_NAME_UNIQUE;
}
/**
* 查询营业 面积列表
*
* @param companyArea 营业面积
* @return 营业面积
*/
@Override
public List<CompanyArea> selectCompanyAreaList(CompanyArea companyArea)
{
return companyAreaMapper.selectCompanyAreaList(companyArea);
}
/**
* 新增营业面积
*
* @param companyArea 营业面积
* @return 结果
*/
@Override
public int insertCompanyArea(CompanyArea companyArea)
{
companyArea.setCreateTime(DateUtils.getNowDate());
return companyAreaMapper.insertCompanyArea(companyArea);
}
/**
* 修改营业面积
*
* @param companyArea 营业面积
* @return 结果
*/
@Override
public int updateCompanyArea(CompanyArea companyArea)
{
companyArea.setUpdateTime(DateUtils.getNowDate());
return companyAreaMapper.updateCompanyArea(companyArea);
}
/**
* 删除营业面积对象
*
* @param ids 需要删除的数据ID
* @return 结果
*/
@Override
public int deleteCompanyAreaByIds(String ids)
{
return companyAreaMapper.deleteCompanyAreaByIds(Convert.toStrArray(ids));
}
/**
* 删除营业面积信息
*
* @param companyAreaId 营业面积ID
* @return 结果
*/
@Override
public int deleteCompanyAreaById(Long companyAreaId)
{
return companyAreaMapper.deleteCompanyAreaById(companyAreaId);
}
}

View File

@ -0,0 +1,100 @@
<?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.province.platform.mapper.CompanyAreaMapper">
<resultMap type="CompanyArea" id="CompanyAreaResult">
<result property="companyAreaId" column="company_area_id" />
<result property="companyAreaName" column="company_area_name" />
<result property="docNum" column="doc_num" />
<result property="status" column="status" />
<result property="remark" column="remark" />
<result property="delFlag" column="del_flag" />
<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="createByuserName" column="createByuserName" />
<result property="updateByuserName" column="updateByuserName" />
</resultMap>
<sql id="selectCompanyAreaVo">
select t.company_area_id, t.company_area_name, t.doc_num, t.status, t.remark, t.del_flag, t.create_by, t.create_time, t.update_by, t.update_time,
a1.user_name as createByuserName, a2.user_name as updateByuserName from platf_company_area t
left join sys_user a1 on t.create_by=a1.login_name
left join sys_user a2 on t.update_by=a2.login_name
</sql>
<select id="selectCompanyAreaList" parameterType="CompanyArea" resultMap="CompanyAreaResult">
<include refid="selectCompanyAreaVo"/>
<where>
<if test="companyAreaName != null and companyAreaName != ''"> and t.company_area_name like concat('%', #{companyAreaName}, '%')</if>
<if test="status != null and status != ''"> and t.status = #{status}</if>
</where>
</select>
<select id="selectCompanyAreaById" parameterType="Long" resultMap="CompanyAreaResult">
<include refid="selectCompanyAreaVo"/>
where t.company_area_id = #{companyAreaId}
</select>
<select id="checkCompanyAreaUnique" parameterType="String" resultMap="CompanyAreaResult">
<include refid="selectCompanyAreaVo"/>
where t.company_area_name=#{CompanyAreaName} limit 1
</select>
<insert id="insertCompanyArea" parameterType="CompanyArea" useGeneratedKeys="true" keyProperty="companyAreaId">
insert into platf_company_area
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="companyAreaName != null and companyAreaName != ''">company_area_name,</if>
<if test="docNum != null">doc_num,</if>
<if test="status != null and status != ''">status,</if>
<if test="remark != null">remark,</if>
<if test="delFlag != null and delFlag != ''">del_flag,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="companyAreaName != null and companyAreaName != ''">#{companyAreaName},</if>
<if test="docNum != null">#{docNum},</if>
<if test="status != null and status != ''">#{status},</if>
<if test="remark != null">#{remark},</if>
<if test="delFlag != null and delFlag != ''">#{delFlag},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateCompanyArea" parameterType="CompanyArea">
update platf_company_area
<trim prefix="SET" suffixOverrides=",">
<if test="companyAreaName != null and companyAreaName != ''">company_area_name = #{companyAreaName},</if>
<if test="docNum != null">doc_num = #{docNum},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where company_area_id = #{companyAreaId}
</update>
<delete id="deleteCompanyAreaById" parameterType="Long">
delete from platf_company_area where company_area_id = #{companyAreaId}
</delete>
<delete id="deleteCompanyAreaByIds" parameterType="String">
delete from platf_company_area where company_area_id in
<foreach item="companyAreaId" collection="array" open="(" separator="," close=")">
#{companyAreaId}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,161 @@
package com.ruoyi.web.controller.platform;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.province.platform.Constants.BussiConstants;
import com.ruoyi.province.platform.domain.CompanyArea;
import com.ruoyi.province.platform.service.ICompanyAreaService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 营业面积Controller
*
* @author dalin
* @date 2020-12-22
*/
@Controller
@RequestMapping("/platform/companyarea")
public class CompanyAreaController extends BaseController
{
private String prefix = "platform/companyarea";
@Autowired
private ICompanyAreaService companyAreaService;
@RequiresPermissions("platform:companyarea:view")
@GetMapping()
public String companyarea()
{
return prefix + "/companyarea";
}
/**
* 查询营业面积列表
*/
@RequiresPermissions("platform:companyarea:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(CompanyArea companyArea)
{
startPage();
List<CompanyArea> list = companyAreaService.selectCompanyAreaList(companyArea);
return getDataTable(list);
}
/**
* 导出营业面积列表
*/
@RequiresPermissions("platform:companyarea:export")
@Log(title = "营业面积", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(CompanyArea companyArea)
{
List<CompanyArea> list = companyAreaService.selectCompanyAreaList(companyArea);
ExcelUtil<CompanyArea> util = new ExcelUtil<CompanyArea>(CompanyArea.class);
return util.exportExcel(list, "companyarea");
}
/**
* 校验营业面积名称 是否重复
*/
@PostMapping("/checkcompanyAreaUnique")
@ResponseBody
public String checkcompanyAreaUnique(CompanyArea companyArea)
{
return companyAreaService.checkCompanyAreaUnique(companyArea);
}
/**
* 新增营业面积
*/
@GetMapping("/add")
public String add(ModelMap mmap)
{
// 取身份信息
mmap.put("user", ShiroUtils.getSysUser() );
return prefix + "/add";
}
/**
* 新增保存营业面积
*/
@RequiresPermissions("platform:companyarea:add")
@Log(title = "营业面积", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(CompanyArea companyArea)
{
// 控制名称重复!
if (BussiConstants.DOC_NAME_NOT_UNIQUE.equals(companyAreaService.checkCompanyAreaUnique(companyArea)))
{
return error("修改单据'" + companyArea.getCompanyAreaName() + "'失败,名称已存在");
}
// 取身份信息
companyArea.setCreateBy( ShiroUtils.getLoginName() );
companyArea.setCreateTime(DateUtils.getNowDate() );
return toAjax(companyAreaService.insertCompanyArea(companyArea));
}
/**
* 修改营业面积
*/
@GetMapping("/edit/{companyAreaId}")
public String edit(@PathVariable("companyAreaId") Long companyAreaId, ModelMap mmap)
{
CompanyArea companyArea = companyAreaService.selectCompanyAreaById(companyAreaId);
mmap.put("companyArea", companyArea);
// 取身份信息
mmap.put("user", ShiroUtils.getSysUser() );
return prefix + "/edit";
}
/**
* 修改保存营业面积
*/
@RequiresPermissions("platform:companyarea:edit")
@Log(title = "营业面积", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(CompanyArea companyArea)
{
// 控制名称重复!
if (BussiConstants.DOC_NAME_NOT_UNIQUE.equals(companyAreaService.checkCompanyAreaUnique(companyArea)))
{
return error("修改单据'" + companyArea.getCompanyAreaName() + "'失败,名称已存在");
}
companyArea.setUpdateBy( ShiroUtils.getLoginName() );
companyArea.setUpdateTime( DateUtils.getNowDate() );
return toAjax(companyAreaService.updateCompanyArea(companyArea));
}
/**
* 删除营业面积
*/
@RequiresPermissions("platform:companyarea:remove")
@Log(title = "营业面积", businessType = BusinessType.DELETE)
@PostMapping( "/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
return toAjax(companyAreaService.deleteCompanyAreaByIds(ids));
}
}

View File

@ -0,0 +1,124 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('新增营业面积')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-companyarea-add">
<input type="hidden" name="createBy" id="createBy" />
<input type="hidden" name="updateBy" id="updateBy" />
<div class="row mt10">
<div class="col-sm-6">
<label class="col-sm-4 control-label is-required">名称:</label>
<div class="col-sm-8">
<input id="companyAreaName" name="companyAreaName" class="form-control" type="text" required>
</div>
</div>
<div class="col-sm-6">
<label class="col-sm-4 control-label">单据号:</label>
<div class="col-sm-8">
<input id="docNum" name="docNum" class="form-control" readonly="readonly" type="text">
</div>
</div>
</div>
<div class="row mt10">
<div class="col-sm-6">
<label class="col-sm-4 control-label is-required">资料状态:</label>
<div class="col-sm-8">
<div class="radio-box" th:each="dict : ${@dict.getType('platf_doc_statu')}">
<input type="radio" th:id="${'status_' + dict.dictCode}" id="status" name="status" th:value="${dict.dictValue}" th:checked="${dict.default}" required>
<label th:for="${'status_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
</div>
</div>
</div>
</div>
<div class="row mt10">
<div class="col-sm-12">
<div class="form-group">
<label class="col-sm-2 control-label">备注:</label>
<div class="col-sm-10">
<textarea id="remark" name="remark" maxlength="500" class="form-control" rows="3" ></textarea>
</div>
</div>
</div>
</div>
<div class="row mt10">
<div class="col-sm-6">
<label class="col-sm-4 control-label is-required">制单人:</label>
<div class="col-sm-8">
<input id="createByuserName" name="createByuserName" class="form-control" readonly="readonly" type="text" required>
</div>
</div>
<div class="col-sm-6">
<label class="col-sm-4 control-label is-required">制单时间:</label>
<div class="col-sm-8">
<input id="createTime" name="createTime" class="form-control" readonly="readonly" type="text" required>
</div>
</div>
</div>
<div class="row mt10">
<div class="col-sm-6">
<label class="col-sm-4 control-label">修改人:</label>
<div class="col-sm-8">
<input id="updateByuserName" name="updateByuserName" class="form-control" readonly="readonly" type="text">
</div>
</div>
<div class="col-sm-6">
<label class="col-sm-4 control-label">修改时间:</label>
<div class="col-sm-8">
<input id="updateTime" name="updateTime" class="form-control" readonly="readonly" type="text">
</div>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
$("#createBy").val([[${user.loginName}]]);
$("#createByuserName").val([[${user.userName}]]);
$("#createTime").val
( $.common.dateFormat(new Date(),'yyyy-MM-dd HH:mm:ss') ) ; //获取日期与时间
var prefix = ctx + "platform/companyarea"
$("#form-companyarea-add").validate({
onkeyup: false,
rules:{
econName:{
remote: {
url: prefix + "/checkCompanyAreaUnique",
type: "post",
dataType: "json",
data: {
"CompanyAreaName" : function() {
return $.common.trim($("#CompanyAreaName").val());
}
},
dataFilter: function(data, type) {
return $.validate.unique(data);
}
}
},
},
messages: {
"CompanyAreaName": {
remote: "营业面积 名称已经存在"
}
},
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-companyarea-add').serialize());
}
}
</script>
</body>
</html>

View File

@ -0,0 +1,120 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('营业面积列表')" />
</head>
<body class="gray-bg">
<div class="container-div">
<div class="row">
<div class="col-sm-12 search-collapse">
<form id="formId">
<div class="select-list">
<ul>
<li>
<label>名称:</label>
<input type="text" name="companyAreaName"/>
</li>
<li>
<label>资料状态:</label>
<select name="status" th:with="type=${@dict.getType('platf_doc_statu')}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
</li>
</ul>
</div>
</form>
</div>
<div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="platform:companyarea:add">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="platform:companyarea:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="platform:companyarea:remove">
<i class="fa fa-remove"></i> 删除
</a>
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="platform:companyarea:export">
<i class="fa fa-download"></i> 导出
</a>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('platform:companyarea:edit')}]];
var removeFlag = [[${@permission.hasPermi('platform:companyarea:remove')}]];
var statusDatas = [[${@dict.getType('platf_doc_statu')}]];
var prefix = ctx + "platform/companyarea";
$(function() {
var options = {
url: prefix + "/list",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
modalName: "营业面积",
columns: [{
checkbox: true
},
{
field: 'companyAreaName',
title: '名称'
},
{
field: 'docNum',
title: '单据号'
},
{
field: 'status',
title: '资料状态',
formatter: function(value, row, index) {
return $.table.selectDictLabel(statusDatas, value);
}
},
{
field: 'remark',
title: '备注'
},
{
field: 'createByuserName',
title: '制单人'
},
{
field: 'createTime',
title: '制单时间'
},
{
field: 'updateByuserName',
title: '修改人'
},
{
field: 'updateTime',
title: '修改时间'
},
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.companyAreaId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.companyAreaId + '\')"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}
}]
};
$.table.init(options);
});
</script>
</body>
</html>

View File

@ -0,0 +1,136 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('修改营业面积')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-companyarea-edit" th:object="${companyArea}">
<input type="hidden" name="createBy" id="createBy" />
<input type="hidden" name="updateBy" id="updateBy" />
<input name="companyAreaId" th:field="*{companyAreaId}" type="hidden">
<div class="row mt10">
<div class="col-sm-6">
<label class="col-sm-4 control-label is-required">名称:</label>
<div class="col-sm-8">
<input name="companyAreaName" th:field="*{companyAreaName}" class="form-control" type="text" required>
</div>
</div>
<div class="col-sm-6">
<label class="col-sm-4 control-label">单据号:</label>
<div class="col-sm-8">
<input name="docNum" th:field="*{docNum}" class="form-control" type="text">
</div>
</div>
</div>
<div class="row mt10">
<div class="col-sm-6">
<label class="col-sm-4 control-label is-required">资料状态:</label>
<div class="col-sm-8">
<div class="radio-box" th:each="dict : ${@dict.getType('platf_doc_statu')}">
<input type="radio" th:id="${'status_' + dict.dictCode}" name="status" th:value="${dict.dictValue}" th:field="*{status}" required>
<label th:for="${'status_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
</div>
</div>
</div>
</div>
<div class="row mt10">
<div class="col-sm-12">
<div class="form-group">
<label class="col-sm-2 control-label">备注:</label>
<div class="col-sm-10">
<textarea name="remark" maxlength="500" class="form-control" rows="3" >[[*{remark}]]</textarea>
</div>
</div>
</div>
</div>
<div class="row mt10">
<div class="col-sm-6">
<label class="col-sm-4 control-label is-required">制单人:</label>
<div class="col-sm-8">
<input name="createByuserName" th:field="*{createByuserName}" class="form-control" type="text" required>
</div>
</div>
<div class="col-sm-6">
<label class="col-sm-4 control-label is-required">制单时间:</label>
<div class="col-sm-8">
<input name="createTime" th:field="*{createTime}" class="form-control" type="text" required>
</div>
</div>
</div>
<div class="row mt10">
<div class="col-sm-6">
<label class="col-sm-4 control-label">修改人:</label>
<div class="col-sm-8">
<input name="updateByuserName" th:field="*{updateByuserName}" class="form-control" type="text">
</div>
</div>
<div class="col-sm-6">
<label class="col-sm-4 control-label">修改时间:</label>
<div class="col-sm-8">
<input name="updateTime" th:field="*{updateTime}" class="form-control" type="text">
</div>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
$("#updateBy").val([[${user.loginName}]]);
$("#updateByuserName").val([[${user.userName}]]);
$("#updateTime").val
( $.common.dateFormat(new Date(),'yyyy-MM-dd HH:mm:ss') ) ; //获取日期与时间
var prefix = ctx + "platform/companyarea";
$("#form-companyarea-edit").validate({
onkeyup: false,
rules:{
econName:{
remote: {
url: prefix + "/checkCompanyAreaUnique",
type: "post",
dataType: "json",
data: {
"CompanyAreaName" : function() {
return $.common.trim($("#CompanyAreaName").val());
}
},
dataFilter: function(data, type) {
return $.validate.unique(data);
}
}
},
},
messages: {
"CompanyAreaName": {
remote: "营业面积 名称已经存在"
}
},
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/edit", $('#form-companyarea-edit').serialize());
}
}
</script>
</body>
</html>

View File

@ -67,11 +67,6 @@
columns: [{ columns: [{
checkbox: true checkbox: true
}, },
{
field: 'econId',
title: '主键',
visible: false
},
{ {
field: 'econName', field: 'econName',
title: '名称' title: '名称'
@ -95,10 +90,6 @@
field: 'createByuserName', field: 'createByuserName',
title: '制单人' title: '制单人'
}, },
{
field: 'createBy',
title: '制单人ID'
},
{ {
field: 'createTime', field: 'createTime',
title: '制单时间' title: '制单时间'
@ -107,10 +98,6 @@
field: 'updateByuserName', field: 'updateByuserName',
title: '修改人' title: '修改人'
}, },
{
field: 'updateBy',
title: '修改人ID'
},
{ {
field: 'updateTime', field: 'updateTime',
title: '修改时间' title: '修改时间'

View File

@ -51,6 +51,8 @@ public class GenConstants
/** 页面不需要编辑字段 */ /** 页面不需要编辑字段 */
public static final String[] COLUMNNAME_NOT_EDIT = { "id", "create_by", "create_time", "update_by", "update_time", "del_flag" }; public static final String[] COLUMNNAME_NOT_EDIT = { "id", "create_by", "create_time", "update_by", "update_time", "del_flag" };
public static final String[] COLUMNNAME_QRYLIST = { "create_by", "create_time", "update_by", "update_time"};
/** 页面不需要显示的列表字段 */ /** 页面不需要显示的列表字段 */
public static final String[] COLUMNNAME_NOT_LIST = { "id", "create_by", "create_time", "del_flag", "update_by", public static final String[] COLUMNNAME_NOT_LIST = { "id", "create_by", "create_time", "del_flag", "update_by",
"update_time" }; "update_time" };

View File

@ -1,8 +1,9 @@
package com.ruoyi.common.utils; package com.ruoyi.common.utils;
import com.ruoyi.common.core.text.StrFormatter;
import java.util.Collection; import java.util.Collection;
import java.util.Map; import java.util.Map;
import com.ruoyi.common.core.text.StrFormatter;
/** /**
* 字符串工具类 * 字符串工具类
@ -362,6 +363,16 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
return result.toString(); return result.toString();
} }
/**
* 首字母大写
* 例如user_name->userName
*/
public static String captureName(String name) {
char[] cs=name.toCharArray();
cs[0]-=32;
return String.valueOf(cs);
}
/** /**
* 驼峰式命名法 * 驼峰式命名法
* 例如user_name->userName * 例如user_name->userName

View File

@ -2,6 +2,7 @@ package com.ruoyi.generator.service.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.util.StringUtil;
import com.ruoyi.common.constant.Constants; import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.constant.GenConstants; import com.ruoyi.common.constant.GenConstants;
import com.ruoyi.common.core.text.CharsetKit; import com.ruoyi.common.core.text.CharsetKit;
@ -228,7 +229,6 @@ public class GenTableServiceImpl implements IGenTableService
// 是否 存在制单人 // 是否 存在制单人
setCreatUpdateByColumn(table); setCreatUpdateByColumn(table);
VelocityInitializer.initVelocity(); VelocityInitializer.initVelocity();
List<RelevTable> lstRelev = List<RelevTable> lstRelev =
@ -381,6 +381,7 @@ public class GenTableServiceImpl implements IGenTableService
// 设置名称重复列信息 // 设置名称重复列信息
setRepeatDspColumn(table); setRepeatDspColumn(table);
// 取得制单人 // 取得制单人
setCreatUpdateByColumn(table);
VelocityInitializer.initVelocity(); VelocityInitializer.initVelocity();
@ -508,7 +509,17 @@ public class GenTableServiceImpl implements IGenTableService
{ {
if (column.isRepeatControl()) if (column.isRepeatControl())
{ {
table.setDspColumn(column); GenTableColumn tempcolumn = null ; // new GenTableColumn()
try{
tempcolumn = (GenTableColumn) column.clone();
}catch (Exception e){
}
tempcolumn.setRelevjavafiledname(com.ruoyi.common.utils.StringUtils.captureName( table.getPkColumn().getJavaField() ));
tempcolumn.setJavaField( com.ruoyi.common.utils.StringUtils.captureName( tempcolumn.getJavaField() ) ); // 首字母大写
table.setDspColumn(tempcolumn);
break; break;
} }
} }

View File

@ -58,7 +58,15 @@ public class GenUtils
// 若是 制单时间 修改时间 在界面上 文本框 // 若是 制单时间 修改时间 在界面上 文本框
if (arraysContains(GenConstants.COLUMNNAME_NOT_EDIT, columnName) && !column.isPk()) if (arraysContains(GenConstants.COLUMNNAME_NOT_EDIT, columnName) && !column.isPk())
{ {
column.setJavaType(GenConstants.TYPE_STRING);
if (arraysContains(GenConstants.COLUMNNAME_QRYLIST, columnName) && !column.isPk()) {
column.setIsEdit("1");
column.setIsInsert("1");
column.setIsQuery("0");
column.setIsList("1");
}
column.setJavaType(GenConstants.TYPE_DATE);
column.setHtmlType(GenConstants.HTML_INPUT); column.setHtmlType(GenConstants.HTML_INPUT);
} else { } else {
column.setJavaType(GenConstants.TYPE_DATE); column.setJavaType(GenConstants.TYPE_DATE);
@ -90,11 +98,20 @@ public class GenUtils
// 制单人修改人 关联用户操作员Id // 制单人修改人 关联用户操作员Id
if (arraysContains(GenConstants.COLUMNNAME_RELEV_FIELDS, columnName) && !column.isPk()) if (arraysContains(GenConstants.COLUMNNAME_RELEV_FIELDS, columnName) && !column.isPk())
{ {
column.setRelevTable("SysUser"); // sys_user column.setIsList("1");
column.setIsEdit("1");
column.setIsInsert("1");
column.setIsQuery("0");
column.setRelevEntity("SysUser"); // sys_user
// column.setRelevTableId("login_name"); // column.setRelevTableId("login_name");
// column.setRelevTableName("user_name"); // column.setRelevTableName("user_name");
} }
// 资料状态
if (column.getColumnName().toLowerCase().equals("status")){
column.setDictType("platf_doc_statu");
}
// 插入字段默认所有字段都需要插入 // 插入字段默认所有字段都需要插入
column.setIsInsert(GenConstants.REQUIRE); column.setIsInsert(GenConstants.REQUIRE);
@ -132,6 +149,20 @@ public class GenUtils
column.setIsRequired("0"); column.setIsRequired("0");
} }
// 设置单据号
if ( columnName.contains("doc_num") ){
column.setIsQuery("0");
column.setIsList("1");
column.setIsRequired("0");
}
// 名称
if ( columnName.contains("_name") ){
column.setIsRepeatControl("1");
column.setIsQuery("1");
column.setIsList("1");
column.setIsRequired("1");
}
// 查询字段类型 // 查询字段类型
if (StringUtils.endsWithIgnoreCase(columnName, "name")) if (StringUtils.endsWithIgnoreCase(columnName, "name"))

View File

@ -61,15 +61,9 @@ public class VelocityUtils {
velocityContext.put("author", genTable.getFunctionAuthor()); velocityContext.put("author", genTable.getFunctionAuthor());
velocityContext.put("datetime", DateUtils.getDate()); velocityContext.put("datetime", DateUtils.getDate());
velocityContext.put("pkColumn", genTable.getPkColumn()); velocityContext.put("pkColumn", genTable.getPkColumn());
velocityContext.put("dspRepeatColumn", genTable.getDspColumn());
velocityContext.put("importList", getImportList(genTable)); velocityContext.put("importList", getImportList(genTable));
velocityContext.put("permissionPrefix", getPermissionPrefix(moduleName, businessName)); velocityContext.put("permissionPrefix", getPermissionPrefix(moduleName, businessName));
velocityContext.put("billPrefix", genTable.getBillPrefix()); // 单据前缀
// 制单人
velocityContext.put("createByColumn",genTable.getCreateByColumn());
// 取出页面需要的字段ing // 取出页面需要的字段ing
List<GenTableColumn> tempcolumns = genTable.getColumns(); List<GenTableColumn> tempcolumns = genTable.getColumns();
List<GenTableColumn> effectivecols = new ArrayList<GenTableColumn>();//定义一个list对象 List<GenTableColumn> effectivecols = new ArrayList<GenTableColumn>();//定义一个list对象
@ -154,7 +148,15 @@ public class VelocityUtils {
velocityContext.put("mappercols", genTable.getColumns() ); // velocityContext.put("mappercols", genTable.getColumns() ); //
velocityContext.put("columns", fieldcols ); // genTable.getColumns() velocityContext.put("columns", fieldcols ); // genTable.getColumns()
//前缀
velocityContext.put("billPrefix", genTable.getBillPrefix()); // 单据前缀
// 名称 重复
velocityContext.put("dspRepeatColumn", genTable.getDspColumn());
// 制单人
velocityContext.put("createByColumn",genTable.getCreateByColumn());
velocityContext.put("table", genTable); velocityContext.put("table", genTable);
setMenuVelocityContext(velocityContext, genTable); setMenuVelocityContext(velocityContext, genTable);
if (GenConstants.TPL_TREE.equals(tplCategory)) { if (GenConstants.TPL_TREE.equals(tplCategory)) {
setTreeVelocityContext(velocityContext, genTable); setTreeVelocityContext(velocityContext, genTable);

View File

@ -3,9 +3,12 @@
<head> <head>
<th:block th:include="include :: header('修改生成信息')" /> <th:block th:include="include :: header('修改生成信息')" />
<th:block th:include="include :: select2-css" /> <th:block th:include="include :: select2-css" />
<link rel="stylesheet" href="css/bootstrap-table-fixed-columns.css">
<style type="text/css"> <style type="text/css">
.select-table table{table-layout:fixed;}.table>thead>tr>th{text-align:center;}.select-table .table td{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.form-control{padding:3px 6px 4px;height:30px;}.icheckbox-blue{top:0px;left:6px;}.form-control.select2-hidden-accessible{position:static!important;}.select-table table label.error{position: inherit;}select + label.error{z-index:1;right:40px;} .select-table table{table-layout:fixed;}.table>thead>tr>th{text-align:center;}.select-table .table td{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.form-control{padding:3px 6px 4px;height:30px;}.icheckbox-blue{top:0px;left:6px;}.form-control.select2-hidden-accessible{position:static!important;}.select-table table label.error{position: inherit;}select + label.error{z-index:1;right:40px;}
</style> </style>
</head> </head>
<body class="gray-bg" style="font: 14px Helvetica Neue, Helvetica, PingFang SC, 微软雅黑, Tahoma, Arial, sans-serif !important;"> <body class="gray-bg" style="font: 14px Helvetica Neue, Helvetica, PingFang SC, 微软雅黑, Tahoma, Arial, sans-serif !important;">
<section class="section-content"> <section class="section-content">
@ -100,9 +103,9 @@
</div> </div>
<!-- 字段信息 --> <!-- 字段信息 overflow:scroll; -->
<div class="tab-pane active" id="tab-field"> <div class="tab-pane active" id="tab-field">
<div class="select-table table-striped" style="overflow:scroll;margin-top: 0px;padding-top: 0px;padding-bottom: 0px;"> <div class="select-table table-striped" style="margin-top: 0px;padding-top: 0px;padding-bottom: 0px;">
<table id="bootstrap-table" style="min-width:1500px;" data-use-row-attr-func="true" data-reorderable-rows="true"></table> <table id="bootstrap-table" style="min-width:1500px;" data-use-row-attr-func="true" data-reorderable-rows="true"></table>
</div> </div>
</div> </div>
@ -285,6 +288,7 @@
<th:block th:include="include :: bootstrap-table-reorder-js" /> <th:block th:include="include :: bootstrap-table-reorder-js" />
<script th:src="@{/js/jquery.tmpl.js}"></script> <script th:src="@{/js/jquery.tmpl.js}"></script>
<th:block th:include="include :: jquery-cxselect-js" /> <th:block th:include="include :: jquery-cxselect-js" />
<th:block th:include="include :: bootstrap-table-fixed-columns-js" />
<script th:inline="javascript"> <script th:inline="javascript">
/* 用户信息-修改 */ /* 用户信息-修改 */
$("#form-table-edit").validate({ $("#form-table-edit").validate({
@ -306,6 +310,9 @@
function submitHandler() { function submitHandler() {
if ($.validate.form()) { if ($.validate.form()) {
console.log( " AAAAAAAAAAA ") ;
console.log( $("#form-gen-edit").serializeArray() ) ;
$.operate.saveTab(prefix + "/edit", $("#form-gen-edit").serializeArray()); $.operate.saveTab(prefix + "/edit", $("#form-gen-edit").serializeArray());
} }
} }
@ -322,6 +329,9 @@
showRefresh: false, showRefresh: false,
showToggle: false, showToggle: false,
showColumns: false, showColumns: false,
/*
fixedColumns: true,
fixedNumber: 3, */
onLoadSuccess: onLoadSuccess, onLoadSuccess: onLoadSuccess,
onReorderRow: onReorderRow, onReorderRow: onReorderRow,
columns: [{ columns: [{

View File

@ -0,0 +1,688 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('修改生成信息')" />
<th:block th:include="include :: select2-css" />
<style type="text/css">
.select-table table{table-layout:fixed;}.table>thead>tr>th{text-align:center;}.select-table .table td{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.form-control{padding:3px 6px 4px;height:30px;}.icheckbox-blue{top:0px;left:6px;}.form-control.select2-hidden-accessible{position:static!important;}.select-table table label.error{position: inherit;}select + label.error{z-index:1;right:40px;}
</style>
</head>
<body class="gray-bg" style="font: 14px Helvetica Neue, Helvetica, PingFang SC, 微软雅黑, Tahoma, Arial, sans-serif !important;">
<section class="section-content">
<div class="row">
<div class="col-xs-12">
<div class="ibox float-e-margins">
<div class="ibox-content" style="border-style:none;">
<div class="nav-tabs-custom">
<ul class="nav nav-tabs">
<li><a href="#tab-basic" data-toggle="tab" aria-expanded="false">基本信息</a></li>
<li class="active"><a href="#tab-field" data-toggle="tab" aria-expanded="true">字段信息</a></li>
<li><a href="#tab-gen" data-toggle="tab" aria-expanded="false">生成信息</a></li>
<li class="pull-right header">
<i class="fa fa-code"></i> 生成配置
</li>
</ul>
<form id="form-gen-edit" class="form-horizontal" th:object="${table}">
<input name="tableId" type="hidden" th:field="*{tableId}" />
<div class="tab-content">
<!-- 基本信息 -->
<div class="tab-pane" id="tab-basic">
<div class="row mt20">
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label is-required">表名称:</label>
<div class="col-sm-8">
<input name="tableName" class="form-control" type="text" placeholder="请输入表名称" maxlength="200" th:field="*{tableName}" required>
</div>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label is-required">表描述:</label>
<div class="col-sm-8">
<input name="tableComment" class="form-control" type="text" placeholder="请输入表描述" maxlength="500" th:field="*{tableComment}" required>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label is-required">实体类名称:</label>
<div class="col-sm-8">
<input name="className" class="form-control" type="text" placeholder="请输入实体类名称" maxlength="100" th:field="*{className}" required>
</div>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label is-required">作者:</label>
<div class="col-sm-8">
<input name="functionAuthor" class="form-control" type="text" placeholder="请输入作者" maxlength="50" th:field="*{functionAuthor}" required>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<div class="form-group">
<label class="col-xs-2 control-label">备注:</label>
<div class="col-xs-10">
<textarea name="remark" maxlength="500" class="form-control" rows="3"></textarea>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<div class="form-group">
<label class="col-xs-2 control-label" title="">Form列数</label>
<div class="col-xs-10">
<label class="radio-box"> <input type="radio" name="formCols" value="1" th:field="*{formCols}" /> 单列 </label>
<label class="radio-box"> <input type="radio" name="formCols" value="2" th:field="*{formCols}" checked="checked" /> 两列 </label>
<label class="radio-box"> <input type="radio" name="formCols" value="3" th:field="*{formCols}" /> 三列 </label>
<label class="radio-box"> <input type="radio" name="formCols" value="4" th:field="*{formCols}" /> 四列 </label>
</div>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label is-required">单据前缀编号A</label>
<div class="col-sm-8">
<input name="billPrefix" class="form-control" type="text" placeholder="请输入单据前缀编号" maxlength="100" th:field="*{billPrefix}" required>
</div>
</div>
</div>
</div>
</div>
<!-- 字段信息 -->
<div class="tab-pane active" id="tab-field">
<div class="select-table table-striped" style="overflow:scroll;margin-top: 0px;padding-top: 0px;padding-bottom: 0px;">
<table id="bootstrap-table" style="min-width:1500px;" data-use-row-attr-func="true" data-reorderable-rows="true"></table>
</div>
</div>
<!-- 生成信息 -->
<div class="tab-pane" id="tab-gen">
<div class="row mt20">
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label is-required">生成模板:</label>
<div class="col-sm-8">
<select class='form-control' id="tplCategory" name='tplCategory' style="width: 100%">
<option value="crud" th:field="*{tplCategory}">单表(增删改查)</option>
<option value="tree" th:field="*{tplCategory}">树表(增删改查)</option>
<option value="sub" th:field="*{tplCategory}">主子表(增删改查)</option>
</select>
</div>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label is-required" title="生成在哪个java包下例如 com.ruoyi.project.system">生成包路径:<i class="fa fa-question-circle-o"></i></label>
<div class="col-sm-8">
<input name="packageName" class="form-control" type="text" placeholder="请输入生成包路径" maxlength="100" th:field="*{packageName}" required>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label is-required" title="可理解为子系统名,例如 system">生成模块名:<i class="fa fa-question-circle-o"></i></label>
<div class="col-sm-8">
<input name="moduleName" class="form-control" type="text" placeholder="请输入生成模块名" maxlength="30" th:field="*{moduleName}" required>
</div>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label is-required" title="可理解为功能英文名,例如 user">生成业务名:<i class="fa fa-question-circle-o"></i></label>
<div class="col-sm-8">
<input name="businessName" class="form-control" type="text" placeholder="请输入生成业务名" maxlength="50" th:field="*{businessName}" required>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label is-required" title="用作类描述,例如 用户">生成功能名:<i class="fa fa-question-circle-o"></i></label>
<div class="col-sm-8">
<input name="functionName" class="form-control" type="text" placeholder="请输入生成功能名" maxlength="50" th:field="*{functionName}" required>
</div>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label is-required" title="分配到指定菜单下,例如 系统管理">上级菜单:<i class="fa fa-question-circle-o"></i></label>
<div class="col-sm-8">
<input id="parentMenuId" name="params[parentMenuId]" type="hidden" th:value="*{parentMenuId}"/>
<div class="input-group">
<input id="parentMenuName" name="params[parentMenuName]" class="form-control" type="text" onclick="selectMenuTree()" placeholder="请选择上级菜单" maxlength="50" th:value="*{parentMenuName}" required>
<span class="input-group-addon"><i class="fa fa-search"></i></span>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label" title="默认为zip压缩包下载也可以自定义生成路径">生成代码方式:<i class="fa fa-question-circle-o"></i></label>
<div class="col-sm-8">
<label class="radio-box"> <input type="radio" name="genType" value="0" th:field="*{genType}" /> zip压缩包 </label>
<label class="radio-box"> <input type="radio" name="genType" value="1" th:field="*{genType}" /> 自定义路径</label>
</div>
</div>
</div>
</div>
<div class="hidden row" id="pathinfo">
<div class="col-sm-12">
<div class="form-group">
<label class="col-xs-2 control-label" title="填写磁盘绝对路径若不填写则生成到当前Web项目下">生成基础路径:<i class="fa fa-question-circle-o"></i></label>
<div class="col-xs-10">
<div class="input-group input-group-sm">
<input id="genPath" name="genPath" class="form-control" type="text" th:field="*{genPath}" placeholder="请输入项目路径" maxlength="200">
<div class="input-group-btn">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">最近路径快速选择 <span class="caret"></span></button>
<ul class="dropdown-menu dropdown-menu-right" role="menu">
<li><a href="javascript:$('#genPath').val('/')"><i class="fa fa-refresh"></i>恢复默认的生成基础路径</a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="hidden" id="subInfo">
<h4 class="form-header h4">关联信息</h4>
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label is-required" title="关联子表的表名, 如sys_user">关联子表的表名:<i class="fa fa-question-circle-o"></i></label>
<div class="col-sm-8">
<select class='type form-control' id="subTableName" name='subTableName' th:attr='data-value=*{subTableName}' style="width: 100%">
<option value="">---请选择---</option>
</select>
</div>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label is-required" title="子表关联的外键名, 如user_id">子表关联的外键名:<i class="fa fa-question-circle-o"></i></label>
<div class="col-sm-8">
<select class='router form-control' id="subTableFkName" name='subTableFkName' th:attr='data-value=*{subTableFkName}' style="width: 100%">
<option value="">---请选择---</option>
</select>
</div>
</div>
</div>
</div>
</div>
<div class="hidden" id="otherInfo">
<h4 class="form-header h4">其他信息</h4>
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label is-required" title="树显示的编码字段名, 如dept_id">树编码字段:<i class="fa fa-question-circle-o"></i></label>
<div class="col-sm-8">
<select class='form-control' id="treeCode" name='params[treeCode]' style="width: 100%">
<option value="">---请选择---</option>
<option th:each="column : ${table.columns}" th:text="${column.columnName + '' + column.columnComment}" th:value="${column.columnName}" th:field="*{treeCode}"></option>
</select>
</div>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label is-required" title="树显示的父编码字段名, 如parent_Id">树父编码字段:<i class="fa fa-question-circle-o"></i></label>
<div class="col-sm-8">
<select class='form-control' id="treeParentCode" name='params[treeParentCode]' style="width: 100%">
<option value="">---请选择---</option>
<option th:each="column : ${table.columns}" th:text="${column.columnName + '' + column.columnComment}" th:value="${column.columnName}" th:field="*{treeParentCode}"></option>
</select>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label is-required" title="树节点的显示名称字段名, 如dept_name">树名称字段:<i class="fa fa-question-circle-o"></i></label>
<div class="col-sm-8">
<select class='form-control' id="treeName" name='params[treeName]' style="width: 100%">
<option value="">---请选择---</option>
<option th:each="column : ${table.columns}" th:text="${column.columnName + '' + column.columnComment}" th:value="${column.columnName}" th:field="*{treeName}"></option>
</select>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
<div class="box-footer">
<div class="col-sm-offset-5 col-sm-6">
<button type="button" class="btn btn-sm btn-primary" onclick="submitHandler()"><i class="fa fa-check"></i>保 存</button>&nbsp;
<button type="button" class="btn btn-sm btn-danger" onclick="closeItem()"><i class="fa fa-reply-all"></i>关 闭 </button>
</div>
</div>
</div>
</div>
</div>
</section>
<th:block th:include="include :: footer" />
<th:block th:include="include :: select2-js" />
<th:block th:include="include :: bootstrap-table-reorder-js" />
<script th:src="@{/js/jquery.tmpl.js}"></script>
<th:block th:include="include :: jquery-cxselect-js" />
<th:block th:include="include :: bootstrap-table-fixed-columns-js" />
<script th:inline="javascript">
/* 用户信息-修改 */
$("#form-table-edit").validate({
rules: {
tableName: {
required: true,
},
},
focusCleanup: true
});
/* 表级联信息 */
var data = [[${data}]];
$('#subInfo').cxSelect({
selects: ['type', 'router'],
jsonValue: 'v',
data: data
});
function submitHandler() {
if ($.validate.form()) {
$.operate.saveTab(prefix + "/edit", $("#form-gen-edit").serializeArray());
}
}
var prefix = ctx + "tool/gen";
$(function() {
var options = {
url: prefix + "/column/list",
sortName: "sort",
sortOrder: "desc",
height: $(window).height() - 166,
pagination: false,
showSearch: false,
showRefresh: false,
showToggle: false,
showColumns: false,
fixedColumns: true,
fixedNumber: 3,
onLoadSuccess: onLoadSuccess,
onReorderRow: onReorderRow,
columns: [{
title: "序号",
width: "6%",
formatter: function (value, row, index) {
// 编号隐藏域
var columnIdHtml = $.common.sprintf("<input type='hidden' name='columns[%s].columnId' value='%s'>", index, row.columnId);
// 排序隐藏域
var sortHtml = $.common.sprintf("<input type='hidden' name='columns[%s].sort' value='%s' id='columns_sort_%s'>", index, row.sort, row.columnId);
return columnIdHtml + sortHtml + $.table.serialNumber(index);
},
cellStyle: function(value, row, index) {
return { css: { "cursor": "move" } };
}
},
{
field: 'columnName',
title: '字段列名',
width: "10%",
class: "nodrag",
cellStyle: function(value, row, index) {
return { css: { "cursor": "default" } };
}
},
{
field: 'columnComment',
title: '字段描述',
width: "10%",
formatter: function (value, row, index) {
var html = $.common.sprintf("<input class='form-control' type='text' name='columns[%s].columnComment' value='%s'>", index, value);
return html;
}
},
{
field: 'columnType',
title: '物理类型',
width: "10%",
class: "nodrag",
cellStyle: function(value, row, index) {
return { css: { "cursor": "default" } };
}
},
{
field: 'javaType',
title: 'Java类型',
width: "10%",
formatter: function (value, row, index) {
var data = [{ index: index, javaType: value }];
return $("#javaTypeTpl").tmpl(data).html();
}
},
{
field: 'javaField',
title: 'Java属性',
width: "10%",
formatter: function (value, row, index) {
var html = $.common.sprintf("<input class='form-control' type='text' name='columns[%s].javaField' value='%s' required>", index, value);
return html;
}
},
{
field: 'isInsert',
title: '插入',
width: "6%",
formatter: function (value, row, index) {
var isCheck = value == 1 ? 'checked' : '';
var html = $.common.sprintf("<label class='check-box'><input type='checkbox' name='columns[%s].isInsert' value='1' %s></label>", index, isCheck);
return html;
}
},
{
field: 'isEdit',
title: '编辑',
width: "6%",
formatter: function (value, row, index) {
var isCheck = value == 1 ? 'checked' : '';
var html = $.common.sprintf("<label class='check-box'><input type='checkbox' name='columns[%s].isEdit' value='1' %s></label>", index, isCheck);
return html;
}
},
{
field: 'isList',
title: '列表',
width: "6%",
formatter: function (value, row, index) {
var isCheck = value == 1 ? 'checked' : '';
var html = $.common.sprintf("<label class='check-box'><input type='checkbox' name='columns[%s].isList' value='1' %s></label>", index, isCheck);
return html;
}
},
{
field: 'isQuery',
title: '查询',
width: "6%",
formatter: function (value, row, index) {
var isCheck = value == 1 ? 'checked' : '';
var html = $.common.sprintf("<label class='check-box'><input type='checkbox' name='columns[%s].isQuery' value='1' %s></label>", index, isCheck);
return html;
}
},
{
field: 'queryType',
title: '查询方式',
width: "10%",
formatter: function (value, row, index) {
var data = [{ index: index, queryType: value }];
return $("#queryTypeTpl").tmpl(data).html();
}
},
{
field: 'isRequired',
title: '必填',
width: "6%",
formatter: function (value, row, index) {
var isCheck = value == 1 ? 'checked' : '';
var html = $.common.sprintf("<label class='check-box'><input type='checkbox' name='columns[%s].isRequired' value='1' %s></label>", index, isCheck);
return html;
}
},
{
field: 'isReadonly',
title: '只读',
width: "6%",
formatter: function (value, row, index) {
var isCheck = value == 1 ? 'checked' : '';
var html = $.common.sprintf("<label class='check-box'><input type='checkbox' name='columns[%s].isReadonly' value='1' %s></label>", index, isCheck);
return html;
}
},
{
field: 'isRepeatControl',
title: '重复',
width: "6%",
formatter: function (value, row, index) {
var isCheck = value == 1 ? 'checked' : '';
var html = $.common.sprintf("<label class='check-box'><input type='checkbox' name='columns[%s].isRepeatControl' value='1' %s></label>", index, isCheck);
return html;
}
},
{
field: 'htmlType',
title: '显示类型',
width: "11%",
formatter: function (value, row, index) {
var data = [{ index: index, htmlType: value }];
return $("#htmlTypeTpl").tmpl(data).html();
}
},
{
field: 'dictType',
title: '字典类型',
width: "13%",
formatter: function (value, row, index) {
var html = $.common.sprintf("<input class='form-control' type='text' name='columns[%s].dictType' value='%s' id='columns_dict_%s'>", index, value, row.columnId);
return "<div class='input-group'>" + html + "<span class='input-group-addon input-sm' onclick='selectDictTree(" + row.columnId + ", this)'><i class='fa fa-search'></i></span></div>";
},
cellStyle: function(value, row, index) {
return { css: { "cursor": "default" } };
}
},
{
field: 'relevEntity',
title: '关联实体',
width: "12%",
formatter: function (value, row, index) {
var html = $.common.sprintf("<input class='form-control' type='text' name='columns[%s].relevEntity' value='%s' >", index, value);
return html;
}
}
/* , {
field: 'relevTableId',
title: '关联字段ID',
width: "12%",
formatter: function (value, row, index) {
var html = $.common.sprintf("<input class='form-control' type='text' name='columns[%s].relevTableId' value='%s' >", index, value);
return html;
}
},
{
field: 'relevTableName',
title: '关联字段名称',
width: "12%",
formatter: function (value, row, index) {
var html = $.common.sprintf("<input class='form-control' type='text' name='columns[%s].relevTableName' value='%s' >", index, value);
return html;
}
} */
]
};
$.table.init(options);
});
// 当所有数据被加载时触发处理函数
function onLoadSuccess(data){
$.fn.select2.defaults.set( "theme", "bootstrap" );
$("select.form-control").each(function () {
$(this).select2().on("change", function () {
$(this).valid();
})
})
$(".check-box").each(function() {
$(this).iCheck({
checkboxClass: 'icheckbox-blue'
})
})
}
// 当拖拽结束后处理函数
function onReorderRow(data) {
for (var i = 0; i < data.length; i++) {
$("#columns_sort_" + data[i].columnId).val(i+1);
}
}
$(function() {
var tplCategory = $("#tplCategory option:selected").val();
tplCategoryVisible(tplCategory);
var genType = $('input[name="genType"]:checked').val();
pathInfoVisible(genType);
});
$('#tplCategory').on('select2:select', function (event) {
var tplCategory = $(event.target).val();
tplCategoryVisible(tplCategory);
});
function tplCategoryVisible(tplCategory) {
if("crud" == tplCategory){
$("#treeCode").select2("val", [""]);
$("#treeParentCode").select2("val", [""]);
$("#treeName").select2("val", [""]);
$("#otherInfo").addClass("hidden");
$("#subInfo").addClass("hidden");
} else if("tree" == tplCategory){
$("#otherInfo").removeClass("hidden");
$("#treeCode").attr("required", "true");
$("#treeParentCode").attr("required", "true");
$("#treeName").attr("required", "true");
$("#subInfo").addClass("hidden");
} else if("sub" == tplCategory){
$("#subInfo").removeClass("hidden");
$("#treeCode").select2("val", [""]);
$("#treeParentCode").select2("val", [""]);
$("#treeName").select2("val", [""]);
$("#otherInfo").addClass("hidden");
}
}
$('input').on('ifChecked', function(event){
var genType = $(event.target).val();
pathInfoVisible(genType);
});
function pathInfoVisible(genType) {
if("0" == genType){
$("#genPath").val("/");
$("#pathinfo").addClass("hidden");
} else if("1" == genType){
$("#pathinfo").removeClass("hidden");
}
}
// 选择字典处理函数
function selectDictTree(columnId, obj) {
var dictType = $.common.nullToStr($(obj).parent().find("input").val());
var url = ctx + "system/dict/selectDictTree/" + columnId + "/" + dictType;
var options = {
title: '选择字典类型',
width: "380",
url: url,
callBack: doDictSubmit
};
$.modal.openOptions(options);
}
// 选择菜单处理函数
function selectMenuTree() {
var parentMenuId = $("#parentMenuId").val();
var menuId = parentMenuId > 0 ? parentMenuId : 1;
var url = ctx + "system/menu/selectMenuTree/" + menuId;
var options = {
title: '菜单选择',
width: "380",
url: url,
callBack: doMenuSubmit
};
$.modal.openOptions(options);
}
function doDictSubmit(index, layero){
var body = layer.getChildFrame('body', index);
var columnId = body.find('#columnId').val();
var dictType = body.find('#dictType').val();
layer.close(index);
$("#columns_dict_" + columnId).val(dictType);
}
function doMenuSubmit(index, layero){
var body = layer.getChildFrame('body', index);
$("#parentMenuId").val(body.find('#treeId').val());
$("#parentMenuName").val(body.find('#treeName').val());
layer.close(index);
}
</script>
</body>
</html>
<!-- java类型 -->
<script id="javaTypeTpl" type="text/x-jquery-tmpl">
<div>
<select class='form-control' name='columns[${index}].javaType'>
<option value="Long" {{if javaType==="Long"}}selected{{/if}}>Long</option>
<option value="String" {{if javaType==="String"}}selected{{/if}}>String</option>
<option value="Integer" {{if javaType==="Integer"}}selected{{/if}}>Integer</option>
<option value="Double" {{if javaType==="Double"}}selected{{/if}}>Double</option>
<option value="BigDecimal" {{if javaType==="BigDecimal"}}selected{{/if}}>BigDecimal</option>
<option value="Date" {{if javaType==="Date"}}selected{{/if}}>Date</option>
</select>
</div>
</script>
<!-- 查询方式 -->
<script id="queryTypeTpl" type="text/x-jquery-tmpl">
<div>
<select class='form-control' name='columns[${index}].queryType'>
<option value="EQ" {{if queryType==="EQ"}}selected{{/if}}>=</option>
<option value="NE" {{if queryType==="NE"}}selected{{/if}}>!=</option>
<option value="GT" {{if queryType==="GT"}}selected{{/if}}>></option>
<option value="GTE" {{if queryType==="GTE"}}selected{{/if}}>>=</option>
<option value="LT" {{if queryType==="LT"}}selected{{/if}}><</option>
<option value="LTE" {{if queryType==="LTE"}}selected{{/if}}><=</option>
<option value="LIKE" {{if queryType==="LIKE"}}selected{{/if}}>Like</option>
<option value="BETWEEN" {{if queryType==="BETWEEN"}}selected{{/if}}>Between</option>
</select>
</div>
</script>
<!-- 显示类型 -->
<script id="htmlTypeTpl" type="text/x-jquery-tmpl">
<div>
<select class='form-control' name='columns[${index}].htmlType'>
<option value="input" {{if htmlType==="input"}}selected{{/if}}>文本框</option>
<option value="textarea" {{if htmlType==="textarea"}}selected{{/if}}>文本域</option>
<option value="select" {{if htmlType==="select"}}selected{{/if}}>下拉框</option>
<option value="radio" {{if htmlType==="radio"}}selected{{/if}}>单选框</option>
<option value="checkbox" {{if htmlType==="checkbox"}}selected{{/if}}>复选框</option>
<option value="summernote" {{if htmlType==="summernote"}}selected{{/if}}>富文本</option>
<option value="datetime" {{if htmlType==="datetime"}}selected{{/if}}>日期控件</option>
<option value="upload" {{if htmlType==="upload"}}selected{{/if}}>上传控件</option>
<option value="btnlay" {{if htmlType==="btnlay"}}selected{{/if}}>弹框</option>
</select>
</div>
</script>

View File

@ -133,7 +133,7 @@
#end #end
#end #end
<script th:inline="javascript"> <script th:inline="javascript">
#if($createByColumn.size()>0) #if($createByColumn)
$("#createBy").val([[${user.loginName}]]); $("#createBy").val([[${user.loginName}]]);
$("#createByuserName").val([[${user.userName}]]); $("#createByuserName").val([[${user.userName}]]);
$("#createTime").val $("#createTime").val
@ -148,7 +148,33 @@
#end #end
#end #end
#end #end
$("#form-${businessName}-add").validate({ $("#form-${businessName}-add").validate({
#if($dspRepeatColumn)
onkeyup: false,
rules:{
econName:{
remote: {
url: prefix + "/check${ClassName}Unique",
type: "post",
dataType: "json",
data: {
"${dspRepeatColumn.javaField}" : function() {
return $.common.trim($("#${dspRepeatColumn.javaField}").val());
}
},
dataFilter: function(data, type) {
return $.validate.unique(data);
}
}
},
},
messages: {
"${dspRepeatColumn.javaField}": {
remote: "${functionName} 名称已经存在"
}
},
#end
focusCleanup: true focusCleanup: true
}); });

View File

@ -111,7 +111,7 @@
#end #end
#end #end
<script th:inline="javascript"> <script th:inline="javascript">
#if($createByColumn.size()>0) #if($createByColumn)
$("#updateBy").val([[${user.loginName}]]); $("#updateBy").val([[${user.loginName}]]);
$("#updateByuserName").val([[${user.userName}]]); $("#updateByuserName").val([[${user.userName}]]);
$("#updateTime").val $("#updateTime").val
@ -126,6 +126,31 @@
#end #end
#end #end
$("#form-${businessName}-edit").validate({ $("#form-${businessName}-edit").validate({
#if($dspRepeatColumn)
onkeyup: false,
rules:{
econName:{
remote: {
url: prefix + "/check${ClassName}Unique",
type: "post",
dataType: "json",
data: {
"${dspRepeatColumn.javaField}" : function() {
return $.common.trim($("#${dspRepeatColumn.javaField}").val());
}
},
dataFilter: function(data, type) {
return $.validate.unique(data);
}
}
},
},
messages: {
"${dspRepeatColumn.javaField}": {
remote: "${functionName} 名称已经存在"
}
},
#end
focusCleanup: true focusCleanup: true
}); });

View File

@ -101,7 +101,7 @@
columns: [{ columns: [{
checkbox: true checkbox: true
}, },
#foreach($column in $columns) #foreach($column in $effectivecols)
#set($dictType=$column.dictType) #set($dictType=$column.dictType)
#set($javaField=$column.javaField) #set($javaField=$column.javaField)
#set($parentheseIndex=$column.columnComment.indexOf("")) #set($parentheseIndex=$column.columnComment.indexOf(""))

View File

@ -5,11 +5,13 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap; import org.springframework.ui.ModelMap;
import com.ruoyi.common.utils.ShiroUtils;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import com.ruoyi.common.annotation.Log; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import ${packageName}.domain.${ClassName}; import ${packageName}.domain.${ClassName};
@ -87,6 +89,18 @@ public class ${ClassName}Controller extends BaseController
return util.exportExcel(list, "${businessName}"); return util.exportExcel(list, "${businessName}");
} }
#if($dspRepeatColumn)
/**
* 校验${functionName}名称 是否重复
*/
@PostMapping("/check${className}Unique")
@ResponseBody
public String check${className}Unique(${ClassName} ${className})
{
return ${className}Service.check${ClassName}Unique(${className});
}
#end
#if($table.crud || $table.sub) #if($table.crud || $table.sub)
/** /**
* 新增${functionName} * 新增${functionName}
@ -134,15 +148,16 @@ public class ${ClassName}Controller extends BaseController
@ResponseBody @ResponseBody
public AjaxResult addSave(${ClassName} ${className}) public AjaxResult addSave(${ClassName} ${className})
{ {
#if($dspRepeatColumn.size()>0) #if($dspRepeatColumn)
// 控制名称重复! // 控制名称重复!
if (BussiConstants.DOC_NAME_NOT_UNIQUE.equals(${ClassName}Service.check${ClassName}Unique(${className}))) if (BussiConstants.DOC_NAME_NOT_UNIQUE.equals(${className}Service.check${ClassName}Unique(${className})))
{ {
return error("修改单据'" + ${className}.get${dspRepeatColumn.javaField}() + "'失败,名称已存在"); return error("修改单据'" + ${className}.get${dspRepeatColumn.javaField}() + "'失败,名称已存在");
} }
#end #end
#if($createByColumn)
// 取身份信息 // 取身份信息
#if($createByColumn.size()>0)
${className}.setCreateBy( ShiroUtils.getLoginName() ); ${className}.setCreateBy( ShiroUtils.getLoginName() );
${className}.setCreateTime(DateUtils.getNowDate() ); ${className}.setCreateTime(DateUtils.getNowDate() );
#end #end
@ -178,15 +193,15 @@ public class ${ClassName}Controller extends BaseController
@ResponseBody @ResponseBody
public AjaxResult editSave(${ClassName} ${className}) public AjaxResult editSave(${ClassName} ${className})
{ {
#if($dspRepeatColumn.size()>0) #if($dspRepeatColumn)
// 控制名称重复! // 控制名称重复!
if (BussiConstants.DOC_NAME_NOT_UNIQUE.equals(${ClassName}Service.check${ClassName}Unique(${className}))) if (BussiConstants.DOC_NAME_NOT_UNIQUE.equals(${className}Service.check${ClassName}Unique(${className})))
{ {
return error("修改单据'" + ${className}.get${dspRepeatColumn.javaField}() + "'失败,名称已存在"); return error("修改单据'" + ${className}.get${dspRepeatColumn.javaField}() + "'失败,名称已存在");
} }
#end #end
#if($createByColumn.size()>0) #if($createByColumn)
${className}.setUpdateBy( ShiroUtils.getLoginName() ); ${className}.setUpdateBy( ShiroUtils.getLoginName() );
${className}.setUpdateTime( DateUtils.getNowDate() ); ${className}.setUpdateTime( DateUtils.getNowDate() );
#end #end

View File

@ -22,7 +22,7 @@ public interface ${ClassName}Mapper
*/ */
public ${ClassName} select${ClassName}ById(${pkColumn.javaType} ${pkColumn.javaField}); public ${ClassName} select${ClassName}ById(${pkColumn.javaType} ${pkColumn.javaField});
#if($dspRepeatColumn.size() > 0) #if($dspRepeatColumn)
/** /**
* 校验 ${functionName} 名称是否重复 * 校验 ${functionName} 名称是否重复
* *

View File

@ -22,7 +22,7 @@ public interface I${ClassName}Service
*/ */
public ${ClassName} select${ClassName}ById(${pkColumn.javaType} ${pkColumn.javaField}); public ${ClassName} select${ClassName}ById(${pkColumn.javaType} ${pkColumn.javaField});
#if($dspRepeatColumn.size() > 0) #if($dspRepeatColumn)
/** /**
* 查询${functionName} * 查询${functionName}
* *

View File

@ -48,19 +48,19 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service
return ${className}Mapper.select${ClassName}ById(${pkColumn.javaField}); return ${className}Mapper.select${ClassName}ById(${pkColumn.javaField});
} }
#if($dspRepeatColumn.size() > 0) #if($dspRepeatColumn)
/** /**
* 查询${functionName} * 查询${functionName}
* *
* @param ${pkColumn.javaField} ${functionName}ID * @param ${pkColumn.javaField} ${functionName}ID
* @return ${functionName} * @return ${functionName}
*/ checkEconNameUnique */
@Override @Override
public String check${ClassName}Unique(${ClassName} ${className}) public String check${ClassName}Unique(${ClassName} ${className})
{ {
Long docId = StringUtils.isNull( ${className}.get${pkColumn.javaField}() ) ? -1L : econType.getEconId(); Long docId = StringUtils.isNull( ${className}.get${dspRepeatColumn.relevjavafiledname}() ) ? -1L : ${className}.get${dspRepeatColumn.relevjavafiledname}();
${ClassName} info = ${className}Mapper.check${ClassName}Unique( ${ClassName}.get${dspRepeatColumn.javaField}() ); ${ClassName} info = ${className}Mapper.check${ClassName}Unique( ${className}.get${dspRepeatColumn.javaField}() );
if (StringUtils.isNotNull(info) && info.get${pkColumn.javaField}().longValue() != docId.longValue()) if (StringUtils.isNotNull(info) && info.get${dspRepeatColumn.relevjavafiledname}().longValue() != docId.longValue())
{ {
return BussiConstants.DOC_NAME_NOT_UNIQUE; return BussiConstants.DOC_NAME_NOT_UNIQUE;
} }

View File

@ -98,8 +98,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#end #end
</select> </select>
#if($dspRepeatColumn.size() > 0) #if($dspRepeatColumn)
<select id="check${ClassName}NameUnique" parameterType="String" resultMap="${ClassName}Result"> <select id="check${ClassName}Unique" parameterType="String" resultMap="${ClassName}Result">
<include refid="select${ClassName}Vo"/> <include refid="select${ClassName}Vo"/>
where t.${dspRepeatColumn.columnName}=#{${dspRepeatColumn.javaField}} limit 1 where t.${dspRepeatColumn.columnName}=#{${dspRepeatColumn.javaField}} limit 1
</select> </select>