| | |
| | | |
| | | import com.ks.codegenerator.utils.AndroidBuilder; |
| | | import com.ks.codegenerator.utils.ServiceBuilder; |
| | | import com.ks.codegenerator.vo.ServiceVO; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.yeshi.utils.JsonUtil; |
| | |
| | | |
| | | //生成service |
| | | @RequestMapping("createService") |
| | | public void service(String name, String pks, String subpks, PrintWriter out, HttpServletRequest request) { |
| | | if (StringUtil.isNullOrEmpty(name) || StringUtil.isNullOrEmpty(pks) || StringUtil.isNullOrEmpty(subpks)) { |
| | | out.print(JsonUtil.loadFalseResult("项目名称,项目包名,应用包名不能为空")); |
| | | public void service(ServiceVO vo, PrintWriter out, HttpServletRequest request) { |
| | | if (StringUtil.isNullOrEmpty(vo.getName()) || StringUtil.isNullOrEmpty(vo.getPks()) || StringUtil.isNullOrEmpty(vo.getSubpks()) || StringUtil.isNullOrEmpty(vo.getChineseName())) { |
| | | out.print(JsonUtil.loadFalseResult("参数不完整")); |
| | | return; |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(vo.getSqlDataBaseName()) || StringUtil.isNullOrEmpty(vo.getSqlTablePrefix()) || StringUtil.isNullOrEmpty(vo.getMongoDataBaseName())) { |
| | | out.print(JsonUtil.loadFalseResult("参数不完整")); |
| | | return; |
| | | } |
| | | |
| | | |
| | | String rootPath = request.getServletContext().getRealPath("cache"); |
| | | try { |
| | | String path = new ServiceBuilder().setCacheDir(rootPath).setName(name).setPks(pks).setSubpks(subpks).build(); |
| | | String path = new ServiceBuilder().setCacheDir(rootPath).setName(vo.getName()).setPks(vo.getPks()).setSubpks(vo.getSubpks()).setProjectChineseName(vo.getChineseName()).setMongoDatabaseName(vo.getMongoDataBaseName()).setSqlDatabaseName(vo.getSqlDataBaseName()).setSqlTablePrefix(vo.getSqlTablePrefix()).build(); |
| | | out.print(JsonUtil.loadTrueResult(path)); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |