调整代码中的问题,新增动态表单静态后端基础代码
This commit is contained in:
parent
785a0d4f29
commit
6c5136603e
@ -0,0 +1,104 @@
|
|||||||
|
package ${basePackage}.controller.apis.${lowerTableName};
|
||||||
|
|
||||||
|
import com.cm.common.annotation.CheckRequestBodyAnnotation;
|
||||||
|
import com.cm.common.base.AbstractController;
|
||||||
|
import com.cm.common.constants.ISystemConstant;
|
||||||
|
import com.cm.common.exception.RemoveException;
|
||||||
|
import com.cm.common.exception.SearchException;
|
||||||
|
import com.cm.common.pojo.ListPage;
|
||||||
|
import com.cm.common.result.ErrorResult;
|
||||||
|
import com.cm.common.result.SuccessResult;
|
||||||
|
import com.cm.common.result.SuccessResultList;
|
||||||
|
import ${basePackage}.pojo.dtos.IdNameDTO;
|
||||||
|
import ${basePackage}.pojo.dtos.${lowerTableName}.${firstUpperTableName}DTO;
|
||||||
|
import ${basePackage}.pojo.vos.IdsVO;
|
||||||
|
import ${basePackage}.pojo.vos.${lowerTableName}.${firstUpperTableName}VO;
|
||||||
|
import ${basePackage}.service.${lowerTableName}.I${firstUpperTableName}Service;
|
||||||
|
import io.swagger.annotations.*;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName: ${firstUpperTableName}Controller
|
||||||
|
* @Description: ${tableExplain}
|
||||||
|
* @Author: ${author}
|
||||||
|
* @Date: ${date}
|
||||||
|
* @Version: ${version}
|
||||||
|
**/
|
||||||
|
@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "${tableExplain}接口")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping(ISystemConstant.API_PREFIX + "/${lowerTableName}")
|
||||||
|
public class ${firstUpperTableName}Controller extends AbstractController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private I${firstUpperTableName}Service ${firstLowerTableName}Service;
|
||||||
|
|
||||||
|
@ApiOperation(value = "新增${tableExplain}", notes = "新增${tableExplain}接口")
|
||||||
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
|
@PostMapping("save${lowerTableName}")
|
||||||
|
@CheckRequestBodyAnnotation
|
||||||
|
public SuccessResult save${firstUpperTableName}(@RequestBody ${firstUpperTableName}VO ${firstLowerTableName}VO) throws Exception {
|
||||||
|
return ${firstLowerTableName}Service.save${firstUpperTableName}(${firstLowerTableName}VO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "删除${tableExplain}(id列表)", notes = "删除${tableExplain}(id列表)接口")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "ids", value = "ID列表,用下划线分隔", paramType = "path", example = "1_2_3")
|
||||||
|
})
|
||||||
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
|
@DeleteMapping("remove${lowerTableName}/{ids}")
|
||||||
|
public SuccessResult remove${firstUpperTableName}(@PathVariable("ids") String ids) throws RemoveException {
|
||||||
|
return ${firstLowerTableName}Service.remove${firstUpperTableName}(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "修改${tableExplain}", notes = "修改${tableExplain}接口")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "${firstLowerTableName}Id", value = "${tableExplain}ID", paramType = "path")
|
||||||
|
})
|
||||||
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
|
@PutMapping("update${lowerTableName}/{${firstLowerTableName}Id}")
|
||||||
|
@CheckRequestBodyAnnotation
|
||||||
|
public SuccessResult update${firstUpperTableName}(@PathVariable("${firstLowerTableName}Id") String ${firstLowerTableName}Id,
|
||||||
|
@RequestBody ${firstUpperTableName}VO ${firstLowerTableName}VO) throws Exception {
|
||||||
|
return ${firstLowerTableName}Service.update${firstUpperTableName}(${firstLowerTableName}Id, ${firstLowerTableName}VO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "${tableExplain}详情(通过ID)", notes = "${tableExplain}详情(通过ID)接口")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "${firstLowerTableName}Id", value = "${tableExplain}ID", paramType = "path")
|
||||||
|
})
|
||||||
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
|
@GetMapping("get${lowerTableName}byid/{${firstLowerTableName}Id}")
|
||||||
|
public ${firstUpperTableName}DTO get${firstUpperTableName}ById(@PathVariable("${firstLowerTableName}Id") String ${firstLowerTableName}Id) throws SearchException {
|
||||||
|
return ${firstLowerTableName}Service.get${firstUpperTableName}ById(${firstLowerTableName}Id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "${tableExplain}列表", notes = "${tableExplain}列表接口")
|
||||||
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
|
@GetMapping("list${lowerTableName}")
|
||||||
|
public List<${firstUpperTableName}DTO> list${firstUpperTableName}() throws SearchException {
|
||||||
|
Map<String, Object> params = requestParams();
|
||||||
|
return ${firstLowerTableName}Service.list${firstUpperTableName}(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "${tableExplain}分页列表", notes = "${tableExplain}分页列表接口")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "form", dataType = "Integer", defaultValue = "1"),
|
||||||
|
@ApiImplicitParam(name = "rows", value = "显示数量", paramType = "form", dataType = "Integer", defaultValue = "20"),
|
||||||
|
@ApiImplicitParam(name = "keywords", value = "关键字", paramType = "form", dataType = "String"),
|
||||||
|
@ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "form", dataType = "String"),
|
||||||
|
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "form", dataType = "String")
|
||||||
|
})
|
||||||
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
|
@GetMapping("listpage${lowerTableName}")
|
||||||
|
public SuccessResultList<List<${firstUpperTableName}DTO>> listPage${firstUpperTableName}(ListPage page) throws SearchException {
|
||||||
|
Map<String, Object> params = requestParams();
|
||||||
|
page.setParams(params);
|
||||||
|
return ${firstLowerTableName}Service.listPage${firstUpperTableName}(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,119 @@
|
|||||||
|
package ${basePackage}.controller.app.apis.${lowerTableName};
|
||||||
|
|
||||||
|
import com.cm.common.annotation.CheckRequestBodyAnnotation;
|
||||||
|
import com.cm.common.base.AbstractController;
|
||||||
|
import com.cm.common.constants.ISystemConstant;
|
||||||
|
import com.cm.common.exception.RemoveException;
|
||||||
|
import com.cm.common.exception.SearchException;
|
||||||
|
import com.cm.common.pojo.ListPage;
|
||||||
|
import com.cm.common.result.ErrorResult;
|
||||||
|
import com.cm.common.result.SuccessResult;
|
||||||
|
import com.cm.common.result.SuccessResultList;
|
||||||
|
import ${basePackage}.pojo.dtos.IdNameDTO;
|
||||||
|
import ${basePackage}.pojo.dtos.${lowerTableName}.${firstUpperTableName}DTO;
|
||||||
|
import ${basePackage}.pojo.vos.IdsVO;
|
||||||
|
import ${basePackage}.pojo.vos.${lowerTableName}.${firstUpperTableName}VO;
|
||||||
|
import ${basePackage}.service.${lowerTableName}.I${firstUpperTableName}Service;
|
||||||
|
import io.swagger.annotations.*;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName: ${firstUpperTableName}AppController
|
||||||
|
* @Description: ${tableExplain}
|
||||||
|
* @Author: ${author}
|
||||||
|
* @Date: ${date}
|
||||||
|
* @Version: ${version}
|
||||||
|
**/
|
||||||
|
@Api(tags = ISystemConstant.API_TAGS_APP_PREFIX + "${tableExplain}接口")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping(ISystemConstant.APP_PREFIX + "/${lowerTableName}")
|
||||||
|
public class ${firstUpperTableName}AppController extends AbstractController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private I${firstUpperTableName}Service ${firstLowerTableName}Service;
|
||||||
|
|
||||||
|
@ApiOperation(value = "新增${tableExplain}", notes = "新增${tableExplain}接口")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "token", value = "token", paramType = "header")
|
||||||
|
})
|
||||||
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
|
@PostMapping("save${lowerTableName}")
|
||||||
|
@CheckRequestBodyAnnotation
|
||||||
|
public SuccessResult save${firstUpperTableName}(@RequestHeader("token") String token,
|
||||||
|
@RequestBody ${firstUpperTableName}VO ${firstLowerTableName}VO) throws Exception {
|
||||||
|
return ${firstLowerTableName}Service.save${firstUpperTableName}ByToken(token, ${firstLowerTableName}VO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "删除${tableExplain}(id列表)", notes = "删除${tableExplain}(id列表)接口")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
|
||||||
|
@ApiImplicitParam(name = "ids", value = "ID列表,用下划线分隔", paramType = "path", example = "1_2_3")
|
||||||
|
})
|
||||||
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
|
@DeleteMapping("remove${lowerTableName}/{ids}")
|
||||||
|
public SuccessResult remove${firstUpperTableName}(@RequestHeader("token") String token,
|
||||||
|
@PathVariable("ids") String ids) throws RemoveException {
|
||||||
|
return ${firstLowerTableName}Service.remove${firstUpperTableName}ByToken(token, ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "修改${tableExplain}", notes = "修改${tableExplain}接口")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
|
||||||
|
@ApiImplicitParam(name = "${firstLowerTableName}Id", value = "${tableExplain}ID", paramType = "path")
|
||||||
|
})
|
||||||
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
|
@PutMapping("update${lowerTableName}/{${firstLowerTableName}Id}")
|
||||||
|
@CheckRequestBodyAnnotation
|
||||||
|
public SuccessResult update${firstUpperTableName}(@RequestHeader("token") String token,
|
||||||
|
@PathVariable("${firstLowerTableName}Id") String ${firstLowerTableName}Id,
|
||||||
|
@RequestBody ${firstUpperTableName}VO ${firstLowerTableName}VO) throws Exception {
|
||||||
|
return ${firstLowerTableName}Service.update${firstUpperTableName}ByToken(token, ${firstLowerTableName}Id, ${firstLowerTableName}VO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "${tableExplain}详情(通过ID)", notes = "${tableExplain}详情(通过ID)接口")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
|
||||||
|
@ApiImplicitParam(name = "${firstLowerTableName}Id", value = "${tableExplain}ID", paramType = "path")
|
||||||
|
})
|
||||||
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
|
@GetMapping("get${lowerTableName}byid/{${firstLowerTableName}Id}")
|
||||||
|
public ${firstUpperTableName}DTO get${firstUpperTableName}ById(@RequestHeader("token") String token
|
||||||
|
@PathVariable("${firstLowerTableName}Id") String ${firstLowerTableName}Id) throws SearchException {
|
||||||
|
return ${firstLowerTableName}Service.get${firstUpperTableName}ById(token, ${firstLowerTableName}Id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "${tableExplain}列表", notes = "${tableExplain}列表接口")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "token", value = "token", paramType = "header")
|
||||||
|
})
|
||||||
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
|
@GetMapping("list${lowerTableName}")
|
||||||
|
public List<${firstUpperTableName}DTO> list${firstUpperTableName}(@RequestHeader("token") String token) throws SearchException {
|
||||||
|
Map<String, Object> params = requestParams();
|
||||||
|
return ${firstLowerTableName}Service.list${firstUpperTableName}(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "${tableExplain}分页列表", notes = "${tableExplain}分页列表接口")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
|
||||||
|
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "form", dataType = "Integer", defaultValue = "1"),
|
||||||
|
@ApiImplicitParam(name = "rows", value = "显示数量", paramType = "form", dataType = "Integer", defaultValue = "20"),
|
||||||
|
@ApiImplicitParam(name = "keywords", value = "关键字", paramType = "form", dataType = "String"),
|
||||||
|
@ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "form", dataType = "String"),
|
||||||
|
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "form", dataType = "String")
|
||||||
|
})
|
||||||
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
|
@GetMapping("listpage${lowerTableName}")
|
||||||
|
public SuccessResultList<List<${firstUpperTableName}DTO>> listPage${firstUpperTableName}(@RequestHeader("token") String token,
|
||||||
|
ListPage page) throws SearchException {
|
||||||
|
Map<String, Object> params = requestParams();
|
||||||
|
page.setParams(params);
|
||||||
|
return ${firstLowerTableName}Service.listPage${firstUpperTableName}(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,114 @@
|
|||||||
|
package ${basePackage}.controller.app.apis.${lowerTableName};
|
||||||
|
|
||||||
|
import com.cm.common.annotation.CheckRequestBodyAnnotation;
|
||||||
|
import com.cm.common.base.AbstractController;
|
||||||
|
import com.cm.common.constants.ISystemConstant;
|
||||||
|
import com.cm.common.exception.RemoveException;
|
||||||
|
import com.cm.common.exception.SearchException;
|
||||||
|
import com.cm.common.pojo.ListPage;
|
||||||
|
import com.cm.common.result.ErrorResult;
|
||||||
|
import com.cm.common.result.SuccessResult;
|
||||||
|
import com.cm.common.result.SuccessResultList;
|
||||||
|
import ${basePackage}.pojo.dtos.IdNameDTO;
|
||||||
|
import ${basePackage}.pojo.dtos.${lowerTableName}.${firstUpperTableName}DTO;
|
||||||
|
import ${basePackage}.pojo.vos.IdsVO;
|
||||||
|
import ${basePackage}.pojo.vos.${lowerTableName}.${firstUpperTableName}VO;
|
||||||
|
import ${basePackage}.service.${lowerTableName}.I${firstUpperTableName}Service;
|
||||||
|
import io.swagger.annotations.*;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName: ${firstUpperTableName}ResourceController
|
||||||
|
* @Description: ${tableExplain}
|
||||||
|
* @Author: ${author}
|
||||||
|
* @Date: ${date}
|
||||||
|
* @Version: ${version}
|
||||||
|
**/
|
||||||
|
@Api(tags = ISystemConstant.API_TAGS_RESOURCE_PREFIX + "${tableExplain}接口")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping(ISystemConstant.RESOURCE_PREFIX + "/${lowerTableName}")
|
||||||
|
public class ${firstUpperTableName}ResourceController extends AbstractController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private I${firstUpperTableName}Service ${firstLowerTableName}Service;
|
||||||
|
|
||||||
|
@ApiOperation(value = "新增${tableExplain}", notes = "新增${tableExplain}接口")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "access_token", value = "access_token", paramType = "query")
|
||||||
|
})
|
||||||
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
|
@PostMapping("save${lowerTableName}")
|
||||||
|
@CheckRequestBodyAnnotation
|
||||||
|
public SuccessResult save${firstUpperTableName}(@RequestBody ${firstUpperTableName}VO ${firstLowerTableName}VO) throws Exception {
|
||||||
|
return ${firstLowerTableName}Service.save${firstUpperTableName}(${firstLowerTableName}VO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "删除${tableExplain}(id列表)", notes = "删除${tableExplain}(id列表)接口")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "access_token", value = "access_token", paramType = "query"),
|
||||||
|
@ApiImplicitParam(name = "ids", value = "ID列表,用下划线分隔", paramType = "path", example = "1_2_3")
|
||||||
|
})
|
||||||
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
|
@DeleteMapping("remove${lowerTableName}/{ids}")
|
||||||
|
public SuccessResult remove${firstUpperTableName}(@PathVariable("ids") String ids) throws RemoveException {
|
||||||
|
return ${firstLowerTableName}Service.remove${firstUpperTableName}(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "修改${tableExplain}", notes = "修改${tableExplain}接口")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "access_token", value = "access_token", paramType = "query"),
|
||||||
|
@ApiImplicitParam(name = "${firstLowerTableName}Id", value = "${tableExplain}ID", paramType = "path")
|
||||||
|
})
|
||||||
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
|
@PutMapping("update${lowerTableName}/{${firstLowerTableName}Id}")
|
||||||
|
@CheckRequestBodyAnnotation
|
||||||
|
public SuccessResult update${firstUpperTableName}(@PathVariable("${firstLowerTableName}Id") String ${firstLowerTableName}Id,
|
||||||
|
@RequestBody ${firstUpperTableName}VO ${firstLowerTableName}VO) throws Exception {
|
||||||
|
return ${firstLowerTableName}Service.update${firstUpperTableName}(${firstLowerTableName}Id, ${firstLowerTableName}VO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "${tableExplain}详情(通过ID)", notes = "${tableExplain}详情(通过ID)接口")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "access_token", value = "access_token", paramType = "query"),
|
||||||
|
@ApiImplicitParam(name = "${firstLowerTableName}Id", value = "${tableExplain}ID", paramType = "path")
|
||||||
|
})
|
||||||
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
|
@GetMapping("get${lowerTableName}byid/{${firstLowerTableName}Id}")
|
||||||
|
public ${firstUpperTableName}DTO get${firstUpperTableName}ById(@PathVariable("${firstLowerTableName}Id") String ${firstLowerTableName}Id) throws SearchException {
|
||||||
|
return ${firstLowerTableName}Service.get${firstUpperTableName}ById(${firstLowerTableName}Id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "${tableExplain}列表", notes = "${tableExplain}列表接口")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "access_token", value = "access_token", paramType = "query")
|
||||||
|
})
|
||||||
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
|
@GetMapping("list${lowerTableName}")
|
||||||
|
public List<${firstUpperTableName}DTO> list${firstUpperTableName}() throws SearchException {
|
||||||
|
Map<String, Object> params = requestParams();
|
||||||
|
return ${firstLowerTableName}Service.list${firstUpperTableName}(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "${tableExplain}分页列表", notes = "${tableExplain}分页列表接口")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "access_token", value = "access_token", paramType = "query"),
|
||||||
|
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "form", dataType = "Integer", defaultValue = "1"),
|
||||||
|
@ApiImplicitParam(name = "rows", value = "显示数量", paramType = "form", dataType = "Integer", defaultValue = "20"),
|
||||||
|
@ApiImplicitParam(name = "keywords", value = "关键字", paramType = "form", dataType = "String"),
|
||||||
|
@ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "form", dataType = "String"),
|
||||||
|
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "form", dataType = "String")
|
||||||
|
})
|
||||||
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
|
@GetMapping("listpage${lowerTableName}")
|
||||||
|
public SuccessResultList<List<${firstUpperTableName}DTO>> listPage${firstUpperTableName}(ListPage page) throws SearchException {
|
||||||
|
Map<String, Object> params = requestParams();
|
||||||
|
page.setParams(params);
|
||||||
|
return ${firstLowerTableName}Service.listPage${firstUpperTableName}(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,66 @@
|
|||||||
|
package ${basePackage}.dao.${lowerTableName};
|
||||||
|
|
||||||
|
import com.cm.common.exception.RemoveException;
|
||||||
|
import com.cm.common.exception.SaveException;
|
||||||
|
import com.cm.common.exception.SearchException;
|
||||||
|
import com.cm.common.exception.UpdateException;
|
||||||
|
import com.cm.common.result.SuccessResultList;
|
||||||
|
import ${basePackage}.pojo.dtos.${lowerTableName}.${firstUpperTableName}DTO;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName: I${firstUpperTableName}Dao
|
||||||
|
* @Description: ${tableExplain}
|
||||||
|
* @Author: ${author}
|
||||||
|
* @Date: ${date}
|
||||||
|
* @Version: ${version}
|
||||||
|
**/
|
||||||
|
@Repository
|
||||||
|
public interface I${firstUpperTableName}Dao {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增${tableExplain}
|
||||||
|
*
|
||||||
|
* @param params
|
||||||
|
* @throws SaveException
|
||||||
|
*/
|
||||||
|
void save${firstUpperTableName}(Map<String, Object> params) throws SaveException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除${tableExplain}
|
||||||
|
*
|
||||||
|
* @param params
|
||||||
|
* @throws RemoveException
|
||||||
|
*/
|
||||||
|
void remove${firstUpperTableName}(Map<String, Object> params) throws RemoveException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改${tableExplain}
|
||||||
|
*
|
||||||
|
* @param params
|
||||||
|
* @throws UpdateException
|
||||||
|
*/
|
||||||
|
void update${firstUpperTableName}(Map<String, Object> params) throws UpdateException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ${tableExplain}详情
|
||||||
|
*
|
||||||
|
* @param params
|
||||||
|
* @return
|
||||||
|
* @throws SearchException
|
||||||
|
*/
|
||||||
|
${firstUpperTableName}DTO get${firstUpperTableName}(Map<String, Object> params) throws SearchException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ${tableExplain}列表
|
||||||
|
*
|
||||||
|
* @param params
|
||||||
|
* @return
|
||||||
|
* @throws SearchException
|
||||||
|
*/
|
||||||
|
List<${firstUpperTableName}DTO> list${firstUpperTableName}(Map<String, Object> params) throws SearchException;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,116 @@
|
|||||||
|
<?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="${basePackage}.dao.${lowerTableName}.I${firstUpperTableName}Dao">
|
||||||
|
|
||||||
|
<resultMap id="${firstLowerTableName}DTO" type="${basePackage}.pojo.dtos.${lowerTableName}.${firstUpperTableName}DTO">
|
||||||
|
<id property="${firstLowerTableName}Id" column="${underLineTableName}_id"/>
|
||||||
|
<#list fieldList! as field>
|
||||||
|
<result property="${field.fieldName}" column="${field.underLineFieldName}"/>
|
||||||
|
</#list>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<!-- 新增${tableExplain} -->
|
||||||
|
<insert id="save${firstUpperTableName}" parameterType="map">
|
||||||
|
INSERT INTO ${tablePrefix}${underLineTableName}(
|
||||||
|
${underLineTableName}_id,
|
||||||
|
<#list fieldList! as field>
|
||||||
|
${field.underLineTableName},
|
||||||
|
</#list>
|
||||||
|
creator,
|
||||||
|
gmt_create,
|
||||||
|
modifier,
|
||||||
|
gmt_modified,
|
||||||
|
is_delete
|
||||||
|
) VALUES(
|
||||||
|
${r"#{"}${firstLowerTableName}Id${r"}"},
|
||||||
|
<#list fieldList! as field>
|
||||||
|
${r"#{"}${field.fieldName}${r"}"},
|
||||||
|
</#list>
|
||||||
|
${r"#{creator}"},
|
||||||
|
${r"#{gmtCreate}"},
|
||||||
|
${r"#{modifier}"},
|
||||||
|
${r"#{gmtModified}"},
|
||||||
|
${r"#{isDelete}"}
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<!-- 删除${tableExplain} -->
|
||||||
|
<update id="remove${firstUpperTableName}" parameterType="map">
|
||||||
|
UPDATE
|
||||||
|
${tablePrefix}${underLineTableName}
|
||||||
|
SET
|
||||||
|
is_delete = 1,
|
||||||
|
modifier = ${r"#{modifier}"},
|
||||||
|
gmt_modified = ${r"#{gmtModified}"}
|
||||||
|
WHERE
|
||||||
|
${underLineTableName}_id IN
|
||||||
|
<foreach collection="${firstLowerTableName}Ids" index="index" open="(" separator="," close=")">
|
||||||
|
${r"#{"}${firstLowerTableName}${r"Ids[${index}]}"}
|
||||||
|
</foreach>
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<!-- 修改${tableExplain} -->
|
||||||
|
<update id="update${firstUpperTableName}" parameterType="map">
|
||||||
|
UPDATE
|
||||||
|
${tablePrefix}${underLineTableName}
|
||||||
|
SET
|
||||||
|
<#list fieldList! as field>
|
||||||
|
<#if field.fieldType == "number" || field.fieldType == "double">
|
||||||
|
<if test="${field.fieldName} != null">
|
||||||
|
${field.underLineTableName} = ${r"#{"}${field.fieldName}${r"}"},
|
||||||
|
</if>
|
||||||
|
<#else>
|
||||||
|
<if test="${field.fieldName} != null ${field.fieldName} != ''">
|
||||||
|
${field.underLineTableName} = ${r"#{"}${field.fieldName}${r"}"},
|
||||||
|
</if>
|
||||||
|
</#if>
|
||||||
|
</#list>
|
||||||
|
modifier = ${r"#{modifier}"},
|
||||||
|
gmt_modified = ${r"#{gmtModified}"}
|
||||||
|
WHERE
|
||||||
|
${underLineTableName}_id = ${r"#{"}${firstLowerTableName}${r"Id}"}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<!-- ${tableExplain}详情 -->
|
||||||
|
<select id="get${firstUpperTableName}" parameterType="map" resultMap="${firstLowerTableName}DTO">
|
||||||
|
SELECT
|
||||||
|
t1.*
|
||||||
|
FROM
|
||||||
|
${tablePrefix}${underLineTableName} t1
|
||||||
|
WHERE
|
||||||
|
t1.is_delete = 0
|
||||||
|
<if test="${firstLowerTableName}Id != null and ${firstLowerTableName}Id != ''">
|
||||||
|
AND
|
||||||
|
t1.${underLineTableName}_id = ${r"#{"}${firstLowerTableName}${r"Id}"}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!-- ${tableExplain}列表 -->
|
||||||
|
<select id="list${firstUpperName}" parameterType="map" resultMap="${firstLowerTableName}DTO">
|
||||||
|
SELECT
|
||||||
|
t1.*
|
||||||
|
FROM
|
||||||
|
${tablePrefix}${underLineTableName} t1
|
||||||
|
WHERE
|
||||||
|
t1.is_delete = 0
|
||||||
|
<if test="keywords != null and keywords != ''">
|
||||||
|
<!-- 这里添加检索关键字 -->
|
||||||
|
</if>
|
||||||
|
<if test="startTime != null and startTime != ''">
|
||||||
|
AND
|
||||||
|
LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> ${r"#{startTime}"}
|
||||||
|
</if>
|
||||||
|
<if test="endTime != null and endTime != ''">
|
||||||
|
AND
|
||||||
|
LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> ${r"#{endTime}"}
|
||||||
|
</if>
|
||||||
|
<if test="${firstLowerTableName}Ids != null and ${firstLowerTableName}Ids.size > 0">
|
||||||
|
AND
|
||||||
|
t1.${underLineTableName}_id IN
|
||||||
|
<foreach collection="${firstLowerTableName}Ids" index="index" open="(" separator="," close=")">
|
||||||
|
${r"#{"}${firstLowerTableName}${r"Ids[${index}]}"}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
@ -0,0 +1,61 @@
|
|||||||
|
package ${basePackage}.pojo.vos.${lowerTableName};
|
||||||
|
|
||||||
|
import com.cm.common.annotation.CheckEmptyAnnotation;
|
||||||
|
import com.cm.common.annotation.CheckNumberAnnotation;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @ClassName: ${firstUpperTableName}DTO
|
||||||
|
* @Description: ${tableExplain}
|
||||||
|
* @Author: ${author}
|
||||||
|
* @Date: ${date}
|
||||||
|
* @Version: ${version}
|
||||||
|
**/
|
||||||
|
@ApiModel
|
||||||
|
public class ${firstUpperTableName}VO {
|
||||||
|
|
||||||
|
<#list fieldList! as field>
|
||||||
|
@ApiModelProperty(name = "${field.fieldName}", value = "${field.fieldExplain}")
|
||||||
|
<#if field.fieldType == "number">
|
||||||
|
private Integer ${field.fieldName};
|
||||||
|
<#elseif field.fieldType == "double">
|
||||||
|
private Double ${field.fieldName};
|
||||||
|
<#else>
|
||||||
|
private String ${field.fieldName};
|
||||||
|
</#if>
|
||||||
|
</#list>
|
||||||
|
|
||||||
|
<#list fieldList! as field>
|
||||||
|
<#if field.fieldType == "number">
|
||||||
|
public Integer get${field.firstUpperFieldName}() {
|
||||||
|
return ${field.fieldName} == null ? 0 : ${field.fieldName};
|
||||||
|
}
|
||||||
|
|
||||||
|
public void set${field.firstUpperFieldName}(Integer ${field.fieldName}) {
|
||||||
|
this.${field.fieldName} = ${field.fieldName};
|
||||||
|
}
|
||||||
|
|
||||||
|
<#elseif field.fieldType == "double">
|
||||||
|
public Double get${field.firstUpperFieldName}() {
|
||||||
|
return ${field.fieldName} == null ? 0D : ${field.fieldName};
|
||||||
|
}
|
||||||
|
|
||||||
|
public void set${field.firstUpperFieldName}(String ${field.fieldName}) {
|
||||||
|
this.${field.fieldName} = ${field.fieldName};
|
||||||
|
}
|
||||||
|
|
||||||
|
<#else>
|
||||||
|
public String get${field.firstUpperFieldName}() {
|
||||||
|
return ${field.fieldName} == null ? "" : ${field.fieldName};
|
||||||
|
}
|
||||||
|
|
||||||
|
public void set${field.firstUpperFieldName}(String ${field.fieldName}) {
|
||||||
|
this.${field.fieldName} = ${field.fieldName};
|
||||||
|
}
|
||||||
|
|
||||||
|
</#if>
|
||||||
|
</#list>
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,61 @@
|
|||||||
|
package ${basePackage}.pojo.vos.${lowerTableName};
|
||||||
|
|
||||||
|
import com.cm.common.annotation.CheckEmptyAnnotation;
|
||||||
|
import com.cm.common.annotation.CheckNumberAnnotation;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @ClassName: ${firstUpperTableName}VO
|
||||||
|
* @Description: ${tableExplain}
|
||||||
|
* @Author: ${author}
|
||||||
|
* @Date: ${date}
|
||||||
|
* @Version: ${version}
|
||||||
|
**/
|
||||||
|
@ApiModel
|
||||||
|
public class ${firstUpperTableName}VO {
|
||||||
|
|
||||||
|
<#list fieldList! as field>
|
||||||
|
@ApiModelProperty(name = "${field.fieldName}", value = "${field.fieldExplain}")
|
||||||
|
<#if field.fieldType == "number">
|
||||||
|
private Integer ${field.fieldName};
|
||||||
|
<#elseif field.fieldType == "double">
|
||||||
|
private Double ${field.fieldName};
|
||||||
|
<#else>
|
||||||
|
private String ${field.fieldName};
|
||||||
|
</#if>
|
||||||
|
</#list>
|
||||||
|
|
||||||
|
<#list fieldList! as field>
|
||||||
|
<#if field.fieldType == "number">
|
||||||
|
public Integer get${field.firstUpperFieldName}() {
|
||||||
|
return ${field.fieldName} == null ? 0 : ${field.fieldName};
|
||||||
|
}
|
||||||
|
|
||||||
|
public void set${field.firstUpperFieldName}(Integer ${field.fieldName}) {
|
||||||
|
this.${field.fieldName} = ${field.fieldName};
|
||||||
|
}
|
||||||
|
|
||||||
|
<#elseif field.fieldType == "double">
|
||||||
|
public Double get${field.firstUpperFieldName}() {
|
||||||
|
return ${field.fieldName} == null ? 0D : ${field.fieldName};
|
||||||
|
}
|
||||||
|
|
||||||
|
public void set${field.firstUpperFieldName}(String ${field.fieldName}) {
|
||||||
|
this.${field.fieldName} = ${field.fieldName};
|
||||||
|
}
|
||||||
|
|
||||||
|
<#else>
|
||||||
|
public String get${field.firstUpperFieldName}() {
|
||||||
|
return ${field.fieldName} == null ? "" : ${field.fieldName};
|
||||||
|
}
|
||||||
|
|
||||||
|
public void set${field.firstUpperFieldName}(String ${field.fieldName}) {
|
||||||
|
this.${field.fieldName} = ${field.fieldName};
|
||||||
|
}
|
||||||
|
|
||||||
|
</#if>
|
||||||
|
</#list>
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,331 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="en" xmlns:th="http://www.thymeleaf.org">
|
||||||
|
<head>
|
||||||
|
<base th:href="${#httpServletRequest.getScheme() + '://' + #httpServletRequest.getServerName() + ':' + #request.getServerPort() + #request.getContextPath() + '/'} ">
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="renderer" content="webkit">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
||||||
|
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
|
||||||
|
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
|
||||||
|
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="layui-fluid layui-anim layui-anim-fadein">
|
||||||
|
<div class="layui-row layui-col-space15">
|
||||||
|
<div class="layui-col-md12">
|
||||||
|
<div class="layui-card">
|
||||||
|
<div class="layui-card-body">
|
||||||
|
<div class="test-table-reload-btn" style="margin-bottom: 10px;">
|
||||||
|
<div class="layui-inline">
|
||||||
|
<input type="text" id="keywords" class="layui-input search-item" placeholder="输入关键字">
|
||||||
|
</div>
|
||||||
|
<div class="layui-inline">
|
||||||
|
<input type="text" id="startTime" class="layui-input search-item" placeholder="开始时间" readonly>
|
||||||
|
</div>
|
||||||
|
<div class="layui-inline">
|
||||||
|
<input type="text" id="endTime" class="layui-input search-item" placeholder="结束时间" readonly>
|
||||||
|
</div>
|
||||||
|
<button type="button" id="search" class="layui-btn layui-btn-sm">
|
||||||
|
<i class="fa fa-lg fa-search"></i> 搜索
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<table class="layui-hide" id="dataTable" lay-filter="dataTable"></table>
|
||||||
|
<!-- 表头按钮组 -->
|
||||||
|
<script type="text/html" id="headerToolBar">
|
||||||
|
<div class="layui-btn-group">
|
||||||
|
<button type="button" class="layui-btn layui-btn-sm" lay-event="saveEvent">
|
||||||
|
<i class="fa fa-lg fa-plus"></i> 新增
|
||||||
|
</button>
|
||||||
|
<button type="button" class="layui-btn layui-btn-normal layui-btn-sm" lay-event="updateEvent">
|
||||||
|
<i class="fa fa-lg fa-edit"></i> 编辑
|
||||||
|
</button>
|
||||||
|
<button type="button" class="layui-btn layui-btn-danger layui-btn-sm" lay-event="removeEvent">
|
||||||
|
<i class="fa fa-lg fa-trash"></i> 删除
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<input type="hidden" id="tableName" th:value="${tableName}"/>
|
||||||
|
<input type="hidden" id="uuidField" th:value="${uuidField}"/>
|
||||||
|
<script src="assets/layuiadmin/layui/layui.js"></script>
|
||||||
|
<script src="assets/js/vendor/viewer/viewer.min.js"></script>
|
||||||
|
<script th:inline="javascript">
|
||||||
|
layui.config({
|
||||||
|
base: 'assets/layuiadmin/'
|
||||||
|
}).extend({
|
||||||
|
index: 'lib/index'
|
||||||
|
}).use(['index', 'table', 'laydate', 'common'], function() {
|
||||||
|
var $ = layui.$;
|
||||||
|
var $win = $(window);
|
||||||
|
var table = layui.table;
|
||||||
|
var admin = layui.admin;
|
||||||
|
var laydate = layui.laydate;
|
||||||
|
var common = layui.common;
|
||||||
|
var resizeTimeout = null;
|
||||||
|
var defaultCols = [[${dynamicListFormShowFieldDTOList}]];
|
||||||
|
|
||||||
|
// 初始化表格
|
||||||
|
function initTable() {
|
||||||
|
var autoCols = [
|
||||||
|
{type:'checkbox', fixed: 'left'},
|
||||||
|
{field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '<span>{{d.LAY_INDEX}}</span>'}
|
||||||
|
];
|
||||||
|
for(var i = 0, item = defaultCols[i]; item = defaultCols[i++];) {
|
||||||
|
if(item.fieldType === 'file') {
|
||||||
|
autoCols.push({field: (item.fieldName), width: item.fieldWidth, title: item.fieldExplain, align:'center',
|
||||||
|
templet: function(row) {
|
||||||
|
var selectData = row[this.field];
|
||||||
|
if(typeof(selectData) === 'undefined' || selectData == null || selectData == '') {
|
||||||
|
return '-';
|
||||||
|
}
|
||||||
|
var downloadFile = '';
|
||||||
|
var datas = selectData.split(',');
|
||||||
|
for(var i = 0, item = datas[i]; item = datas[i++];) {
|
||||||
|
if(downloadFile.length > 0) {
|
||||||
|
downloadFile += ',';
|
||||||
|
}
|
||||||
|
downloadFile += '<a href="route/file/downloadfile/false/'+ item +'" target="_blank">点击下载</a>'
|
||||||
|
}
|
||||||
|
return downloadFile;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else if(item.fieldType === 'date') {
|
||||||
|
autoCols.push({field: (item.fieldName), width: item.fieldWidth, title: item.fieldExplain, align:'center',
|
||||||
|
templet: function(row) {
|
||||||
|
var selectData = row[this.field];
|
||||||
|
if(typeof(selectData) === 'undefined' || selectData == null || selectData == '') {
|
||||||
|
return '-';
|
||||||
|
}
|
||||||
|
return common.formatDate('yyyy-MM-dd', new Date(selectData));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else if(item.fieldType === 'datetime') {
|
||||||
|
autoCols.push({field: (item.fieldName), width: item.fieldWidth, title: item.fieldExplain, align:'center',
|
||||||
|
templet: function(row) {
|
||||||
|
var selectData = row[this.field];
|
||||||
|
if(typeof(selectData) === 'undefined' || selectData == null || selectData == '') {
|
||||||
|
return '-';
|
||||||
|
}
|
||||||
|
return common.formatDate('yyyy-MM-dd hh:mm:ss', new Date(selectData));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else if(item.fieldType === 'select' || item.fieldType === 'radio' || item.fieldType === 'checkbox') {
|
||||||
|
autoCols.push({field: (item.fieldName +'DictionaryName'), width: item.fieldWidth, title: item.fieldExplain, align:'center',
|
||||||
|
templet: function(row) {
|
||||||
|
var selectData = row[this.field];
|
||||||
|
if(typeof(selectData) === 'undefined' || selectData == null || selectData == '') {
|
||||||
|
return '-';
|
||||||
|
}
|
||||||
|
return selectData;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else if(item.fieldType === 'selectUser') {
|
||||||
|
autoCols.push({field: item.fieldName, width: item.fieldWidth, title: item.fieldExplain, align:'center',
|
||||||
|
templet: function(row) {
|
||||||
|
var selectData = row[this.field];
|
||||||
|
if(typeof(selectData) === 'undefined' || selectData == null || selectData == '') {
|
||||||
|
return '-';
|
||||||
|
}
|
||||||
|
var selectArray = selectData.split(',');
|
||||||
|
var value = '';
|
||||||
|
for(var i = 0, item = selectArray[i]; item = selectArray[i++];) {
|
||||||
|
var info = item.split('|');
|
||||||
|
if(value.length > 0) {
|
||||||
|
value += ',';
|
||||||
|
}
|
||||||
|
value += info[3];
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else if(item.fieldType === 'selectDepartment') {
|
||||||
|
autoCols.push({field: item.fieldName, width: item.fieldWidth, title: item.fieldExplain, align:'center',
|
||||||
|
templet: function(row) {
|
||||||
|
var selectData = row[this.field];
|
||||||
|
if(typeof(selectData) === 'undefined' || selectData == null || selectData == '') {
|
||||||
|
return '-';
|
||||||
|
}
|
||||||
|
var selectArray = selectData.split(',');
|
||||||
|
var value = '';
|
||||||
|
for(var i = 0, item = selectArray[i]; item = selectArray[i++];) {
|
||||||
|
var info = item.split('|');
|
||||||
|
if(value.length > 0) {
|
||||||
|
value += ',';
|
||||||
|
}
|
||||||
|
value += info[1];
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else if(item.fieldType === 'currentUser'
|
||||||
|
|| item.fieldType === 'currentDepartment'
|
||||||
|
|| item.fieldType === 'currentRole'
|
||||||
|
|| item.fieldType === 'currentGroup'
|
||||||
|
|| item.fieldType === 'currentPosition') {
|
||||||
|
autoCols.push({field: item.fieldName, width: item.fieldWidth, title: item.fieldExplain, align:'center',
|
||||||
|
templet: function(row) {
|
||||||
|
var currentData = row[this.field];
|
||||||
|
if(typeof(currentData) === 'undefined' || currentData == null || currentData == '') {
|
||||||
|
return '-';
|
||||||
|
}
|
||||||
|
return currentData != null && currentData != '' ? currentData.split('|')[1] : '无';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
autoCols.push({field: item.fieldName, width: item.fieldWidth, title: item.fieldExplain, align:'center',
|
||||||
|
templet: function(row) {
|
||||||
|
var selectData = row[this.field];
|
||||||
|
if(typeof(selectData) === 'undefined' || selectData == null || selectData == '') {
|
||||||
|
return '-';
|
||||||
|
}
|
||||||
|
return selectData;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
table.render({
|
||||||
|
elem: '#dataTable',
|
||||||
|
id: 'dataTable',
|
||||||
|
url: top.restAjax.path('api/dynamicdata/listpagedynamicdata/{tableName}', [$('#tableName').val()]),
|
||||||
|
width: admin.screen() > 1 ? '100%' : '',
|
||||||
|
height: $win.height() - 90,
|
||||||
|
limit: 20,
|
||||||
|
limits: [20, 40, 60, 80, 100, 200],
|
||||||
|
toolbar: '#headerToolBar',
|
||||||
|
request: {
|
||||||
|
pageName: 'page',
|
||||||
|
limitName: 'rows'
|
||||||
|
},
|
||||||
|
cols: [autoCols],
|
||||||
|
page: true,
|
||||||
|
parseData: function(data) {
|
||||||
|
return {
|
||||||
|
'code': 0,
|
||||||
|
'msg': '',
|
||||||
|
'count': data.total,
|
||||||
|
'data': data.rows
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 重载表格
|
||||||
|
function reloadTable() {
|
||||||
|
table.reload('dataTable', {
|
||||||
|
url: top.restAjax.path('api/dynamicdata/listpagedynamicdata/{tableName}', [$('#tableName').val()]),
|
||||||
|
where: {
|
||||||
|
keywords: $('#keywords').val(),
|
||||||
|
startTime: $('#startTime').val(),
|
||||||
|
endTime: $('#endTime').val()
|
||||||
|
},
|
||||||
|
height: $win.height() - 90,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 初始化日期
|
||||||
|
function initDate() {
|
||||||
|
// 日期选择
|
||||||
|
laydate.render({
|
||||||
|
elem: '#startTime',
|
||||||
|
format: 'yyyy-MM-dd'
|
||||||
|
});
|
||||||
|
laydate.render({
|
||||||
|
elem: '#endTime',
|
||||||
|
format: 'yyyy-MM-dd'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 删除
|
||||||
|
function removeData(ids) {
|
||||||
|
top.dialog.msg(top.dataMessage.delete, {
|
||||||
|
time: 0,
|
||||||
|
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
|
||||||
|
shade: 0.3,
|
||||||
|
yes: function (index) {
|
||||||
|
top.dialog.close(index);
|
||||||
|
var layIndex;
|
||||||
|
top.restAjax.delete(top.restAjax.path('api/dynamicdata/removedynamicdata/{tableName}/{ids}', [$('#tableName').val(), ids]), {}, null, function (code, data) {
|
||||||
|
top.dialog.msg(top.dataMessage.deleteSuccess, {time: 1000}, function () {
|
||||||
|
reloadTable();
|
||||||
|
});
|
||||||
|
}, function (code, data) {
|
||||||
|
top.dialog.msg(data.msg);
|
||||||
|
}, function () {
|
||||||
|
layIndex = top.dialog.msg(top.dataMessage.deleting, {icon: 16, time: 0, shade: 0.3});
|
||||||
|
}, function () {
|
||||||
|
top.dialog.close(layIndex);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
initTable();
|
||||||
|
initDate();
|
||||||
|
// 事件 - 页面变化
|
||||||
|
$win.on('resize', function() {
|
||||||
|
clearTimeout(resizeTimeout);
|
||||||
|
resizeTimeout = setTimeout(function() {
|
||||||
|
reloadTable();
|
||||||
|
}, 500);
|
||||||
|
});
|
||||||
|
// 事件 - 搜索
|
||||||
|
$(document).on('click', '#search', function() {
|
||||||
|
reloadTable();
|
||||||
|
});
|
||||||
|
// 事件 - 增删改
|
||||||
|
table.on('toolbar(dataTable)', function(obj) {
|
||||||
|
var layEvent = obj.event;
|
||||||
|
var checkStatus = table.checkStatus('dataTable');
|
||||||
|
var checkDatas = checkStatus.data;
|
||||||
|
if(layEvent === 'saveEvent') {
|
||||||
|
layer.open({
|
||||||
|
type: 2,
|
||||||
|
title: false,
|
||||||
|
closeBtn: 0,
|
||||||
|
area: ['100%', '100%'],
|
||||||
|
shadeClose: true,
|
||||||
|
anim: 2,
|
||||||
|
content: top.restAjax.path('route/dynamicform/savedynamicform/{tableName}', [$('#tableName').val()]),
|
||||||
|
end: function() {
|
||||||
|
reloadTable();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else if(layEvent === 'updateEvent') {
|
||||||
|
if(checkDatas.length === 0) {
|
||||||
|
top.dialog.msg(top.dataMessage.table.selectEdit);
|
||||||
|
} else if(checkDatas.length > 1) {
|
||||||
|
top.dialog.msg(top.dataMessage.table.selectOneEdit);
|
||||||
|
} else {
|
||||||
|
layer.open({
|
||||||
|
type: 2,
|
||||||
|
title: false,
|
||||||
|
closeBtn: 0,
|
||||||
|
area: ['100%', '100%'],
|
||||||
|
shadeClose: true,
|
||||||
|
anim: 2,
|
||||||
|
content: top.restAjax.path('route/dynamicform/updatedynamicform/{tableName}/{uuidValue}', [$('#tableName').val(), checkDatas[0][$('#uuidField').val()]]),
|
||||||
|
end: function() {
|
||||||
|
reloadTable();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else if(layEvent === 'removeEvent') {
|
||||||
|
if(checkDatas.length === 0) {
|
||||||
|
top.dialog.msg(top.dataMessage.table.selectDelete);
|
||||||
|
} else {
|
||||||
|
var ids = '';
|
||||||
|
for(var i = 0, item; item = checkDatas[i++];) {
|
||||||
|
if(i > 1) {
|
||||||
|
ids += '_';
|
||||||
|
}
|
||||||
|
ids += item[$('#uuidField').val()];
|
||||||
|
}
|
||||||
|
removeData(ids);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -0,0 +1,112 @@
|
|||||||
|
package ${basePackage}.service.${lowerTableName};
|
||||||
|
|
||||||
|
import com.cm.common.exception.RemoveException;
|
||||||
|
import com.cm.common.exception.SaveException;
|
||||||
|
import com.cm.common.exception.SearchException;
|
||||||
|
import com.cm.common.pojo.ListPage;
|
||||||
|
import com.cm.common.result.SuccessResult;
|
||||||
|
import com.cm.common.result.SuccessResultData;
|
||||||
|
import com.cm.common.result.SuccessResultList;
|
||||||
|
import ${basePackage}.pojo.dtos.IdNameDTO;
|
||||||
|
import ${basePackage}.pojo.dtos.${lowerTableName}.${firstUpperTableName}DTO;
|
||||||
|
import ${basePackage}.pojo.vos.${lowerTableName}.${firstUpperTableName}VO;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName: I${firstUpperTableName}Service
|
||||||
|
* @Description: ${tableExplain}
|
||||||
|
* @Author: ${author}
|
||||||
|
* @Date: ${date}
|
||||||
|
* @Version: ${version}
|
||||||
|
**/
|
||||||
|
public interface I${firstUpperTableName}Service {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增${tableExplain}
|
||||||
|
*
|
||||||
|
* @param ${firstLowerTableName}VO
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
SuccessResult save${firstUpperTableName}(${firstUpperTableName}VO ${firstLowerTableName}VO) throws Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增${tableExplain}(APP)
|
||||||
|
*
|
||||||
|
* @param token
|
||||||
|
* @param ${firstLowerTableName}VO
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
SuccessResult save${firstUpperTableName}ByToken(String token, ${firstUpperTableName}VO ${firstLowerTableName}VO) throws Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除${tableExplain}
|
||||||
|
*
|
||||||
|
* @param ids
|
||||||
|
* @return
|
||||||
|
* @throws RemoveException
|
||||||
|
*/
|
||||||
|
SuccessResult remove${firstUpperTableName}(String ids) throws RemoveException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除${tableExplain}(APP)
|
||||||
|
*
|
||||||
|
* @param token
|
||||||
|
* @param ids
|
||||||
|
* @return
|
||||||
|
* @throws RemoveException
|
||||||
|
*/
|
||||||
|
SuccessResult remove${firstUpperTableName}ByToken(String token, String ids) throws RemoveException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改${tableExplain}
|
||||||
|
*
|
||||||
|
* @param ${firstLowerTableName}Id
|
||||||
|
* @param ${firstLowerTableName}VO
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
SuccessResult update${firstUpperTableName}(String ${firstLowerTableName}Id, ${firstUpperTableName}VO ${firstLowerTableName}VO) throws Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改${tableExplain}(APP)
|
||||||
|
*
|
||||||
|
* @param token
|
||||||
|
* @param ${firstLowerTableName}Id
|
||||||
|
* @param ${firstLowerTableName}VO
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
SuccessResult update${firstUpperTableName}ByToken(String token, String ${firstLowerTableName}Id, ${firstUpperTableName}VO ${firstLowerTableName}VO) throws Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ${tableExplain}详情(通过ID)
|
||||||
|
*
|
||||||
|
* @param ${firstLowerTableName}Id
|
||||||
|
* @return
|
||||||
|
* @throws SearchException
|
||||||
|
*/
|
||||||
|
${firstUpperTableName}DTO get${firstUpperTableName}ById(String ${firstLowerTableName}Id) throws SearchException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ${tableExplain}列表
|
||||||
|
*
|
||||||
|
* @param params
|
||||||
|
* @return
|
||||||
|
* @throws SearchException
|
||||||
|
*/
|
||||||
|
List<${firstUpperTableName}DTO> list${firstUpperTableName}(Map<String, Object> params) throws SearchException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ${tableExplain}分页列表
|
||||||
|
*
|
||||||
|
* @param page
|
||||||
|
* @return
|
||||||
|
* @throws SearchException
|
||||||
|
*/
|
||||||
|
SuccessResultList<List<${firstUpperTableName}DTO>> listPage${firstUpperTableName}(ListPage page) throws SearchException;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,146 @@
|
|||||||
|
package ${basePackage}.service.${lowerTableName}.impl;
|
||||||
|
|
||||||
|
import com.cm.common.exception.RemoveException;
|
||||||
|
import com.cm.common.exception.SaveException;
|
||||||
|
import com.cm.common.exception.SearchException;
|
||||||
|
import com.cm.common.pojo.ListPage;
|
||||||
|
import com.cm.common.result.SuccessResult;
|
||||||
|
import com.cm.common.result.SuccessResultList;
|
||||||
|
import com.cm.common.utils.HashMapUtil;
|
||||||
|
import com.cm.common.utils.UUIDUtil;
|
||||||
|
import ${basePackage}.dao.${lowerTableName}.I${firstUpperTableName}Dao;
|
||||||
|
import ${basePackage}.pojo.dtos.IdNameDTO;
|
||||||
|
import ${basePackage}.pojo.dtos.${lowerTableName}.${firstUpperTableName}DTO;
|
||||||
|
import ${basePackage}.pojo.vos.${lowerTableName}.${firstUpperTableName}VO;
|
||||||
|
import ${basePackage}.service.BaseService;
|
||||||
|
import ${basePackage}.service.${lowerTableName}.I${firstUpperTableName}Service;
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName: ${firstUpperTableName}ServiceImpl
|
||||||
|
* @Description: ${tableExplain}
|
||||||
|
* @Author: ${author}
|
||||||
|
* @Date: ${date}
|
||||||
|
* @Version: ${version}
|
||||||
|
**/
|
||||||
|
@Service
|
||||||
|
public class ${firstUpperTableName}ServiceImpl extends BaseService implements I${firstUpperTableName}Service {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private I${firstUpperTableName}Dao ${firstLowerTableName}Dao;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SuccessResult save${firstUpperTableName}(${firstUpperTableName}VO ${firstLowerTableName}VO) throws Exception {
|
||||||
|
save${firstUpperTableName}Info(null, ${firstLowerTableName}VO);
|
||||||
|
return new SuccessResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SuccessResult save${firstUpperTableName}ByToken(String token, ${firstUpperTableName}VO ${firstLowerTableName}VO) throws Exception {
|
||||||
|
save${firstUpperTableName}Info(token, ${firstLowerTableName}VO);
|
||||||
|
return new SuccessResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增${tableExplain}
|
||||||
|
*
|
||||||
|
* @param token
|
||||||
|
* @param ${firstLowerTableName}VO
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
private void save${firstUpperTableName}Info(String token, ${firstUpperTableName}VO ${firstLowerTableName}VO) throws Exception {
|
||||||
|
Map<String, Object> params = HashMapUtil.beanToMap(${firstLowerTableName}VO);
|
||||||
|
params.put("${firstLowerTableName}Id", UUIDUtil.getUUID());
|
||||||
|
if (token != null) {
|
||||||
|
setSaveInfo(token, params);
|
||||||
|
} else {
|
||||||
|
setSaveInfo(params);
|
||||||
|
}
|
||||||
|
${firstLowerTableName}Dao.save${firstUpperTableName}(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SuccessResult remove${firstUpperTableName}(String ids) throws RemoveException {
|
||||||
|
remove${firstUpperTableName}Info(null, ids)
|
||||||
|
return new SuccessResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SuccessResult remove${firstUpperTableName}ByToken(String token, String ids) throws RemoveException {
|
||||||
|
remove${firstUpperTableName}Info(token, ids)
|
||||||
|
return new SuccessResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除${tableExplain}
|
||||||
|
*
|
||||||
|
* @param token
|
||||||
|
* @param ids
|
||||||
|
*/
|
||||||
|
private void remove${firstUpperTableName}Info(token, ids) {
|
||||||
|
Map<String, Object> params = getHashMap(3);
|
||||||
|
params.put("${firstLowerTableName}Ids", Arrays.asList(ids.split("_")));
|
||||||
|
if (token != null) {
|
||||||
|
setUpdateInfo(token, params);
|
||||||
|
} else {
|
||||||
|
setUpdateInfo(params);
|
||||||
|
}
|
||||||
|
${firstLowerTableName}Dao.remove${firstUpperTableName}(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SuccessResult update${firstUpperTableName}(String ${firstLowerTableName}Id, ${firstUpperTableName}VO ${firstLowerTableName}VO) throws Exception {
|
||||||
|
update${firstUpperTableName}Info(null, ${firstLowerTableName}VO);
|
||||||
|
return new SuccessResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SuccessResult update${firstUpperTableName}(String ${firstLowerTableName}Id, ${firstUpperTableName}VO ${firstLowerTableName}VO) throws Exception {
|
||||||
|
update${firstUpperTableName}Info(token, ${firstLowerTableName}VO);
|
||||||
|
return new SuccessResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改${tableExplain}
|
||||||
|
*
|
||||||
|
* @param token
|
||||||
|
* @param ${firstLowerTableName}Id
|
||||||
|
* @param ${firstLowerTableName}VO
|
||||||
|
*/
|
||||||
|
private void update${firstUpperTableName}Info(String token, String ${firstLowerTableName}Id, ${firstUpperTableName}VO ${firstLowerTableName}VO) {
|
||||||
|
Map<String, Object> params = HashMapUtil.beanToMap(${firstLowerTableName}VO);
|
||||||
|
params.put("${firstLowerTableName}Id", ${firstLowerTableName}Id);
|
||||||
|
if (token != null) {
|
||||||
|
setUpdateInfo(token, params);
|
||||||
|
} else {
|
||||||
|
setUpdateInfo(params);
|
||||||
|
}
|
||||||
|
${firstLowerTableName}Dao.update${firstUpperTableName}(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ${firstUpperTableName}DTO get${firstUpperTableName}ById(String ${firstLowerTableName}Id) throws SearchException {
|
||||||
|
Map<String, Object> params = super.getHashMap(1);
|
||||||
|
params.put("${firstLowerTableName}Id", ${firstLowerTableName}Id);
|
||||||
|
return ${firstLowerTableName}Dao.get${firstUpperTableName}(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<${firstUpperTableName}DTO> list${firstUpperTableName}(Map<String, Object> params) throws SearchException {
|
||||||
|
return ${firstLowerTableName}Dao.list${firstUpperTableName}(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SuccessResultList<List<${firstUpperTableName}DTO>> listPage${firstUpperTableName}(ListPage page) throws SearchException {
|
||||||
|
PageHelper.startPage(page.getPage(), page.getRows());
|
||||||
|
List<${firstUpperTableName}DTO> ${firstLowerTableName}DTOs = ${firstLowerTableName}Dao.list${firstUpperTableName}(page.getParams());
|
||||||
|
PageInfo<${firstUpperTableName}DTO> pageInfo = new PageInfo<>(${firstLowerTableName}DTOs);
|
||||||
|
return new SuccessResultList<>(${firstLowerTableName}DTOs, pageInfo.getPageNum(), pageInfo.getTotal());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
CREATE TABLE `${tablePrefix}`.`${underLineTableName}`(
|
||||||
|
`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '自增主键',
|
||||||
|
`${underLineTableName}_id` CHAR(36) NOT NULL COMMENT '主键',
|
||||||
|
<#list fieldList! as field>
|
||||||
|
<#if field.fieldType == "number">
|
||||||
|
`${field.underLineFieldName}` INT(11)<#if field.fieldDefault!> DEFAULT ${field.fieldDefault}</#if> COMMENT '${field.fieldExplain}',
|
||||||
|
<#elseif field.fieldType == "double">
|
||||||
|
`${field.underLineFieldName}` DOUBLE(11, 2)<#if field.fieldDefault!> DEFAULT ${field.fieldDefault}</#if> COMMENT '${field.fieldExplain}',
|
||||||
|
<#elseif field.fieldType == "date">
|
||||||
|
`${field.underLineFieldName}` VARCHAR(40)<#if field.fieldDefault!> DEFAULT ${field.fieldDefault}</#if> COMMENT '${field.fieldExplain}',
|
||||||
|
<#elseif field.fieldType == "datetime">
|
||||||
|
`${field.underLineFieldName}` VARCHAR(50)<#if field.fieldDefault!> DEFAULT ${field.fieldDefault}</#if> COMMENT '${field.fieldExplain}',
|
||||||
|
<#elseif field.fieldType == "text">
|
||||||
|
`${field.underLineFieldName}` TEXT DEFAULT NULL<#if field.fieldDefault!> DEFAULT ${field.fieldDefault}</#if> COMMENT '${field.fieldExplain}',
|
||||||
|
<#elseif field.fieldType == "richText">
|
||||||
|
`${field.underLineFieldName}` LONGTEXT DEFAULT NULL<#if field.fieldDefault!> DEFAULT ${field.fieldDefault}</#if> COMMENT '${field.fieldExplain}',
|
||||||
|
<#elseif field.fieldType == "currentUser" || field.fieldType == "currentDepartment" || field.fieldType == "currentRole" || field.fieldType == "currentGroup" || field.fieldType == "currentPosition">
|
||||||
|
`${field.underLineFieldName}` VARCHAR(500) DEFAULT NULL<#if field.fieldDefault!> DEFAULT ${field.fieldDefault}</#if> COMMENT '${field.fieldExplain}',
|
||||||
|
<#else>
|
||||||
|
`${field.underLineFieldName}` VARCHAR(255)<#if field.fieldDefault!> DEFAULT ${field.fieldDefault}</#if> COMMENT '${field.fieldExplain}',
|
||||||
|
</#if>
|
||||||
|
</#list>
|
||||||
|
`creator` CHAR(36) DEFAULT NULL,
|
||||||
|
`gmt_create` datetime DEFAULT NULL,
|
||||||
|
`modifier` CHAR(36) DEFAULT NULL,
|
||||||
|
`gmt_modified` datetime DEFAULT NULL,
|
||||||
|
`is_delete` int(1) DEFAULT '0',
|
||||||
|
PRIMARY KEY (`id`, `${underLineTableName}_id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
@ -225,7 +225,7 @@
|
|||||||
|
|
||||||
// 初始化
|
// 初始化
|
||||||
function initData() {
|
function initData() {
|
||||||
for(var i = 0, item = formFieldList[i]; item = formFieldList[i++];) {
|
for(var i = 0, item; item = formFieldList[i++];) {
|
||||||
if(item.fieldType === 'date') {
|
if(item.fieldType === 'date') {
|
||||||
laydate.render({
|
laydate.render({
|
||||||
elem: '#'+ item.fieldName,
|
elem: '#'+ item.fieldName,
|
||||||
|
@ -235,7 +235,7 @@
|
|||||||
}
|
}
|
||||||
form.val('dataForm', dataFormData);
|
form.val('dataForm', dataFormData);
|
||||||
// 处理checkbox
|
// 处理checkbox
|
||||||
for(var i = 0, item = formFieldList[i]; item = formFieldList[i++];) {
|
for(var i = 0, item; item = formFieldList[i++];) {
|
||||||
if(item.fieldType === 'checkbox') {
|
if(item.fieldType === 'checkbox') {
|
||||||
if(typeof(data[item.fieldName]) === 'undefined') {
|
if(typeof(data[item.fieldName]) === 'undefined') {
|
||||||
continue;
|
continue;
|
||||||
@ -470,50 +470,35 @@
|
|||||||
} else if(item.fieldType === 'currentUser') {
|
} else if(item.fieldType === 'currentUser') {
|
||||||
var formData = {};
|
var formData = {};
|
||||||
var idAndNameValue = dataFormData[item.fieldName];
|
var idAndNameValue = dataFormData[item.fieldName];
|
||||||
var nameValue = idAndNameValue != null && idAndNameValue != '' ? idAndNameValue.split('|')[1] : '';
|
var nameValue = (typeof(idAndNameValue) != 'undefined' && idAndNameValue != null && idAndNameValue != '') ? idAndNameValue.split('|')[1] : '';
|
||||||
if(nameValue === '') {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
formData[item.fieldName] = idAndNameValue;
|
formData[item.fieldName] = idAndNameValue;
|
||||||
formData[item.fieldName +'CurrentUser'] = nameValue;
|
formData[item.fieldName +'CurrentUser'] = nameValue;
|
||||||
form.val('dataForm', formData);
|
form.val('dataForm', formData);
|
||||||
} else if(item.fieldType === 'currentDepartment') {
|
} else if(item.fieldType === 'currentDepartment') {
|
||||||
var formData = {};
|
var formData = {};
|
||||||
var idAndNameValue = dataFormData[item.fieldName];
|
var idAndNameValue = dataFormData[item.fieldName];
|
||||||
var nameValue = idAndNameValue != null && idAndNameValue != '' ? idAndNameValue.split('|')[1] : '';
|
var nameValue = (typeof(idAndNameValue) != 'undefined' && idAndNameValue != null && idAndNameValue != '') ? idAndNameValue.split('|')[1] : '';
|
||||||
if(nameValue === '') {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
formData[item.fieldName] = idAndNameValue;
|
formData[item.fieldName] = idAndNameValue;
|
||||||
formData[item.fieldName +'CurrentDepartment'] = nameValue;
|
formData[item.fieldName +'CurrentDepartment'] = nameValue;
|
||||||
form.val('dataForm', formData);
|
form.val('dataForm', formData);
|
||||||
} else if(item.fieldType === 'currentRole') {
|
} else if(item.fieldType === 'currentRole') {
|
||||||
var formData = {};
|
var formData = {};
|
||||||
var idAndNameValue = dataFormData[item.fieldName];
|
var idAndNameValue = dataFormData[item.fieldName];
|
||||||
var nameValue = idAndNameValue != null && idAndNameValue != '' ? idAndNameValue.split('|')[1] : '';
|
var nameValue = (typeof(idAndNameValue) != 'undefined' && idAndNameValue != null && idAndNameValue != '') ? idAndNameValue.split('|')[1] : '';
|
||||||
if(nameValue === '') {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
formData[item.fieldName] = idAndNameValue;
|
formData[item.fieldName] = idAndNameValue;
|
||||||
formData[item.fieldName +'CurrentRole'] = nameValue;
|
formData[item.fieldName +'CurrentRole'] = nameValue;
|
||||||
form.val('dataForm', formData);
|
form.val('dataForm', formData);
|
||||||
} else if(item.fieldType === 'currentGroup') {
|
} else if(item.fieldType === 'currentGroup') {
|
||||||
var formData = {};
|
var formData = {};
|
||||||
var idAndNameValue = dataFormData[item.fieldName];
|
var idAndNameValue = dataFormData[item.fieldName];
|
||||||
var nameValue = idAndNameValue != null && idAndNameValue != '' ? idAndNameValue.split('|')[1] : '';
|
var nameValue = (typeof(idAndNameValue) != 'undefined' && idAndNameValue != null && idAndNameValue != '') ? idAndNameValue.split('|')[1] : '';
|
||||||
if(nameValue === '') {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
formData[item.fieldName] = idAndNameValue;
|
formData[item.fieldName] = idAndNameValue;
|
||||||
formData[item.fieldName +'CurrentGroup'] = nameValue;
|
formData[item.fieldName +'CurrentGroup'] = nameValue;
|
||||||
form.val('dataForm', formData);
|
form.val('dataForm', formData);
|
||||||
} else if(item.fieldType === 'currentPosition') {
|
} else if(item.fieldType === 'currentPosition') {
|
||||||
var formData = {};
|
var formData = {};
|
||||||
var idAndNameValue = dataFormData[item.fieldName];
|
var idAndNameValue = dataFormData[item.fieldName];
|
||||||
var nameValue = idAndNameValue != null && idAndNameValue != '' ? idAndNameValue.split('|')[1] : '';
|
var nameValue = (typeof(idAndNameValue) != 'undefined' && idAndNameValue != null && idAndNameValue != '') ? idAndNameValue.split('|')[1] : '';
|
||||||
if(nameValue === '') {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
formData[item.fieldName] = idAndNameValue;
|
formData[item.fieldName] = idAndNameValue;
|
||||||
formData[item.fieldName +'CurrentPosition'] = nameValue;
|
formData[item.fieldName +'CurrentPosition'] = nameValue;
|
||||||
form.val('dataForm', formData);
|
form.val('dataForm', formData);
|
||||||
|
@ -248,7 +248,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
form.render(null, 'dataForm');
|
form.render(null, 'dataForm');
|
||||||
for(var i = 0, item = formFieldList[i]; item = formFieldList[i++];) {
|
for(var i = 0, item; item = formFieldList[i++];) {
|
||||||
if(item.fieldType === 'date') {
|
if(item.fieldType === 'date') {
|
||||||
laydate.render({
|
laydate.render({
|
||||||
elem: '#'+ item.fieldName,
|
elem: '#'+ item.fieldName,
|
||||||
@ -469,51 +469,35 @@
|
|||||||
} else if(item.fieldType === 'currentUser') {
|
} else if(item.fieldType === 'currentUser') {
|
||||||
var formData = {};
|
var formData = {};
|
||||||
var idAndNameValue = dataFormData[item.fieldName];
|
var idAndNameValue = dataFormData[item.fieldName];
|
||||||
console.log(idAndNameValue)
|
var nameValue = (typeof(idAndNameValue) != 'undefined' && idAndNameValue != null && idAndNameValue != '') ? idAndNameValue.split('|')[1] : '';
|
||||||
var nameValue = idAndNameValue != null && idAndNameValue != '' ? idAndNameValue.split('|')[1] : '';
|
|
||||||
if(nameValue === '') {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
formData[item.fieldName] = idAndNameValue;
|
formData[item.fieldName] = idAndNameValue;
|
||||||
formData[item.fieldName +'CurrentUser'] = nameValue;
|
formData[item.fieldName +'CurrentUser'] = nameValue;
|
||||||
form.val('dataForm', formData);
|
form.val('dataForm', formData);
|
||||||
} else if(item.fieldType === 'currentDepartment') {
|
} else if(item.fieldType === 'currentDepartment') {
|
||||||
var formData = {};
|
var formData = {};
|
||||||
var idAndNameValue = dataFormData[item.fieldName];
|
var idAndNameValue = dataFormData[item.fieldName];
|
||||||
var nameValue = idAndNameValue != null && idAndNameValue != '' ? idAndNameValue.split('|')[1] : '';
|
var nameValue = (typeof(idAndNameValue) != 'undefined' && idAndNameValue != null && idAndNameValue != '') ? idAndNameValue.split('|')[1] : '';
|
||||||
if(nameValue === '') {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
formData[item.fieldName] = idAndNameValue;
|
formData[item.fieldName] = idAndNameValue;
|
||||||
formData[item.fieldName +'CurrentDepartment'] = nameValue;
|
formData[item.fieldName +'CurrentDepartment'] = nameValue;
|
||||||
form.val('dataForm', formData);
|
form.val('dataForm', formData);
|
||||||
} else if(item.fieldType === 'currentRole') {
|
} else if(item.fieldType === 'currentRole') {
|
||||||
var formData = {};
|
var formData = {};
|
||||||
var idAndNameValue = dataFormData[item.fieldName];
|
var idAndNameValue = dataFormData[item.fieldName];
|
||||||
var nameValue = idAndNameValue != null && idAndNameValue != '' ? idAndNameValue.split('|')[1] : '';
|
var nameValue = (typeof(idAndNameValue) != 'undefined' && idAndNameValue != null && idAndNameValue != '') ? idAndNameValue.split('|')[1] : '';
|
||||||
if(nameValue === '') {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
formData[item.fieldName] = idAndNameValue;
|
formData[item.fieldName] = idAndNameValue;
|
||||||
formData[item.fieldName +'CurrentRole'] = nameValue;
|
formData[item.fieldName +'CurrentRole'] = nameValue;
|
||||||
form.val('dataForm', formData);
|
form.val('dataForm', formData);
|
||||||
} else if(item.fieldType === 'currentGroup') {
|
} else if(item.fieldType === 'currentGroup') {
|
||||||
var formData = {};
|
var formData = {};
|
||||||
var idAndNameValue = dataFormData[item.fieldName];
|
var idAndNameValue = dataFormData[item.fieldName];
|
||||||
var nameValue = idAndNameValue != null && idAndNameValue != '' ? idAndNameValue.split('|')[1] : '';
|
var nameValue = (typeof(idAndNameValue) != 'undefined' && idAndNameValue != null && idAndNameValue != '') ? idAndNameValue.split('|')[1] : '';
|
||||||
if(nameValue === '') {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
formData[item.fieldName] = idAndNameValue;
|
formData[item.fieldName] = idAndNameValue;
|
||||||
formData[item.fieldName +'CurrentGroup'] = nameValue;
|
formData[item.fieldName +'CurrentGroup'] = nameValue;
|
||||||
form.val('dataForm', formData);
|
form.val('dataForm', formData);
|
||||||
} else if(item.fieldType === 'currentPosition') {
|
} else if(item.fieldType === 'currentPosition') {
|
||||||
var formData = {};
|
var formData = {};
|
||||||
var idAndNameValue = dataFormData[item.fieldName];
|
var idAndNameValue = dataFormData[item.fieldName];
|
||||||
var nameValue = idAndNameValue != null && idAndNameValue != '' ? idAndNameValue.split('|')[1] : '';
|
var nameValue = (typeof(idAndNameValue) != 'undefined' && idAndNameValue != null && idAndNameValue != '') ? idAndNameValue.split('|')[1] : '';
|
||||||
if(nameValue === '') {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
formData[item.fieldName] = idAndNameValue;
|
formData[item.fieldName] = idAndNameValue;
|
||||||
formData[item.fieldName +'CurrentPosition'] = nameValue;
|
formData[item.fieldName +'CurrentPosition'] = nameValue;
|
||||||
form.val('dataForm', formData);
|
form.val('dataForm', formData);
|
||||||
|
Loading…
Reference in New Issue
Block a user