Commit 9f6ddcb2 authored by 赵啸非's avatar 赵啸非

编写系统代码生成模块导入导出

parent 84ae12a0
......@@ -8,6 +8,8 @@ import MySwitch from '@/components/Switch';
import Confirm from '@/components/Confirm';
import FormField from '@/components/FormField';
import Upload from '@/components/Upload';
import ImageUpload from '@/components/ImageUpload';
import FileUpload from '@/components/FileUpload';
const Prototype = function() {};
......@@ -21,6 +23,8 @@ Prototype.install = (Vue, options) => {
Vue.component('MySwitch', MySwitch) // 拨动开关
Vue.component('Confirm', Confirm) // 局部确认窗口
Vue.component('Upload', Upload) // 文件上传
Vue.component('ImageUpload', ImageUpload) // 图片上传
Vue.component('FileUpload', FileUpload) // 图片上传
}
export default Prototype;
......@@ -191,35 +191,26 @@ export const download = (url, formData, config= {}) => {
responseType:'blob'
})
try {
console.log("option",option)
const data = await post(url, formData, option)
const link = document.createElement('a')
var blob = new Blob([data], { type: mimeMap.zip })
// //从response的headers中获取filename, 后端response.setHeader("Content-disposition", "attachment; filename=xxxx.docx") 设置的文件名;
// var patt = new RegExp('filename=([^;]+\\.[^\\.;]+);*')
// var contentDisposition = decodeURI(DataTransferItem.headers['Content-Disposition'])
// var result = patt.exec(contentDisposition)
// var fileName = result[1]
// fileName = fileName.replace(/\"/g, '')
let blob
let extName
if(option.type=="zip"){
blob = new Blob([data], { type: mimeMap.zip })
extName="zip"
}else if(option.type=="excel"){
blob = new Blob([data], { type: mimeMap.xlsx })
extName="xlsx"
}else{
extName="xlsx"
}
link.href = URL.createObjectURL(blob)
link.setAttribute('download', `${url.substr(1).replace(/\//g, '_')}_${new Date().getTime()}.zip`) // 设置下载文件名称
link.setAttribute('download', `${url.substr(1).replace(/\//g, '_')}_${new Date().getTime()}.${extName}`) // 设置下载文件名称
document.body.appendChild(link)
link.click()
document.body.appendChild(link)
// const data = await post(url, formData, option)
// let downloadUrl = window.URL.createObjectURL(new Blob([data]))
// let link = document.createElement('a')
// link.style.display ='none';
// link.href = downloadUrl;
// link.setAttribute('download', `${url.substr(1).replace(/\//g, '_')}_${new Date().getTime()}.xls`);
// document.body.appendChild(link);
// link.click();
// document.body.removeChild(link);
resolve();
} catch (error) {
reject(error);
......
......@@ -36,6 +36,8 @@ const router = new Router({
...restBuilder('flowable/definition', 'flowable/definition'), // 流程定义类
...restBuilder('demo', 'demo'), // 测试
...restBuilder('demo/detail', 'demo/detail'), // 测试详细
builder('flowable/task/record/index', 'flowable/task/record/index'),//流程申请
......
......@@ -9,6 +9,7 @@
ref="form"
>
<el-row>
<Field label="参数名称" prop="name" v-model="form.name"/>
<Field label="一级组织" prop="firstOrganize" v-model="form.firstOrganize"/>
<Field label="二级组织" prop="secondOrganize" v-model="form.secondOrganize"/>
......
......@@ -15,6 +15,10 @@ import java.util.List;
*/
@Repository("gentableColumnDao")
public class GentableColumnDaoImpl extends BaseCRUDDaoMybatis<GentableColumnEntity,Long> implements GentableColumnDao {
@Override
public GentableColumnEntity get(Long id) {
return super.get(id);
}
@Override
public List<GentableColumnEntity> selectDbTableColumnsByName(String tableName) {
......
package com.mortals.xhx.base.system.gentable.model;
import com.mortals.framework.model.BaseEntity;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.common.utils.StringUtils;
import lombok.Data;
......@@ -15,6 +16,17 @@ import java.util.Map;
@Data
public class GentableColumnEntityExt extends BaseEntityLong {
private List<Map<String,String>> dict;
private List<Map<String, String>> dict;
public String test(){
return "aaa";
}
public static void main(String[] args) {
GentableColumnEntity gentableColumnEntity = new GentableColumnEntity();
System.out.println(gentableColumnEntity.test());
}
}
\ No newline at end of file
package com.mortals.xhx.common.utils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.util.DateUtils;
import com.mortals.xhx.ManagerApplication;
import com.mortals.xhx.base.system.gentable.model.GentableColumnEntity;
import com.mortals.xhx.base.system.gentable.model.GentableEntity;
import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.common.key.GenConstants;
import freemarker.cache.ClassTemplateLoader;
import freemarker.template.Configuration;
import freemarker.template.Template;
import freemarker.template.TemplateException;
......@@ -256,13 +253,14 @@ public class FreeMarkerUtils {
String subClassName = genTable.getSubTable().getClassName();
String subTableFkClassName = StringUtils.convertToCamelCase(subTableFkName);
String businessName = subTable.getBusinessName().replace("\\.", "");
String functionName = subTable.getFunctionName();
String subPackageName = genTable.getPackageName() + "." + genTable.getModuleName() + "." + businessName;
data.put("subTable", subTable);
data.put("subPackageName", subPackageName);
data.put("subTableName", subTableName);
data.put("subTableFkName", subTableFkName);
data.put("subFunctionName", StringUtils.isNotEmpty(functionName) ? functionName : subTable.getTableComment());
//外键java类型
data.put("subTableFkType", getFkJavaType(subTable, subTableFkName));
data.put("subTableFkClassName", subTableFkClassName);
......
......@@ -4,11 +4,11 @@ import com.mortals.framework.dao.ICRUDDao;
import com.mortals.xhx.module.demo.model.DemoEntity;
/**
* 测试Dao
* 测试 DAO接口
* 测试demoDao
* 测试demo DAO接口
*
* @author zxfei
* @date 2021-10-03
* @date 2021-10-09
*/
public interface DemoDao extends ICRUDDao<DemoEntity,String>{
......
......@@ -7,10 +7,10 @@ import com.mortals.xhx.module.demo.model.DemoEntity;
import java.util.Date;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
/**
* 测试DaoImpl DAO接口
* 测试demoDaoImpl DAO接口
*
* @author zxfei
* @date 2021-10-03
* @date 2021-10-09
*/
@Repository("demoDao")
public class DemoDaoImpl extends BaseCRUDDaoMybatis<DemoEntity,String> implements DemoDao {
......
......@@ -4,11 +4,11 @@ import com.mortals.framework.dao.ICRUDDao;
import com.mortals.xhx.module.demo.detail.model.DemoDetailEntity;
/**
* Dao
* DAO接口
* 测试详细Dao
* 测试详细 DAO接口
*
* @author zxfei
* @date 2021-10-03
* @date 2021-10-09
*/
public interface DemoDetailDao extends ICRUDDao<DemoDetailEntity,Long>{
......
......@@ -7,10 +7,10 @@ import com.mortals.xhx.module.demo.detail.model.DemoDetailEntity;
import java.util.Date;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
/**
* DaoImpl DAO接口
* 测试详细DaoImpl DAO接口
*
* @author zxfei
* @date 2021-10-03
* @date 2021-10-09
*/
@Repository("demoDetailDao")
public class DemoDetailDaoImpl extends BaseCRUDDaoMybatis<DemoDetailEntity,Long> implements DemoDetailDao {
......
package com.mortals.xhx.module.demo.detail.model;
import java.util.List;
import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong;
/**
* 实体对象
* 测试详细实体对象
*
* @author zxfei
* @date 2021-10-03
* @date 2021-10-09
*/
public class DemoDetailEntity extends BaseEntityLong {
private static final long serialVersionUID = 1L;
/**
*
* 测试demo表id
*/
@Excel(name = "测试demo表id")
private String demoId;
/**
*
* 浮点值
*/
@Excel(name = "浮点值")
private Long number;
/**
*
* 详细
*/
@Excel(name = "详细")
private String detail;
public DemoDetailEntity(){}
/**
* 获取
* 获取 测试demo表id
* @return String
*/
public String getDemoId(){
return demoId;
}
/**
* 设置
* 设置 测试demo表id
* @param demoId
*/
public void setDemoId(String demoId){
this.demoId = demoId;
}
/**
* 获取
* 获取 浮点值
* @return Long
*/
public Long getNumber(){
return number;
}
/**
* 设置
* 设置 浮点值
* @param number
*/
public void setNumber(Long number){
this.number = number;
}
/**
* 获取
* 获取 详细
* @return String
*/
public String getDetail(){
return detail;
}
/**
* 设置
* 设置 详细
* @param detail
*/
public void setDetail(String detail){
......
package com.mortals.xhx.module.demo.detail.model;
import java.util.List;
/**
* 查询对象
* 测试详细查询对象
*
* @author zxfei
* @date 2021-10-03
* @date 2021-10-09
*/
public class DemoDetailQuery extends DemoDetailEntity {
/** 开始 */
/** 开始 主键id */
private Long idStart;
/** 结束 */
/** 结束 主键id */
private Long idEnd;
/** 增加 */
/** 增加 主键id */
private Long idIncrement;
/** 列表 */
private List<Long> idList;
/** 主键id列表 */
private List <Long> idList;
/** */
/** 测试demo表id */
private List<String> demoIdList;
/** 开始 */
/** 开始 浮点值 */
private Long numberStart;
/** 结束 */
/** 结束 浮点值 */
private Long numberEnd;
/** 增加 */
/** 增加 浮点值 */
private Long numberIncrement;
/** 列表 */
/** 浮点值列表 */
private List <Long> numberList;
/** */
/** 详细 */
private List<String> detailList;
/** OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4) */
......@@ -48,7 +47,7 @@ public class DemoDetailQuery extends DemoDetailEntity {
public DemoDetailQuery(){}
/**
* 获取 开始
* 获取 开始 主键id
* @return idStart
*/
public Long getIdStart(){
......@@ -56,7 +55,7 @@ public class DemoDetailQuery extends DemoDetailEntity {
}
/**
* 设置 开始
* 设置 开始 主键id
* @param idStart
*/
public void setIdStart(Long idStart){
......@@ -64,7 +63,7 @@ public class DemoDetailQuery extends DemoDetailEntity {
}
/**
* 获取 结束
* 获取 结束 主键id
* @return $idEnd
*/
public Long getIdEnd(){
......@@ -72,7 +71,7 @@ public class DemoDetailQuery extends DemoDetailEntity {
}
/**
* 设置 结束
* 设置 结束 主键id
* @param idEnd
*/
public void setIdEnd(Long idEnd){
......@@ -80,7 +79,7 @@ public class DemoDetailQuery extends DemoDetailEntity {
}
/**
* 获取 增加
* 获取 增加 主键id
* @return idIncrement
*/
public Long getIdIncrement(){
......@@ -88,7 +87,7 @@ public class DemoDetailQuery extends DemoDetailEntity {
}
/**
* 设置 增加
* 设置 增加 主键id
* @param idIncrement
*/
public void setIdIncrement(Long idIncrement){
......@@ -96,7 +95,7 @@ public class DemoDetailQuery extends DemoDetailEntity {
}
/**
* 获取
* 获取 主键id
* @return idList
*/
public List<Long> getIdList(){
......@@ -104,7 +103,7 @@ public class DemoDetailQuery extends DemoDetailEntity {
}
/**
* 设置
* 设置 主键id
* @param idList
*/
public void setIdList(List<Long> idList){
......@@ -112,7 +111,7 @@ public class DemoDetailQuery extends DemoDetailEntity {
}
/**
* 获取
* 获取 测试demo表id
* @return demoIdList
*/
public List<String> getDemoIdList(){
......@@ -120,14 +119,14 @@ public class DemoDetailQuery extends DemoDetailEntity {
}
/**
* 设置
* 设置 测试demo表id
* @param demoIdList
*/
public void setDemoIdList(List<String> demoIdList){
this.demoIdList = demoIdList;
}
/**
* 获取 开始
* 获取 开始 浮点值
* @return numberStart
*/
public Long getNumberStart(){
......@@ -135,7 +134,7 @@ public class DemoDetailQuery extends DemoDetailEntity {
}
/**
* 设置 开始
* 设置 开始 浮点值
* @param numberStart
*/
public void setNumberStart(Long numberStart){
......@@ -143,7 +142,7 @@ public class DemoDetailQuery extends DemoDetailEntity {
}
/**
* 获取 结束
* 获取 结束 浮点值
* @return $numberEnd
*/
public Long getNumberEnd(){
......@@ -151,7 +150,7 @@ public class DemoDetailQuery extends DemoDetailEntity {
}
/**
* 设置 结束
* 设置 结束 浮点值
* @param numberEnd
*/
public void setNumberEnd(Long numberEnd){
......@@ -159,7 +158,7 @@ public class DemoDetailQuery extends DemoDetailEntity {
}
/**
* 获取 增加
* 获取 增加 浮点值
* @return numberIncrement
*/
public Long getNumberIncrement(){
......@@ -167,7 +166,7 @@ public class DemoDetailQuery extends DemoDetailEntity {
}
/**
* 设置 增加
* 设置 增加 浮点值
* @param numberIncrement
*/
public void setNumberIncrement(Long numberIncrement){
......@@ -175,7 +174,7 @@ public class DemoDetailQuery extends DemoDetailEntity {
}
/**
* 获取
* 获取 浮点值
* @return numberList
*/
public List<Long> getNumberList(){
......@@ -183,7 +182,7 @@ public class DemoDetailQuery extends DemoDetailEntity {
}
/**
* 设置
* 设置 浮点值
* @param numberList
*/
public void setNumberList(List<Long> numberList){
......@@ -191,7 +190,7 @@ public class DemoDetailQuery extends DemoDetailEntity {
}
/**
* 获取
* 获取 详细
* @return detailList
*/
public List<String> getDetailList(){
......@@ -199,14 +198,14 @@ public class DemoDetailQuery extends DemoDetailEntity {
}
/**
* 设置
* 设置 详细
* @param detailList
*/
public void setDetailList(List<String> detailList){
this.detailList = detailList;
}
/**
* 设置
* 设置 主键id
* @param id
*/
public DemoDetailQuery id(Long id){
......@@ -215,7 +214,7 @@ public class DemoDetailQuery extends DemoDetailEntity {
}
/**
* 设置 开始
* 设置 开始 主键id
* @param idStart
*/
public DemoDetailQuery idStart(Long idStart){
......@@ -224,7 +223,7 @@ public class DemoDetailQuery extends DemoDetailEntity {
}
/**
* 设置 结束
* 设置 结束 主键id
* @param idEnd
*/
public DemoDetailQuery idEnd(Long idEnd){
......@@ -233,7 +232,7 @@ public class DemoDetailQuery extends DemoDetailEntity {
}
/**
* 设置 增加
* 设置 增加 主键id
* @param idIncrement
*/
public DemoDetailQuery idIncrement(Long idIncrement){
......@@ -242,7 +241,7 @@ public class DemoDetailQuery extends DemoDetailEntity {
}
/**
* 设置
* 设置 主键id
* @param idList
*/
public DemoDetailQuery idList(List<Long> idList){
......@@ -252,7 +251,7 @@ public class DemoDetailQuery extends DemoDetailEntity {
/**
* 设置
* 设置 测试demo表id
* @param demoId
*/
public DemoDetailQuery demoId(String demoId){
......@@ -261,7 +260,7 @@ public class DemoDetailQuery extends DemoDetailEntity {
}
/**
* 设置
* 设置 测试demo表id
* @param demoIdList
*/
public DemoDetailQuery demoIdList(List<String> demoIdList){
......@@ -270,7 +269,7 @@ public class DemoDetailQuery extends DemoDetailEntity {
}
/**
* 设置
* 设置 浮点值
* @param number
*/
public DemoDetailQuery number(Long number){
......@@ -279,7 +278,7 @@ public class DemoDetailQuery extends DemoDetailEntity {
}
/**
* 设置 开始
* 设置 开始 浮点值
* @param numberStart
*/
public DemoDetailQuery numberStart(Long numberStart){
......@@ -288,7 +287,7 @@ public class DemoDetailQuery extends DemoDetailEntity {
}
/**
* 设置 结束
* 设置 结束 浮点值
* @param numberEnd
*/
public DemoDetailQuery numberEnd(Long numberEnd){
......@@ -297,7 +296,7 @@ public class DemoDetailQuery extends DemoDetailEntity {
}
/**
* 设置 增加
* 设置 增加 浮点值
* @param numberIncrement
*/
public DemoDetailQuery numberIncrement(Long numberIncrement){
......@@ -306,7 +305,7 @@ public class DemoDetailQuery extends DemoDetailEntity {
}
/**
* 设置
* 设置 浮点值
* @param numberList
*/
public DemoDetailQuery numberList(List<Long> numberList){
......@@ -316,7 +315,7 @@ public class DemoDetailQuery extends DemoDetailEntity {
/**
* 设置
* 设置 详细
* @param detail
*/
public DemoDetailQuery detail(String detail){
......@@ -325,7 +324,7 @@ public class DemoDetailQuery extends DemoDetailEntity {
}
/**
* 设置
* 设置 详细
* @param detailList
*/
public DemoDetailQuery detailList(List<String> detailList){
......
......@@ -5,10 +5,10 @@ import com.mortals.xhx.module.demo.detail.model.DemoDetailEntity;
/**
* DemoDetailService
*
* service接口
* 测试详细 service接口
*
* @author zxfei
* @date 2021-10-03
* @date 2021-10-09
*/
public interface DemoDetailService extends ICRUDService<DemoDetailEntity,Long>{
......
......@@ -7,10 +7,10 @@ import com.mortals.xhx.module.demo.detail.service.DemoDetailService;
/**
* DemoDetailService
* service实现
* 测试详细 service实现
*
* @author zxfei
* @date 2021-10-03
* @date 2021-10-09
*/
@Service("demoDetailService")
public class DemoDetailServiceImpl extends AbstractCRUDServiceImpl<DemoDetailDao, DemoDetailEntity, Long> implements DemoDetailService {
......
package com.mortals.xhx.module.demo.detail.web;
import com.mortals.framework.common.AjaxResult;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.utils.poi.ExcelUtil;
import com.mortals.xhx.base.system.param.service.ParamService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.mortals.framework.model.Context;
......@@ -9,30 +15,33 @@ import com.mortals.framework.common.IBaseEnum;
import com.mortals.framework.common.code.YesNo;
import com.mortals.xhx.module.demo.detail.model.DemoDetailEntity;
import com.mortals.xhx.module.demo.detail.service.DemoDetailService;
import java.util.List;
import java.util.Map;
/**
* DemoDetailController
*
* 控制器
* 测试详细 控制器
*
* @author zxfei
* @date 2021-10-03
* @date 2021-10-09
*/
@RestController
@RequestMapping("demo/detail")
public class DemoDetailController extends BaseCRUDJsonMappingController<DemoDetailService,DemoDetailForm,DemoDetailEntity,Long> {
@Autowired
private ParamService paramService;
public DemoDetailController(){
super.setFormClass(DemoDetailForm.class);
super.setModuleDesc( "");
super.setModuleDesc( "测试详细");
}
@Override
protected void init(HttpServletRequest request, HttpServletResponse response, DemoDetailForm form, Map<String, Object> model, Context context) {
this.addDict(model, "status", IBaseEnum.getEnumMap(YesNo.class));
super.init(request, response, form, model, context);
}
}
\ No newline at end of file
......@@ -8,10 +8,10 @@ import com.mortals.xhx.module.demo.detail.model.DemoDetailQuery;
/**
* DemoDetail
*
* Form
* 测试详细 Form
*
* @author zxfei
* @date 2021-10-03
* @date 2021-10-09
*/
public class DemoDetailForm extends BaseCRUDFormLong<DemoDetailEntity> {
private DemoDetailEntity entity = new DemoDetailEntity();
......
package com.mortals.xhx.module.demo.model;
import java.util.List;
import java.util.List;
import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityStr;
import com.mortals.xhx.module.demo.detail.model.DemoDetailEntity;
/**
* 测试实体对象
* 测试demo实体对象
*
* @author zxfei
* @date 2021-10-03
* @date 2021-10-09
*/
public class DemoEntity extends BaseEntityStr {
private static final long serialVersionUID = 1L;
/**
*
* 主键id
*/
@Excel(name = "主键")
private String id;
/**
* 字段1
*/
@Excel(name = "字段1")
private String fieldOne;
/**
*
* 字段2
*/
@Excel(name = "字段2")
private Long fieldTwo;
/**
* 字段3
*/
@Excel(name = "字段3")
private Integer fieldThree;
/**
* 信息
* 测试详细信息
*/
private List<DemoDetailEntity> demoDetailList;
public DemoEntity(){}
@Override
public String getId() {
return id;
}
@Override
public void setId(String id) {
this.id = id;
}
/**
* 获取
* 获取 字段1
* @return String
*/
public String getFieldOne(){
return fieldOne;
}
/**
* 设置
* 设置 字段1
* @param fieldOne
*/
public void setFieldOne(String fieldOne){
this.fieldOne = fieldOne;
}
/**
* 获取
* 获取 字段2
* @return Long
*/
public Long getFieldTwo(){
return fieldTwo;
}
/**
* 设置
* 设置 字段2
* @param fieldTwo
*/
public void setFieldTwo(Long fieldTwo){
this.fieldTwo = fieldTwo;
}
/**
* 获取 字段3
* @return Integer
*/
public Integer getFieldThree(){
return fieldThree;
}
/**
* 设置 字段3
* @param fieldThree
*/
public void setFieldThree(Integer fieldThree){
this.fieldThree = fieldThree;
}
public List<DemoDetailEntity> getDemoDetailList(){
......@@ -86,11 +126,13 @@ public class DemoEntity extends BaseEntityStr {
StringBuilder sb = new StringBuilder("");
sb.append(",fieldOne:").append(getFieldOne());
sb.append(",fieldTwo:").append(getFieldTwo());
sb.append(",fieldThree:").append(getFieldThree());
return sb.toString();
}
public void initAttrValue(){
this.fieldOne = null;
this.fieldTwo = null;
this.fieldThree = null;
}
}
\ No newline at end of file
package com.mortals.xhx.module.demo.model;
import java.util.List;
import java.util.List;
/**
* 测试查询对象
* 测试demo查询对象
*
* @author zxfei
* @date 2021-10-03
* @date 2021-10-09
*/
public class DemoQuery extends DemoEntity {
/** */
/** 主键id */
private List<String> idList;
/** */
/** 字段1 */
private List<String> fieldOneList;
/** 开始 */
/** 开始 字段2 */
private Long fieldTwoStart;
/** 结束 */
/** 结束 字段2 */
private Long fieldTwoEnd;
/** 增加 */
/** 增加 字段2 */
private Long fieldTwoIncrement;
/** 列表 */
/** 字段2列表 */
private List <Long> fieldTwoList;
/** 开始 字段3 */
private Integer fieldThreeStart;
/** 结束 字段3 */
private Integer fieldThreeEnd;
/** 增加 字段3 */
private Integer fieldThreeIncrement;
/** 字段3列表 */
private List <Integer> fieldThreeList;
/** 开始 */
private String updateTimeStart;
......@@ -53,7 +66,7 @@ public class DemoQuery extends DemoEntity {
public DemoQuery(){}
/**
* 获取
* 获取 主键id
* @return idList
*/
public List<String> getIdList(){
......@@ -61,14 +74,14 @@ public class DemoQuery extends DemoEntity {
}
/**
* 设置
* 设置 主键id
* @param idList
*/
public void setIdList(List<String> idList){
this.idList = idList;
}
/**
* 获取
* 获取 字段1
* @return fieldOneList
*/
public List<String> getFieldOneList(){
......@@ -76,14 +89,14 @@ public class DemoQuery extends DemoEntity {
}
/**
* 设置
* 设置 字段1
* @param fieldOneList
*/
public void setFieldOneList(List<String> fieldOneList){
this.fieldOneList = fieldOneList;
}
/**
* 获取 开始
* 获取 开始 字段2
* @return fieldTwoStart
*/
public Long getFieldTwoStart(){
......@@ -91,7 +104,7 @@ public class DemoQuery extends DemoEntity {
}
/**
* 设置 开始
* 设置 开始 字段2
* @param fieldTwoStart
*/
public void setFieldTwoStart(Long fieldTwoStart){
......@@ -99,7 +112,7 @@ public class DemoQuery extends DemoEntity {
}
/**
* 获取 结束
* 获取 结束 字段2
* @return $fieldTwoEnd
*/
public Long getFieldTwoEnd(){
......@@ -107,7 +120,7 @@ public class DemoQuery extends DemoEntity {
}
/**
* 设置 结束
* 设置 结束 字段2
* @param fieldTwoEnd
*/
public void setFieldTwoEnd(Long fieldTwoEnd){
......@@ -115,7 +128,7 @@ public class DemoQuery extends DemoEntity {
}
/**
* 获取 增加
* 获取 增加 字段2
* @return fieldTwoIncrement
*/
public Long getFieldTwoIncrement(){
......@@ -123,7 +136,7 @@ public class DemoQuery extends DemoEntity {
}
/**
* 设置 增加
* 设置 增加 字段2
* @param fieldTwoIncrement
*/
public void setFieldTwoIncrement(Long fieldTwoIncrement){
......@@ -131,7 +144,7 @@ public class DemoQuery extends DemoEntity {
}
/**
* 获取
* 获取 字段2
* @return fieldTwoList
*/
public List<Long> getFieldTwoList(){
......@@ -139,13 +152,77 @@ public class DemoQuery extends DemoEntity {
}
/**
* 设置
* 设置 字段2
* @param fieldTwoList
*/
public void setFieldTwoList(List<Long> fieldTwoList){
this.fieldTwoList = fieldTwoList;
}
/**
* 获取 开始 字段3
* @return fieldThreeStart
*/
public Integer getFieldThreeStart(){
return this.fieldThreeStart;
}
/**
* 设置 开始 字段3
* @param fieldThreeStart
*/
public void setFieldThreeStart(Integer fieldThreeStart){
this.fieldThreeStart = fieldThreeStart;
}
/**
* 获取 结束 字段3
* @return $fieldThreeEnd
*/
public Integer getFieldThreeEnd(){
return this.fieldThreeEnd;
}
/**
* 设置 结束 字段3
* @param fieldThreeEnd
*/
public void setFieldThreeEnd(Integer fieldThreeEnd){
this.fieldThreeEnd = fieldThreeEnd;
}
/**
* 获取 增加 字段3
* @return fieldThreeIncrement
*/
public Integer getFieldThreeIncrement(){
return this.fieldThreeIncrement;
}
/**
* 设置 增加 字段3
* @param fieldThreeIncrement
*/
public void setFieldThreeIncrement(Integer fieldThreeIncrement){
this.fieldThreeIncrement = fieldThreeIncrement;
}
/**
* 获取 字段3
* @return fieldThreeList
*/
public List<Integer> getFieldThreeList(){
return this.fieldThreeList;
}
/**
* 设置 字段3
* @param fieldThreeList
*/
public void setFieldThreeList(List<Integer> fieldThreeList){
this.fieldThreeList = fieldThreeList;
}
/**
* 获取 开始
* @return updateTimeStart
......@@ -242,7 +319,7 @@ public class DemoQuery extends DemoEntity {
}
/**
* 设置
* 设置 主键id
* @param id
*/
public DemoQuery id(String id){
......@@ -251,7 +328,7 @@ public class DemoQuery extends DemoEntity {
}
/**
* 设置
* 设置 主键id
* @param idList
*/
public DemoQuery idList(List<String> idList){
......@@ -261,7 +338,7 @@ public class DemoQuery extends DemoEntity {
/**
* 设置
* 设置 字段1
* @param fieldOne
*/
public DemoQuery fieldOne(String fieldOne){
......@@ -270,7 +347,7 @@ public class DemoQuery extends DemoEntity {
}
/**
* 设置
* 设置 字段1
* @param fieldOneList
*/
public DemoQuery fieldOneList(List<String> fieldOneList){
......@@ -279,7 +356,7 @@ public class DemoQuery extends DemoEntity {
}
/**
* 设置
* 设置 字段2
* @param fieldTwo
*/
public DemoQuery fieldTwo(Long fieldTwo){
......@@ -288,7 +365,7 @@ public class DemoQuery extends DemoEntity {
}
/**
* 设置 开始
* 设置 开始 字段2
* @param fieldTwoStart
*/
public DemoQuery fieldTwoStart(Long fieldTwoStart){
......@@ -297,7 +374,7 @@ public class DemoQuery extends DemoEntity {
}
/**
* 设置 结束
* 设置 结束 字段2
* @param fieldTwoEnd
*/
public DemoQuery fieldTwoEnd(Long fieldTwoEnd){
......@@ -306,7 +383,7 @@ public class DemoQuery extends DemoEntity {
}
/**
* 设置 增加
* 设置 增加 字段2
* @param fieldTwoIncrement
*/
public DemoQuery fieldTwoIncrement(Long fieldTwoIncrement){
......@@ -315,7 +392,7 @@ public class DemoQuery extends DemoEntity {
}
/**
* 设置
* 设置 字段2
* @param fieldTwoList
*/
public DemoQuery fieldTwoList(List<Long> fieldTwoList){
......@@ -323,6 +400,51 @@ public class DemoQuery extends DemoEntity {
return this;
}
/**
* 设置 字段3
* @param fieldThree
*/
public DemoQuery fieldThree(Integer fieldThree){
setFieldThree(fieldThree);
return this;
}
/**
* 设置 开始 字段3
* @param fieldThreeStart
*/
public DemoQuery fieldThreeStart(Integer fieldThreeStart){
this.fieldThreeStart = fieldThreeStart;
return this;
}
/**
* 设置 结束 字段3
* @param fieldThreeEnd
*/
public DemoQuery fieldThreeEnd(Integer fieldThreeEnd){
this.fieldThreeEnd = fieldThreeEnd;
return this;
}
/**
* 设置 增加 字段3
* @param fieldThreeIncrement
*/
public DemoQuery fieldThreeIncrement(Integer fieldThreeIncrement){
this.fieldThreeIncrement = fieldThreeIncrement;
return this;
}
/**
* 设置 字段3
* @param fieldThreeList
*/
public DemoQuery fieldThreeList(List<Integer> fieldThreeList){
this.fieldThreeList = fieldThreeList;
return this;
}
/**
......
package com.mortals.xhx.module.demo.service;
import com.mortals.framework.model.Context;
import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.demo.model.DemoEntity;
import java.util.List;
/**
* DemoService
*
* 测试 service接口
* 测试demo service接口
*
* @author zxfei
* @date 2021-10-03
* @date 2021-10-09
*/
public interface DemoService extends ICRUDService<DemoEntity,String>{
......
package com.mortals.xhx.module.demo.service.impl;
import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.xhx.module.demo.dao.DemoDao;
import com.mortals.xhx.module.demo.model.DemoEntity;
import com.mortals.xhx.module.demo.service.DemoService;
import org.springframework.stereotype.Service;
/**
* DemoService
* 测试 service实现
*
* @author zxfei
* @date 2021-10-03
*/
* DemoService
* 测试demo service实现
*
* @author zxfei
* @date 2021-10-09
*/
@Service("demoService")
public class DemoServiceImpl extends AbstractCRUDServiceImpl<DemoDao, DemoEntity, String> implements DemoService {
......
package com.mortals.xhx.module.demo.web;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.common.AjaxResult;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.utils.poi.ExcelUtil;
import com.mortals.xhx.base.system.param.service.ParamService;
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.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.mortals.framework.model.Context;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.mortals.framework.web.BaseCRUDJsonMappingController;
import com.mortals.framework.common.IBaseEnum;
import com.mortals.framework.common.code.YesNo;
import com.mortals.xhx.module.demo.model.DemoEntity;
import com.mortals.xhx.module.demo.service.DemoService;
import org.springframework.web.multipart.MultipartFile;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* DemoController
*
* 测试 控制器
*
* @author zxfei
* @date 2021-10-03
*/
* DemoController
* <p>
* 测试demo 控制器
*
* @author zxfei
* @date 2021-10-09
*/
@RestController
@RequestMapping("demo")
public class DemoController extends BaseCRUDJsonMappingController<DemoService,DemoForm,DemoEntity,String> {
public class DemoController extends BaseCRUDJsonMappingController<DemoService, DemoForm, DemoEntity, String> {
public DemoController(){
@Autowired
private ParamService paramService;
public DemoController() {
super.setFormClass(DemoForm.class);
super.setModuleDesc( "测试");
super.setModuleDesc("测试demo");
}
@Override
protected void init(HttpServletRequest request, HttpServletResponse response, DemoForm form, Map<String, Object> model, Context context) {
this.addDict(model, "status", IBaseEnum.getEnumMap(YesNo.class));
//this.addDict(model, "fieldThree", paramService.getParamByFirstOrganize("fieldThree"));
super.init(request, response, form, model, context);
}
// @PostMapping("exportExcel")
// public void exportExcel(DemoForm form) {
// try {
// PageInfo pageInfo = new PageInfo(65535);
// List<DemoEntity> list = this.service.find(form.getQuery(), pageInfo, getContext()).getList();
// ExcelUtil<DemoEntity> util = new ExcelUtil<>(DemoEntity.class);
// byte[] data = util.exportExcel(list, "demo");
// this.responseStream(response, data, "demo.xlsx");
// } catch (Exception e) {
// this.doException(request, "导出异常", new HashMap<String, Object>(), e);
// }
// }
// @PostMapping("/downloadTemplate")
// public void downloadTemplate() {
// try {
// ExcelUtil<DemoEntity> util = new ExcelUtil<>(DemoEntity.class);
// byte[] data = util.importTemplateExcel("用户数据");
// this.responseStream(response, data, "demo_template.xlsx");
// } catch (Exception e) {
// this.doException(request, "导出模板异常", new HashMap<String, Object>(), e);
// }
// }
// @PostMapping("/importData")
// public String importData(MultipartFile file, boolean updateSupport) {
// JSONObject ret = new JSONObject();
// String busiDesc = "导入数据";
// int code = VALUE_RESULT_SUCCESS;
// try {
// ExcelUtil<DemoEntity> util = new ExcelUtil<>(DemoEntity.class);
// List<DemoEntity> demoList = util.importExcel(file.getInputStream());
// String message = this.service.importDemoList(demoList, updateSupport, getContext());
// ret.put(KEY_RESULT_MSG, message);
// recordSysLog(request, busiDesc + " 【成功】");
// } catch (Exception e) {
// code = VALUE_RESULT_FAILURE;
// }
// ret.put(KEY_RESULT_CODE, code);
// return ret.toJSONString();
// }
}
\ No newline at end of file
......@@ -8,10 +8,10 @@ import com.mortals.xhx.module.demo.model.DemoQuery;
/**
* Demo
*
* 测试 Form
* 测试demo Form
*
* @author zxfei
* @date 2021-10-03
* @date 2021-10-09
*/
public class DemoForm extends BaseCRUDFormStr<DemoEntity> {
private DemoEntity entity = new DemoEntity();
......
......@@ -30,6 +30,7 @@ package ${packageName}.model;
import ${import};
</#list>
import java.util.List;
import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.${Entity};
<#if table.tplCategory=="sub" >
import ${subPackageName}.model.${subClassName}Entity;
......@@ -49,6 +50,22 @@ public class ${ClassName}Entity extends ${Entity} {
/**
* ${column.columnComment}
*/
<#if column.isList==1>
<#assign parentheseIndex =column.columnComment?index_of("(")>
<#if parentheseIndex != -1>
<#assign comment =column.columnComment[0..parentheseIndex-1]>
<#else>
<#assign comment =column.columnComment>
</#if>
<#if parentheseIndex != -1>
@Excel(name = "${comment}", readConverterExp = "${column.readConverterExp()}")
<#elseif column.javaType == "Date">
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "${comment}", width = 30, dateFormat = "yyyy-MM-dd")
<#else>
@Excel(name = "${comment}")
</#if>
</#if>
private ${column.javaType} ${column.javaField};
</#if>
</#list>
......
-- ----------------------------
-- 菜单 SQL
-- ----------------------------
INSERT INTO `mortals_xhx_menu` VALUES (null, '${tableComment}', '/${RequestMapping}/list', -1, 1, 1, 0, 0, NULL, NULL, NULL, 0, 0, 3, NULL, NULL, NULL);
INSERT INTO `mortals_xhx_menu` VALUES (null, '${tableComment}', '/${RequestMapping}/list', 0, 1, 1, 0, 0,'',NULL, NULL, NULL, 0, 0, 3, NULL, NULL, NULL);
-- ----------------------------
-- 资源路径 SQL
......
......@@ -3,7 +3,7 @@
"mybatis-3-mapper.dtd">
<mapper namespace="${packageName}.dao.ibatis.${ClassName}DaoImpl">
<#if table.tplCategory=="sub" >
<#assign SubArray><collection property="${subclassName}List" column="${subTableFkName}" ofType="${subClassName}Entity-Map" javaType="ArrayList" select="get${subClassName}By${subTableFkClassName}">< /collection></#assign>
<#assign SubArray><collection property="${subclassName}List" column="${pkColumn.columnName}" ofType="${subClassName}Entity" javaType="ArrayList" select="get${subClassName}By${subTableFkClassName}"></collection></#assign>
<#else>
<#assign SubArray></#assign>
</#if>
......@@ -87,11 +87,7 @@
<!-- 子表所有列 -->
<sql id="_columns_sub">
<trim suffixOverrides="," suffix="">
<#list subColumns as column>
<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('${column.javaField}') or colPickMode == 1 and data.containsKey('${column.javaField}')))">
a.${column.columnName} as ${column.javaField},
</if>
</#list>
<#list subColumns as column>b.${column.columnName} as ${column.javaField},</#list>
</trim>
</sql>
</#if>
......@@ -228,9 +224,9 @@
</#if>
<select id="get${subClassName}By${subTableFkClassName}" parameterType="${ParameterType}" resultMap="${subClassName}Entity-Map">
select <include refid="_columns_sub"/>
from ${TempSubTable} as a
from ${TempSubTable} as b
<trim suffixOverrides="where" suffix="">
where a.${subTableFkName} = <#noparse>#</#noparse>{${subTableFkName}}
where b.${subTableFkName} = <#noparse>#</#noparse>{${pkColumn.subTableFkName}}
</trim>
</select>
</#if>
......
......@@ -6,7 +6,11 @@ package ${packageName}.web;
<#else>
<#assign Controller = "BaseCRUDJsonMappingController">
</#if>
import com.mortals.framework.utils.poi.ExcelUtil;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.framework.common.AjaxResult;
import com.mortals.framework.model.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.mortals.framework.model.Context;
......@@ -18,7 +22,7 @@ import com.mortals.framework.common.code.YesNo;
import ${packageName}.model.${ClassName}Entity;
import ${packageName}.service.${ClassName}Service;
import java.util.Map;
import java.util.List;
/**
* ${ClassName}Controller
*
......@@ -43,11 +47,10 @@ public class ${ClassName}Controller extends ${Controller}<${ClassName}Service,${
protected void init(HttpServletRequest request, HttpServletResponse response, ${ClassName}Form form, Map<String, Object> model, Context context) {
<#list columns as column>
<#if column.columnType?contains("tinyint") ||column.htmlType==3||column.htmlType==5>
this.addDict(model, "${column.javaField}", paramService.getParamByFirstOrganize("${column.javaField}");
this.addDict(model, "${column.javaField}", paramService.getParamByFirstOrganize("${column.javaField}"));
</#if>
</#list>
super.init(request, response, form, model, context);
}
}
\ No newline at end of file
<template>
<div class="page">
<LayoutTable :data='tableData' :config='tableConfig' />
<LayoutTable :data="tableData" :config="tableConfig">
<el-button
slot="table-head-left2"
style="margin-left: 10px"
icon="el-icon-tickets"
size="mini"
@click="handleImport"
>导入</el-button>
<el-button
slot="table-head-left2"
style="margin-left: 10px"
icon="el-icon-tickets"
size="mini"
@click="doExport"
:disabled="isExport"
>导出</el-button>
</LayoutTable>
<!-- ${functionName}导入对话框 -->
<el-dialog
:title="upload.title"
:visible.sync="upload.open"
width="400px"
append-to-body
>
<el-upload
ref="upload"
:limit="1"
accept=".xlsx, .xls"
:headers="upload.headers"
:action="upload.url + '?updateSupport=' + upload.updateSupport"
:disabled="upload.isUploading"
:on-progress="handleFileUploadProgress"
:on-success="handleFileSuccess"
:auto-upload="false"
drag
>
<i class="el-icon-upload"></i>
<div class="el-upload__text">
将文件拖到此处,或
<em>点击上传</em>
</div>
<div class="el-upload__tip" slot="tip">
<el-checkbox
v-model="upload.updateSupport"
/>是否更新已经存在的数据
<el-link type="primary" style="font-size: 14px" @click="downloadTemplate"
>下载模板</el-link
>
</div>
<div class="el-upload__tip" style="color: red" slot="tip">
提示:仅允许导入“xls”或“xlsx”格式文件!
</div>
</el-upload>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitFileForm">确 定</el-button>
<el-button @click="upload.open = false">取 消</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import table from "@/assets/mixins/table";
export default {
components: {
},
......@@ -14,9 +70,92 @@
created() {
},
methods: {
/** 导入 */
handleImport() {
this.upload.title = "${functionName}导入";
this.upload.open = true;
},
/** 下载模板操作 */
downloadTemplate() {
this.isExport = true;
this.$download("${RequestMapping}/downloadTemplate", {}, { type: "excel" })
.then(() => (this.isExport = false))
.catch((error) => {
this.isExport = false;
this.$message.error(error.message);
});
},
/** 文件上传中处理 */
handleFileUploadProgress(event, file, fileList) {
this.upload.isUploading = true;
},
/** 文件上传成功处理 */
handleFileSuccess(response, file, fileList) {
this.upload.open = false;
this.upload.isUploading = false;
this.$refs.upload.clearFiles();
this.$alert(response.msg, "导入结果", { dangerouslyUseHTMLString: true });
this.getData();
},
/** 提交上传文件 */
submitFileForm() {
this.$refs.upload.submit();
},
doExport() {
this.isExport = true;
this.$download("${RequestMapping}/exportExcel", {
<#list columns as column>
<#if column.isQuery == 1 >
'query.${column.javaField}': this.$route.query['query.${column.javaField}']<#sep>,
</#if>
</#list>
}, {}).then(() => this.isExport = false).catch(error => {
this.isExport = false;
this.$message.error(error.message);
});
},
<#if table.tplCategory=="sub">
renderTable(tableData) {
return (
<el-table stripe data={tableData} class="total-table">
{this.columnSet.map((item) => this.renderTableColumn(item))}
</el-table>
);
},
renderTableColumn(options) {
return (
<el-table-column
prop={options.prop}
label={options.label}
>
</el-table-column>
);
},
</#if>
},
data() {
return {
// 用户导入参数
upload: {
// 是否显示弹出层(${functionName}导入)
open: false,
// 弹出层标题(${functionName}导入)
title: "导入${functionName}数据",
// 是否禁用上传
isUploading: false,
// 是否更新已经存在的数据
updateSupport: 0,
// 上传的地址
url: "/m/${RequestMapping}/importData",
},
isExport: false,
<#if table.tplCategory=="sub">
columnSet:[
<#list subColumns as column>
{prop:"${column.javaField}",label:"${column.columnComment}"}<#sep>,
</#list>
],
</#if>
config: {
search: [
<#list columns as column>
......@@ -68,7 +207,19 @@
</#if>
</#list>
<#if table.tplCategory=="sub">
{label: "${column.columnComment}", prop: "subColumns"},
{label: "${subFunctionName}",
width: 120,
prop: "subColumns",
formatter: (row) => {
let widthsize=this.columnSet.length*150
return (
<el-popover placement="right" width={widthsize} trigger="click">
{this.renderTable(row.${subclassName}List)}
<el-button type="text" slot="reference">详细</el-button>
</el-popover>
);
},
},
</#if>
{
label: "操作",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment