| | |
| | | import org.yeshi.utils.mybatis.BaseMapper; |
| | | |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.lang.annotation.Annotation; |
| | | |
| | | /** |
| | |
| | | if (!f.exists()) { |
| | | f.mkdirs(); |
| | | } |
| | | return new File(f.getAbsolutePath(), packageName.replace(".", "/")).getAbsolutePath(); |
| | | f = new File(f.getAbsolutePath(), packageName.replace(".", "/")); |
| | | if (!f.exists()) { |
| | | f.mkdirs(); |
| | | } |
| | | return f.getAbsolutePath(); |
| | | } |
| | | |
| | | /** |
| | | * @return void |
| | | * @author hxh |
| | | * @description 保存文件 |
| | | * @date 10:06 2021/10/14 |
| | | * @param: data |
| | | * @param: path |
| | | **/ |
| | | private void saveFile(String data, String path) throws IOException { |
| | | if (!new File(path).exists()) |
| | | new File(path).createNewFile(); |
| | | FileUtil.saveAsFileByte(data.getBytes("UTF-8"), path); |
| | | } |
| | | |
| | | public void createException(String packageName, Class base) { |
| | |
| | | ExceptionVO vo = new ExceptionVO.Builder().setEntity(entity).setPackageName(packageName).setBase(new ClassInfo(base.getSimpleName(), base.getName())).build(); |
| | | String result = GeneraterUtil.createException(vo); |
| | | //保存 |
| | | FileUtil.saveAsFileByte(result.getBytes("UTF-8"), path); |
| | | saveFile(result, path); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | .setEntity(entity).build(); |
| | | String result = GeneraterUtil.createMongoDBDao(vo); |
| | | //保存 |
| | | FileUtil.saveAsFileByte(result.getBytes("UTF-8"), new File(path, daoName).getAbsolutePath()); |
| | | saveFile(result, new File(path, daoName + ".java").getAbsolutePath()); |
| | | return vo; |
| | | } |
| | | |
| | |
| | | .build(); |
| | | String result = GeneraterUtil.createMybatisDBMapper(vo); |
| | | //保存 |
| | | FileUtil.saveAsFileByte(result.getBytes("UTF-8"), new File(path, mapperName + ".java").getAbsolutePath()); |
| | | saveFile(result, new File(path, mapperName + ".java").getAbsolutePath()); |
| | | if (!new File(mapperDir).exists()) |
| | | new File(mapperDir).mkdirs(); |
| | | result = GeneraterUtil.createMybatisDBMapperXML(vo); |
| | | FileUtil.saveAsFileByte(result.getBytes("UTF-8"), new File(mapperDir, mapperName + ".xml").getAbsolutePath()); |
| | | saveFile(result, new File(mapperDir, mapperName + ".xml").getAbsolutePath()); |
| | | return vo; |
| | | } |
| | | |
| | |
| | | String path = getDirPath(packageName); |
| | | QueryVO queryVO = new QueryVO.Builder().setEntity(entity).setPackageName(packageName).build(); |
| | | String result = GeneraterUtil.createQuery(queryVO); |
| | | FileUtil.saveAsFileByte(result.getBytes("UTF-8"), new File(path, queryVO.getClassName() + ".java").getAbsolutePath()); |
| | | saveFile(result, new File(path, queryVO.getClassName() + ".java").getAbsolutePath()); |
| | | return queryVO; |
| | | } |
| | | |
| | |
| | | .setService(new ClassInfo(serviceName, interPackageName + "." + serviceName)) |
| | | .build(); |
| | | String result = GeneraterUtil.createService(vo); |
| | | FileUtil.saveAsFileByte(result.getBytes("UTF-8"), new File(path, serviceName + ".java").getAbsolutePath()); |
| | | saveFile(result, new File(path, serviceName + ".java").getAbsolutePath()); |
| | | |
| | | //创建service实现 |
| | | String serviceImplName = entity.getSimpleName() + "ServiceImpl"; |
| | |
| | | .setDaoQuery(new ClassInfo("DaoQuery", dao.getClazz() + ".DaoQuery")) |
| | | .build(); |
| | | result = GeneraterUtil.createServiceImpl(implVO); |
| | | FileUtil.saveAsFileByte(result.getBytes("UTF-8"), new File(path, serviceImplName + ".java").getAbsolutePath()); |
| | | saveFile(result, new File(path, serviceImplName + ".java").getAbsolutePath()); |
| | | return vo; |
| | | } |
| | | |
| | |
| | | public void createAdmin(String controllerPackage, String htmlDir, ClassInfo query, ClassInfo service) throws Exception { |
| | | String path = getDirPath(controllerPackage); |
| | | |
| | | String controllerName = entity.getSimpleName() + "AdminController"; |
| | | |
| | | AdminGeneraterInfo generaterInfo = new AdminGeneraterInfo.Builder().setEntityClass(entity).build(); |
| | | |
| | | |
| | | String htmlNamePrefix = getHtmlNameFromEntityName(entity.getSimpleName()); |
| | | AdminControllerInfoVO vo = new AdminControllerInfoVO.Builder().setAdminInfo(generaterInfo).setPackageName(controllerName).setQueryVO(query).setService(service).build(); |
| | | AdminControllerInfoVO vo = new AdminControllerInfoVO.Builder().setAdminInfo(generaterInfo).setPackageName(controllerPackage).setQueryVO(query).setService(service).build(); |
| | | String controllerName = vo.getControllerName(); |
| | | //生成controller |
| | | String result = GeneraterUtil.createAdminController(vo); |
| | | FileUtil.saveAsFileByte(result.getBytes("UTF-8"), new File(path, controllerName + ".java").getAbsolutePath()); |
| | | saveFile(result, new File(path, controllerName + ".java").getAbsolutePath()); |
| | | |
| | | |
| | | result = GeneraterUtil.createAdminPageForList(generaterInfo); |
| | | FileUtil.saveAsFileByte(result.getBytes("UTF-8"), new File(htmlDir, htmlNamePrefix + "_list.html").getAbsolutePath()); |
| | | saveFile(result, new File(htmlDir, htmlNamePrefix + "_list.html").getAbsolutePath()); |
| | | |
| | | if (generaterInfo.getAddFormRows() != null && generaterInfo.getAddFormRows().size() > 0) { |
| | | result = GeneraterUtil.createAdminPageForAdd(generaterInfo); |
| | | FileUtil.saveAsFileByte(result.getBytes("UTF-8"), new File(htmlDir, htmlNamePrefix + "_add.html").getAbsolutePath()); |
| | | saveFile(result, new File(htmlDir, htmlNamePrefix + "_add.html").getAbsolutePath()); |
| | | } |
| | | |
| | | if (generaterInfo.getUpdateFormRows() != null && generaterInfo.getUpdateFormRows().size() > 0) { |
| | | result = GeneraterUtil.createAdminPageForUpdate(generaterInfo); |
| | | FileUtil.saveAsFileByte(result.getBytes("UTF-8"), new File(htmlDir, htmlNamePrefix + "_update.html").getAbsolutePath()); |
| | | saveFile(result, new File(htmlDir, htmlNamePrefix + "_update.html").getAbsolutePath()); |
| | | } |
| | | } |
| | | |
| | |
| | | serviceClass = serviceInfoVO.getService(); |
| | | } |
| | | |
| | | if (queryClass != null && serviceClass != null) { |
| | | if (adminParams != null) |
| | | //创建Admin模块 |
| | | createAdmin(adminParams.getControllerPackage(), adminParams.getHtmlDir(), queryClass, serviceClass); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @return java.lang.String |
| | |
| | | //主键类型 |
| | | private String identifyIdType; |
| | | |
| | | //名称 |
| | | private String controllerName; |
| | | |
| | | |
| | | public static class Builder { |
| | | private AdminGeneraterInfo generaterInfo; |
| | |
| | | vo.setQueryVO(query); |
| | | vo.setService(service); |
| | | vo.setIdentifyIdType(EntityUtil.getIdentifyId(generaterInfo.getEntity()).getType().getSimpleName()); |
| | | vo.setControllerName(vo.getEntity().getName()+"AdminController"); |
| | | return vo; |
| | | } |
| | | |
| | |
| | | public void setIdentifyIdType(String identifyIdType) { |
| | | this.identifyIdType = identifyIdType; |
| | | } |
| | | |
| | | public String getControllerName() { |
| | | return controllerName; |
| | | } |
| | | |
| | | public void setControllerName(String controllerName) { |
| | | this.controllerName = controllerName; |
| | | } |
| | | } |
| | |
| | | package org.yeshi.utils.generater.vo.service; |
| | | |
| | | import org.springframework.stereotype.Service; |
| | | import org.yeshi.utils.FreemarkerUtils; |
| | | import org.yeshi.utils.StringUtil; |
| | | import org.yeshi.utils.bean.BeanUtil; |
| | | import org.yeshi.utils.generater.entity.BaseData; |
| | | import org.yeshi.utils.generater.entity.ClassInfo; |
| | | import org.yeshi.utils.generater.util.EntityUtil; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.lang.reflect.Field; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | public class ServiceImplInfoVO extends BaseData { |
| | | |
| | | private List<String> importList; |
| | | private ClassInfo service; |
| | | private ClassInfo dao; |
| | | //方法列表 |
| | |
| | | private ClassInfo service; |
| | | private ClassInfo query; |
| | | private ClassInfo daoQuery; |
| | | private ClassInfo exception; |
| | | |
| | | public Builder setException(ClassInfo exception) { |
| | | this.exception = exception; |
| | | return this; |
| | | } |
| | | |
| | | public Builder setEntity(Class entity) { |
| | | this.entity = entity; |
| | |
| | | serviceData.setPackageName(packageName); |
| | | serviceData.setDaoQuery(daoQuery); |
| | | serviceData.setQuery(query); |
| | | |
| | | List<String> importList = new ArrayList<>(); |
| | | //设置接口 |
| | | List<ServiceMetodInfoVO> metodInfoVOList = new ArrayList<>(); |
| | | /*******添加方法开始*******/ |
| | |
| | | params = new ArrayList<>(); |
| | | params.add(serviceData.getEntity().getName() + " " + StringUtil.firstCharToLower(serviceData.getEntity().getName())); |
| | | metodInfo = new ServiceMetodInfoVO("public", "void", "add", StringUtil.concat(params, ",")); |
| | | if (exception != null) { |
| | | metodInfo.setExceptions(exception.getName()); |
| | | importList.add(exception.getClazz()); |
| | | } else { |
| | | metodInfo.setExceptions("Exception"); |
| | | importList.add(Exception.class.getName()); |
| | | } |
| | | metodInfo.setContent(FreemarkerUtils.generateInputStream(serviceData, getClass().getClassLoader().getResourceAsStream(getMethodContentTemplatePath("add")))); |
| | | metodInfoVOList.add(metodInfo); |
| | | //update方法 |
| | |
| | | metodInfoVOList.add(metodInfo); |
| | | |
| | | /*******添加方法结束*******/ |
| | | |
| | | |
| | | importList.add(Resource.class.getName()); |
| | | importList.add(Service.class.getName()); |
| | | importList.add(Date.class.getName()); |
| | | importList.add(BeanUtil.class.getName()); |
| | | importList.add(List.class.getName()); |
| | | importList.add(serviceData.getDao().getClazz()); |
| | | importList.add(entity.getName()); |
| | | importList.add(service.getClazz()); |
| | | importList.add(query.getClazz()); |
| | | importList.add(daoQuery.getClazz()); |
| | | |
| | | serviceData.setImportList(importList); |
| | | serviceData.setMetodInfoList(metodInfoVOList); |
| | | return serviceData; |
| | | } |
| | |
| | | public void setQuery(ClassInfo query) { |
| | | this.query = query; |
| | | } |
| | | |
| | | public List<String> getImportList() { |
| | | return importList; |
| | | } |
| | | |
| | | public void setImportList(List<String> importList) { |
| | | this.importList = importList; |
| | | } |
| | | } |
| | | |
| | |
| | | package org.yeshi.utils.generater.vo.service; |
| | | |
| | | import org.springframework.stereotype.Service; |
| | | import org.yeshi.utils.StringUtil; |
| | | import org.yeshi.utils.bean.BeanUtil; |
| | | import org.yeshi.utils.generater.entity.BaseData; |
| | | import org.yeshi.utils.generater.entity.ClassInfo; |
| | | import org.yeshi.utils.generater.util.EntityUtil; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.lang.reflect.Field; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | public class ServiceInfoVO extends BaseData { |
| | | private List<String> importList; |
| | | private ClassInfo service; |
| | | //方法列表 |
| | | private List<ServiceMetodInfoVO> metodInfoList; |
| | |
| | | private String packageName; |
| | | private ClassInfo service; |
| | | private ClassInfo query; |
| | | private ClassInfo exception; |
| | | |
| | | |
| | | public Builder setEntity(Class entity) { |
| | |
| | | return this; |
| | | } |
| | | |
| | | public Builder setException(ClassInfo exception) { |
| | | this.exception = exception; |
| | | return this; |
| | | } |
| | | |
| | | private String getRemarksLine(String content) { |
| | | return "\t * " + content + "\n"; |
| | |
| | | serviceData.setQuery(query); |
| | | //设置接口 |
| | | List<ServiceMetodInfoVO> metodInfoVOList = new ArrayList<>(); |
| | | List<String> importList = new ArrayList<>(); |
| | | /*******添加方法开始*******/ |
| | | List<String> params = null; |
| | | ServiceMetodInfoVO metodInfo = null; |
| | |
| | | params.add(identifyId.getType().getSimpleName() + " id"); |
| | | metodInfo = new ServiceMetodInfoVO("public", serviceData.getEntity().getName(), "get", StringUtil.concat(params, ",")); |
| | | metodInfo.setNote(getMethodRemarks("get")); |
| | | |
| | | metodInfoVOList.add(metodInfo); |
| | | //add方法 |
| | | params = new ArrayList<>(); |
| | | params.add(serviceData.getEntity().getName() + " " + StringUtil.firstCharToLower(serviceData.getEntity().getName())); |
| | | metodInfo = new ServiceMetodInfoVO("public", "void", "add", StringUtil.concat(params, ",")); |
| | | metodInfo.setNote(getMethodRemarks("add")); |
| | | if (exception != null) { |
| | | metodInfo.setExceptions(exception.getName()); |
| | | importList.add(exception.getClazz()); |
| | | } else { |
| | | metodInfo.setExceptions("Exception"); |
| | | importList.add(Exception.class.getName()); |
| | | } |
| | | metodInfoVOList.add(metodInfo); |
| | | //update方法 |
| | | params = new ArrayList<>(); |
| | |
| | | |
| | | /*******添加方法结束*******/ |
| | | serviceData.setMetodInfoList(metodInfoVOList); |
| | | |
| | | |
| | | importList.add(Resource.class.getName()); |
| | | importList.add(Date.class.getName()); |
| | | importList.add(BeanUtil.class.getName()); |
| | | importList.add(List.class.getName()); |
| | | importList.add(entity.getName()); |
| | | importList.add(service.getClazz()); |
| | | importList.add(query.getClazz()); |
| | | |
| | | serviceData.setImportList(importList); |
| | | |
| | | return serviceData; |
| | | } |
| | |
| | | public void setQuery(ClassInfo query) { |
| | | this.query = query; |
| | | } |
| | | |
| | | public List<String> getImportList() { |
| | | return importList; |
| | | } |
| | | |
| | | public void setImportList(List<String> importList) { |
| | | this.importList = importList; |
| | | } |
| | | } |
| | |
| | | //方法内容 |
| | | private String content; |
| | | |
| | | private String exceptions; |
| | | |
| | | public ServiceMetodInfoVO(String visiteAccess, String returnType, String name, String params) { |
| | | this.visiteAccess = visiteAccess; |
| | | this.returnType = returnType; |
| | |
| | | public void setContent(String content) { |
| | | this.content = content; |
| | | } |
| | | |
| | | public String getExceptions() { |
| | | return exceptions; |
| | | } |
| | | |
| | | public void setExceptions(String exceptions) { |
| | | this.exceptions = exceptions; |
| | | } |
| | | } |
| | |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.yeshi.utils.JsonUtil; |
| | | import org.yeshi.utils.TimeUtil; |
| | | import com.google.gson.reflect.TypeToken; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpSession; |
| | |
| | | |
| | | @Controller |
| | | @RequestMapping("${mapping}") |
| | | public class AdminAppController { |
| | | public class ${controllerName} { |
| | | |
| | | <#assign serviceObjName="${service.name?uncap_first}"> |
| | | <#assign entityObjName="${entity.name?uncap_first}"> |
| | |
| | | @ResponseBody |
| | | @RequestMapping("delete") |
| | | public String delete(String ids, String callback) { |
| | | Type type = new TypeToken<List<${identifyIdType}>>(){}.get(); |
| | | List<${identifyIdType}> idList=new Gson().from(ids,type); |
| | | Type type = new TypeToken<List<${identifyIdType}>>(){}.getType(); |
| | | List<${identifyIdType}> idList=new Gson().fromJson(ids,type); |
| | | ${serviceObjName}.delete(idList); |
| | | return loadPrint(callback, JsonUtil.loadTrueResult("")); |
| | | } |
| | |
| | | ${serviceObjName}.add(bean); |
| | | return loadPrint(callback, JsonUtil.loadTrueResult("")); |
| | | }catch(Exception e){ |
| | | return loadPrint(callback, JsonUtil.loadFalseResult(e.getMessage)); |
| | | return loadPrint(callback, JsonUtil.loadFalseResult(e.getMessage())); |
| | | } |
| | | } |
| | | |
| | |
| | | return loadPrint(callback, JsonUtil.loadFalseResult("ID不能为空")); |
| | | } |
| | | try{ |
| | | ${serviceObjName}.updateSelective(bean); |
| | | ${serviceObjName}.update(bean); |
| | | }catch(Exception e){ |
| | | return loadPrint(callback,JsonUtil.loadFalseResult(e.getMessage)); |
| | | return loadPrint(callback,JsonUtil.loadFalseResult(e.getMessage())); |
| | | } |
| | | return loadPrint(callback,JsonUtil.loadTrueResult("")); |
| | | } |
| | |
| | | <div class="layui-card"> |
| | | <div class="layui-card-body"> |
| | | <form class="layui-form layui-col-space5"> |
| | | <#list rowsList as value> |
| | | <#list searchFormRows as value> |
| | | <div class="layui-inline layui-show-xs-block"> |
| | | <#switch value.type> |
| | | <#case "CheckBox"><#include "/admin/form/checkBox.ftl" ><#break> |
| | |
| | | form = layui.form, |
| | | table = layui.table; |
| | | //渲染日期输入框 |
| | | <#list searchForm as row > |
| | | <#if row.type??&&row.type=="Text"&&(row.params.type=="date")> |
| | | <#list searchFormRows as row > |
| | | <#if (row.type=="Text" && row.params.inputType=="DATE")> |
| | | laydate.render({ |
| | | elem: "intput[name=${row.key}]" //指定元素 |
| | | }); |
| | |
| | | layer.msg('已删除!', {icon: 1, time: 1000}); |
| | | }); |
| | | }, |
| | | <#if deleteApi??> |
| | | deleteList: function (ids, success) { |
| | | ksapp.post("${deleteApi}", {ids: JSON.stringify(ids)}, function (e) { |
| | | if (e.code == 0) { |
| | |
| | | }, function (e) { |
| | | }); |
| | | }, |
| | | </#if> |
| | | search: function (params) { |
| | | //数据重载 |
| | | tableIns.reload({ |
| | |
| | | package ${packageName}; |
| | | |
| | | import org.springframework.stereotype.Repository; |
| | | import java.util.List; |
| | | |
| | | import java.util.Date; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import ${baseMapper.clazz}; |
| | | import ${entity.clazz}; |
| | | |
| | | @Repository |
| | | public interface ${mapper.name} extends ${baseMapper.name}<${entity.name}> { |
| | | |
| | | ${entity.name} selectByPrimaryKeyForUpdate(@Param("id") ${identify.type} id); |
| | |
| | | <#assign entityObjName="${entity.name?uncap_first}" > |
| | | //查询主键ID是否存在 |
| | | if(${daoObjName}.get(${entityObjName}.getId())!=null){ |
| | | throw Exception("已存在"); |
| | | throw new Exception("已存在"); |
| | | } |
| | | |
| | | if(${entityObjName}.getCreateTime()==null){ |
| | | ${entityObjName}.setCreateTime(new Date()); |
| | | } |
| | | //保存 |
| | | ${daoObjName}.save(bean); |
| | | ${daoObjName}.save(${entityObjName}); |
| | |
| | | <#assign daoObjName="${dao.name?uncap_first}" > |
| | | <#assign queryObjName="${query.name?uncap_first}" > |
| | | ${daoQuery.name} daoQuery = new ${daoQuery.name}(); |
| | | try { |
| | | BeanUtil.copyProperties(${queryObjName}, daoQuery); |
| | | ${daoObjName}.count(daoQuery); |
| | | } catch (IllegalAccessException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return ${daoObjName}.count(daoQuery); |
| | |
| | | <#assign daoObjName="${dao.name?uncap_first}" > |
| | | <#assign queryObjName="${query.name?uncap_first}" > |
| | | ${daoQuery.name} daoQuery = new ${daoQuery.name}(); |
| | | try { |
| | | BeanUtil.copyProperties(${queryObjName}, daoQuery); |
| | | } catch (IllegalAccessException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | daoQuery.start=(page-1)*pageSize; |
| | | daoQuery.count=pageSize; |
| | | ${daoObjName}.list(daoQuery); |
| | | return ${daoObjName}.list(daoQuery); |
| | |
| | | <#assign daoObjName="${dao.name?uncap_first}" > |
| | | <#assign entityObjName="${entity.name?uncap_first}" > |
| | | if(bean.getCreateTime()==null){ |
| | | bean.setCreateTime(new Date()); |
| | | if(${entityObjName}.getCreateTime()==null){ |
| | | ${entityObjName}.setCreateTime(new Date()); |
| | | } |
| | | //保存 |
| | | ${daoObjName}.insertSelective(bean); |
| | | ${daoObjName}.insertSelective(${entityObjName}); |
| | |
| | | <#assign daoObjName="${dao.name?uncap_first}" > |
| | | <#assign queryObjName="${query.name?uncap_first}" > |
| | | ${daoQuery.name} daoQuery = new ${daoQuery.name}(); |
| | | try { |
| | | BeanUtil.copyProperties(${queryObjName}, daoQuery); |
| | | ${daoObjName}.count(daoQuery); |
| | | } catch (IllegalAccessException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return ${daoObjName}.count(daoQuery); |
| | |
| | | <#assign daoObjName="${dao.name?uncap_first}" > |
| | | <#assign queryObjName="${query.name?uncap_first}" > |
| | | ${daoQuery.name} daoQuery = new ${daoQuery.name}(); |
| | | try { |
| | | BeanUtil.copyProperties(${queryObjName}, daoQuery); |
| | | } catch (IllegalAccessException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | daoQuery.start=(page-1)*pageSize; |
| | | daoQuery.count=pageSize; |
| | | ${daoObjName}.list(daoQuery); |
| | | return ${daoObjName}.list(daoQuery); |
| | |
| | | package ${packageName}; |
| | | |
| | | import ${service.clazz}; |
| | | import ${query.clazz}; |
| | | import ${entity.clazz}; |
| | | <#list importList as import> |
| | | import ${import}; |
| | | </#list> |
| | | |
| | | |
| | | public interface ${service.name} { |
| | | |
| | | <#list metodInfoList as method> |
| | | ${method.note} |
| | | ${method.visiteAccess} ${method.returnType} ${method.name}(${method.params}); |
| | | ${method.visiteAccess} ${method.returnType} ${method.name}(${method.params}) <#if method.exceptions??> throws ${method.exceptions}</#if>; |
| | | |
| | | </#list> |
| | | |
| | |
| | | package ${packageName}; |
| | | |
| | | import ${entity.clazz}; |
| | | import ${dao.clazz}; |
| | | import ${service.clazz}; |
| | | import ${query.clazz}; |
| | | import ${daoQuery.clazz}; |
| | | import javax.annotation.Resource; |
| | | import org.springframework.stereotype.Service; |
| | | import java.util.Date; |
| | | import org.yeshi.utils.bean.BeanUtil; |
| | | <#list importList as import> |
| | | import ${import}; |
| | | </#list> |
| | | |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | |
| | | @Service |
| | | public class ${service.name}Impl implements ${service.name}{ |
| | |
| | | private ${dao.name} ${dao.name?uncap_first}; |
| | | |
| | | <#list metodInfoList as method> |
| | | ${method.visiteAccess} ${method.returnType} ${method.name}(${method.params}){ |
| | | ${method.visiteAccess} ${method.returnType} ${method.name}(${method.params}) <#if method.exceptions??> throws ${method.exceptions}</#if> { |
| | | ${method.content} |
| | | } |
| | | |
| | |
| | | import org.yeshi.utils.generater.entity.admin.AdminGeneraterInfo; |
| | | import org.yeshi.utils.generater.mybatis.Column; |
| | | import org.yeshi.utils.generater.mybatis.Table; |
| | | import org.yeshi.utils.generater.params.AdminGeneraterParams; |
| | | import org.yeshi.utils.generater.params.DaoGeneraterParams; |
| | | import org.yeshi.utils.generater.params.ServiceGeneraterParams; |
| | | import org.yeshi.utils.generater.vo.ExceptionVO; |
| | | import org.yeshi.utils.generater.vo.dao.MongoDBDaoVO; |
| | | import org.yeshi.utils.generater.vo.dao.MyBatisDBDaoVO; |
| | |
| | | |
| | | private static void generater() throws Exception { |
| | | GeneraterManager.getInstance().init("D:\\workspace\\server\\utils\\src\\test\\java", TestEntity.class); |
| | | GeneraterManager.getInstance().createWholeFunction(new DaoGeneraterParams("com.generater.temp.dao", null), null, null); |
| | | AdminGeneraterParams adminGeneraterParams=new AdminGeneraterParams("com.generater.temp.controller","D:\\workspace\\server\\utils\\src\\test"); |
| | | |
| | | GeneraterManager.getInstance().createWholeFunction(new DaoGeneraterParams("com.generater.temp.dao", "D:\\workspace\\server\\utils\\src\\test"), new ServiceGeneraterParams("com.generater.temp.query","com.generater.temp.service","com.generater.temp.service.impl"), adminGeneraterParams); |
| | | } |
| | | |
| | | |
| | |
| | | @DaoQueryCondition |
| | | @Show(order = 1, title = "类型") |
| | | @Select(values = {"1:男", "2:女"}, title = "类型") |
| | | private int type; |
| | | private Integer type; |
| | | |
| | | @DaoQueryCondition |
| | | @Show(order = 2, title = "性别") |
| | | @RadioGroup(values = {"1:男", "2:女"}, title = "性别") |
| | | private int sex; |
| | | private Integer sex; |
| | | |
| | | @Show(order = 3, title = "头像", showType = Show.ShowType.IMG, imgWidth = 50, imgHeight = 50) |
| | | @Img(height = 50, title = "头像", uploadApi = "/admin/uploadimg", uploadApiParams = {"id:123123","type:2"}) |
| | |
| | | |
| | | @DaoQueryCondition |
| | | private Date createTime; |
| | | |
| | | private Date updateTime; |
| | | |
| | | |
| | | public String getId() { |
| | |
| | | this.nickName = nickName; |
| | | } |
| | | |
| | | public int getType() { |
| | | public Integer getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(int type) { |
| | | public void setType(Integer type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public int getSex() { |
| | | public Integer getSex() { |
| | | return sex; |
| | | } |
| | | |
| | | public void setSex(int sex) { |
| | | public void setSex(Integer sex) { |
| | | this.sex = sex; |
| | | } |
| | | |
| | |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public Date getUpdateTime() { |
| | | return updateTime; |
| | | } |
| | | |
| | | public void setUpdateTime(Date updateTime) { |
| | | this.updateTime = updateTime; |
| | | } |
| | | |
| | | public class SearchForm { |
| | | |
| | | @Text(title = "开始日期", inputType = Text.Type.DATE) |