处理问题

This commit is contained in:
wanggeng888 2021-03-15 19:02:07 +08:00
parent 9db10a9a58
commit 69bdcf451a
12 changed files with 103 additions and 91 deletions

View File

@ -3,6 +3,7 @@ package ink.wgink.code.factory.factory;
import com.sun.deploy.uitoolkit.impl.fx.ui.FXUIFactory; import com.sun.deploy.uitoolkit.impl.fx.ui.FXUIFactory;
import ink.wgink.code.factory.vos.FieldVO; import ink.wgink.code.factory.vos.FieldVO;
import javafx.beans.property.ReadOnlyObjectWrapper; import javafx.beans.property.ReadOnlyObjectWrapper;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue; import javafx.beans.value.ObservableValue;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader; import javafx.fxml.FXMLLoader;
@ -34,6 +35,7 @@ public class CheckBoxTableCellFactory implements Callback<TableColumn.CellDataFe
@Override @Override
public ObservableValue<CheckBox> call(TableColumn.CellDataFeatures<FieldVO, String> param) { public ObservableValue<CheckBox> call(TableColumn.CellDataFeatures<FieldVO, String> param) {
FieldVO fieldVO = param.getValue();
CheckBox checkBox = new CheckBox(); CheckBox checkBox = new CheckBox();
if (StringUtils.equals(IS_FORM_SHOW, property)) { if (StringUtils.equals(IS_FORM_SHOW, property)) {
Boolean isFormShow = param.getValue().getFormShow(); Boolean isFormShow = param.getValue().getFormShow();
@ -47,6 +49,17 @@ public class CheckBoxTableCellFactory implements Callback<TableColumn.CellDataFe
Boolean isNotNull = param.getValue().getNotNull(); Boolean isNotNull = param.getValue().getNotNull();
checkBox.setSelected(isNotNull == null || !isNotNull ? false : true); checkBox.setSelected(isNotNull == null || !isNotNull ? false : true);
} }
checkBox.selectedProperty().addListener((observable, oldValue, newValue) -> {
if (StringUtils.equals(IS_FORM_SHOW, property)) {
fieldVO.setFormShow(newValue);
}
if (StringUtils.equals(IS_LIST_SHOW, property)) {
fieldVO.setListShow(newValue);
}
if (StringUtils.equals(IS_NOT_NULL, property)) {
fieldVO.setNotNull(newValue);
}
});
return new ReadOnlyObjectWrapper<>(checkBox); return new ReadOnlyObjectWrapper<>(checkBox);
} }
} }

View File

@ -110,10 +110,10 @@ public class GenerateService {
mySqlMapperCode("/normal/mapper/mysql-mapper.ftl", String.format("%s/mapper/%s", outFolder, tableName), tableName, dataModel); mySqlMapperCode("/normal/mapper/mysql-mapper.ftl", String.format("%s/mapper/%s", outFolder, tableName), tableName, dataModel);
} }
if (generateVO.getHasHtml()) { if (generateVO.getHasHtml()) {
htmlCode("/normal/page", String.format("%s/route/%s", outFolder, tableName), tableName, dataModel); htmlCode("/normal/page", String.format("%s/static/route/%s", outFolder, tableName), tableName, dataModel);
} }
if (generateVO.getHasThymeleaf()) { if (generateVO.getHasThymeleaf()) {
thymeleafCode("/normal/page", String.format("%s/route/%s", outFolder, tableName), tableName, dataModel); thymeleafCode("/normal/page", String.format("%s/templates/%s", outFolder, tableName), tableName, dataModel);
} }
if (generateVO.getHasRoute()) { if (generateVO.getHasRoute()) {
routeCode("/normal/controller/route-controller.ftl", String.format("%s/controller/route/%s", outFolder, lowerTableName), firstUpperTableName, dataModel); routeCode("/normal/controller/route-controller.ftl", String.format("%s/controller/route/%s", outFolder, lowerTableName), firstUpperTableName, dataModel);

View File

@ -2,16 +2,14 @@ package ${codePackage}.controller.api.${lowerTableName};
import ink.wgink.annotation.CheckRequestBodyAnnotation; import ink.wgink.annotation.CheckRequestBodyAnnotation;
import ink.wgink.common.base.DefaultBaseController; import ink.wgink.common.base.DefaultBaseController;
import com.cm.common.constants.ISystemConstant; import ink.wgink.interfaces.consts.ISystemConstant;
import com.cm.common.pojo.ListPage; import ink.wgink.pojo.ListPage;
import com.cm.common.result.ErrorResult; import ink.wgink.pojo.result.ErrorResult;
import com.cm.common.result.SuccessResult; import ink.wgink.pojo.result.SuccessResult;
import com.cm.common.result.SuccessResultData; import ink.wgink.pojo.result.SuccessResultData;
import com.cm.common.result.SuccessResultList; import ink.wgink.pojo.result.SuccessResultList;
import ${codePackage}.pojo.dtos.${lowerTableName}.${firstUpperTableName}DTO; import ${codePackage}.pojo.dtos.${lowerTableName}.${firstUpperTableName}DTO;
import ${codePackage}.pojo.vos.${lowerTableName}.${firstUpperTableName}VO; import ${codePackage}.pojo.vos.${lowerTableName}.${firstUpperTableName}VO;
import ${codePackage}.pojo.vos.${lowerTableName}.${firstUpperTableName}BO;
import ${codePackage}.pojo.vos.${lowerTableName}.${firstUpperTableName}PO;
import ${codePackage}.service.${lowerTableName}.I${firstUpperTableName}Service; import ${codePackage}.service.${lowerTableName}.I${firstUpperTableName}Service;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -52,7 +50,7 @@ public class ${firstUpperTableName}Controller extends DefaultBaseController {
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@DeleteMapping("remove/{ids}") @DeleteMapping("remove/{ids}")
public SuccessResult remove(@PathVariable("ids") String ids) { public SuccessResult remove(@PathVariable("ids") String ids) {
${firstLowerTableName}Service.remove(ids); ${firstLowerTableName}Service.remove(Arrays.asList(ids.split("\\_")));
return new SuccessResult(); return new SuccessResult();
} }

View File

@ -2,12 +2,12 @@ package ${codePackage}.controller.app.api.${lowerTableName};
import ink.wgink.annotation.CheckRequestBodyAnnotation; import ink.wgink.annotation.CheckRequestBodyAnnotation;
import ink.wgink.common.base.DefaultBaseController; import ink.wgink.common.base.DefaultBaseController;
import com.cm.common.constants.ISystemConstant; import ink.wgink.interfaces.consts.ISystemConstant;
import com.cm.common.pojo.ListPage; import ink.wgink.pojo.ListPage;
import com.cm.common.result.ErrorResult; import ink.wgink.pojo.result.ErrorResult;
import com.cm.common.result.SuccessResult; import ink.wgink.pojo.result.SuccessResult;
import com.cm.common.result.SuccessResultData; import ink.wgink.pojo.result.SuccessResultData;
import com.cm.common.result.SuccessResultList; import ink.wgink.pojo.result.SuccessResultList;
import ${codePackage}.pojo.dtos.${lowerTableName}.${firstUpperTableName}DTO; import ${codePackage}.pojo.dtos.${lowerTableName}.${firstUpperTableName}DTO;
import ${codePackage}.pojo.vos.${lowerTableName}.${firstUpperTableName}VO; import ${codePackage}.pojo.vos.${lowerTableName}.${firstUpperTableName}VO;
import ${codePackage}.service.${lowerTableName}.I${firstUpperTableName}Service; import ${codePackage}.service.${lowerTableName}.I${firstUpperTableName}Service;
@ -54,7 +54,7 @@ public class ${firstUpperTableName}AppController extends DefaultBaseController {
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@DeleteMapping("remove/{ids}") @DeleteMapping("remove/{ids}")
public SuccessResult remove(@RequestHeader("token") String token, @PathVariable("ids") String ids) { public SuccessResult remove(@RequestHeader("token") String token, @PathVariable("ids") String ids) {
${firstLowerTableName}Service.remove(token, ids); ${firstLowerTableName}Service.remove(token, Arrays.asList(ids.split("\\_")));
return new SuccessResult(); return new SuccessResult();
} }
@ -104,7 +104,7 @@ public class ${firstUpperTableName}AppController extends DefaultBaseController {
}) })
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listpage${lowerTableName}") @GetMapping("listpage${lowerTableName}")
public SuccessResultList<List<${firstUpperTableName}DTO>> listPage(@RequestHeader("token") String token, ListPage page) throws SearchException { public SuccessResultList<List<${firstUpperTableName}DTO>> listPage(@RequestHeader("token") String token, ListPage page) {
Map<String, Object> params = requestParams(); Map<String, Object> params = requestParams();
page.setParams(params); page.setParams(params);
return ${firstLowerTableName}Service.listPage(page); return ${firstLowerTableName}Service.listPage(page);
@ -113,9 +113,9 @@ public class ${firstUpperTableName}AppController extends DefaultBaseController {
@ApiOperation(value = "${tableExplain}统计", notes = "${tableExplain}统计接口") @ApiOperation(value = "${tableExplain}统计", notes = "${tableExplain}统计接口")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("count") @GetMapping("count")
SuccessResultData<Integer> count() throws SearchException { SuccessResultData<Integer> count() {
Map<String, Object> params = requestParams(); Map<String, Object> params = requestParams();
return return new SuccessResultData<>(${firstLowerTableName}Service.count(params)); return new SuccessResultData<>(${firstLowerTableName}Service.count(params));
} }
} }

View File

@ -2,12 +2,12 @@ package ${codePackage}.controller.resource.${lowerTableName};
import ink.wgink.annotation.CheckRequestBodyAnnotation; import ink.wgink.annotation.CheckRequestBodyAnnotation;
import ink.wgink.common.base.DefaultBaseController; import ink.wgink.common.base.DefaultBaseController;
import com.cm.common.constants.ISystemConstant; import ink.wgink.interfaces.consts.ISystemConstant;
import com.cm.common.pojo.ListPage; import ink.wgink.pojo.ListPage;
import com.cm.common.result.ErrorResult; import ink.wgink.pojo.result.ErrorResult;
import com.cm.common.result.SuccessResult; import ink.wgink.pojo.result.SuccessResult;
import com.cm.common.result.SuccessResultData; import ink.wgink.pojo.result.SuccessResultData;
import com.cm.common.result.SuccessResultList; import ink.wgink.pojo.result.SuccessResultList;
import ${codePackage}.pojo.dtos.${lowerTableName}.${firstUpperTableName}DTO; import ${codePackage}.pojo.dtos.${lowerTableName}.${firstUpperTableName}DTO;
import ${codePackage}.pojo.vos.${lowerTableName}.${firstUpperTableName}VO; import ${codePackage}.pojo.vos.${lowerTableName}.${firstUpperTableName}VO;
import ${codePackage}.service.${lowerTableName}.I${firstUpperTableName}Service; import ${codePackage}.service.${lowerTableName}.I${firstUpperTableName}Service;
@ -54,7 +54,7 @@ public class ${firstUpperTableName}ResourceController extends DefaultBaseControl
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@DeleteMapping("remove/{ids}") @DeleteMapping("remove/{ids}")
public SuccessResult remove(@PathVariable("ids") String ids) { public SuccessResult remove(@PathVariable("ids") String ids) {
${firstLowerTableName}Service.remove(ids); ${firstLowerTableName}Service.remove(Arrays.asList(ids.split("\\_")));
return new SuccessResult(); return new SuccessResult();
} }
@ -104,7 +104,7 @@ public class ${firstUpperTableName}ResourceController extends DefaultBaseControl
}) })
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listpage") @GetMapping("listpage")
public SuccessResultList<List<${firstUpperTableName}DTO>> listPage(ListPage page) throws SearchException { public SuccessResultList<List<${firstUpperTableName}DTO>> listPage(ListPage page) {
Map<String, Object> params = requestParams(); Map<String, Object> params = requestParams();
page.setParams(params); page.setParams(params);
return ${firstLowerTableName}Service.listPage(page); return ${firstLowerTableName}Service.listPage(page);
@ -113,9 +113,9 @@ public class ${firstUpperTableName}ResourceController extends DefaultBaseControl
@ApiOperation(value = "${tableExplain}统计", notes = "${tableExplain}统计接口") @ApiOperation(value = "${tableExplain}统计", notes = "${tableExplain}统计接口")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("count") @GetMapping("count")
SuccessResultData<Integer> count() throws SearchException { SuccessResultData<Integer> count() {
Map<String, Object> params = requestParams(); Map<String, Object> params = requestParams();
return return new SuccessResultData<>(${firstLowerTableName}Service.count(params)); return new SuccessResultData<>(${firstLowerTableName}Service.count(params));
} }
} }

View File

@ -1,14 +1,12 @@
package ${codePackage}.controller.api.${lowerTableName}; package ${codePackage}.controller.route.${lowerTableName};
import ink.wgink.common.base.DefaultBaseController; import ink.wgink.common.base.DefaultBaseController;
import ${codePackage}.pojo.dtos.${lowerTableName}.${firstUpperTableName}DTO; import ink.wgink.interfaces.consts.ISystemConstant;
import ${codePackage}.pojo.vos.${lowerTableName}.${firstUpperTableName}VO;
import ${codePackage}.pojo.vos.${lowerTableName}.${firstUpperTableName}BO;
import ${codePackage}.pojo.vos.${lowerTableName}.${firstUpperTableName}PO;
import ${codePackage}.service.${lowerTableName}.I${firstUpperTableName}Service; import ${codePackage}.service.${lowerTableName}.I${firstUpperTableName}Service;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
@ -24,7 +22,7 @@ import java.util.Map;
@Api(tags = ISystemConstant.ROUTE_TAGS_PREFIX + "${tableExplain}路由") @Api(tags = ISystemConstant.ROUTE_TAGS_PREFIX + "${tableExplain}路由")
@RestController @RestController
@RequestMapping(ISystemConstant.ROUTE_PREFIX + "/${lowerTableName}") @RequestMapping(ISystemConstant.ROUTE_PREFIX + "/${lowerTableName}")
public class ${firstUpperTableName}Controller extends DefaultBaseController { public class ${firstUpperTableName}RouteController extends DefaultBaseController {
@GetMapping("save") @GetMapping("save")
public ModelAndView save() { public ModelAndView save() {

View File

@ -4,8 +4,8 @@ import ink.wgink.exceptions.RemoveException;
import ink.wgink.exceptions.SaveException; import ink.wgink.exceptions.SaveException;
import ink.wgink.exceptions.SearchException; import ink.wgink.exceptions.SearchException;
import ink.wgink.exceptions.UpdateException; import ink.wgink.exceptions.UpdateException;
import ${codePackage}.pojo.vos.${lowerTableName}.${firstUpperTableName}BO; import ${codePackage}.pojo.bos.${lowerTableName}.${firstUpperTableName}BO;
import ${codePackage}.pojo.vos.${lowerTableName}.${firstUpperTableName}PO; import ${codePackage}.pojo.pos.${lowerTableName}.${firstUpperTableName}PO;
import ${codePackage}.pojo.dtos.${lowerTableName}.${firstUpperTableName}DTO; import ${codePackage}.pojo.dtos.${lowerTableName}.${firstUpperTableName}DTO;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;

View File

@ -15,24 +15,26 @@ import io.swagger.annotations.ApiModelProperty;
public class ${firstUpperTableName}DTO { public class ${firstUpperTableName}DTO {
<#list fieldList! as field> <#list fieldList! as field>
<#if field.listShow>
<#if field.formFieldValue == "number"> <#if field.formFieldValue == "number">
@ApiModelProperty(name = "${field.propertyName}", value = "${field.columnComment}") @ApiModelProperty(name = "${field.propertyName}", value = "${field.columnComment}")
private Integer ${field.propertyName}; private Integer ${field.propertyName};
<#elseif field.formFieldValue == "double"> <#elseif field.formFieldValue == "double">
@ApiModelProperty(name = "${field.propertyName}", value = "${field.columnComment}") @ApiModelProperty(name = "${field.propertyName}", value = "${field.columnComment}")
private Double ${field.propertyName}; private Double ${field.propertyName};
<#elseif field.formFieldValue == "radio" || field.formFieldValue == "checkbox" || field.formFieldValue == "select"> <#elseif field.formFieldValue == "radio" || field.formFieldValue == "checkbox" || field.formFieldValue == "select">
@ApiModelProperty(name = "${field.propertyName}", value = "${field.columnComment}") @ApiModelProperty(name = "${field.propertyName}", value = "${field.columnComment}")
private String ${field.propertyName}; private String ${field.propertyName};
<#else> <#else>
@ApiModelProperty(name = "${field.propertyName}", value = "${field.columnComment}") @ApiModelProperty(name = "${field.propertyName}", value = "${field.columnComment}")
private String ${field.propertyName}; private String ${field.propertyName};
</#if>
</#if> </#if>
</#list> </#list>
<#list fieldList! as field> <#list fieldList! as field>
<#if field.formFieldValue == "number"> <#if field.listShow>
<#if field.formFieldValue == "number">
public Integer get${field.firstUpperPropertyName}() { public Integer get${field.firstUpperPropertyName}() {
return ${field.propertyName} == null ? 0 : ${field.propertyName}; return ${field.propertyName} == null ? 0 : ${field.propertyName};
} }
@ -41,7 +43,7 @@ public class ${firstUpperTableName}DTO {
this.${field.propertyName} = ${field.propertyName}; this.${field.propertyName} = ${field.propertyName};
} }
<#elseif field.formFieldValue == "double"> <#elseif field.formFieldValue == "double">
public Double get${field.firstUpperPropertyName}() { public Double get${field.firstUpperPropertyName}() {
return ${field.propertyName} == null ? 0D : ${field.propertyName}; return ${field.propertyName} == null ? 0D : ${field.propertyName};
} }
@ -50,7 +52,7 @@ public class ${firstUpperTableName}DTO {
this.${field.propertyName} = ${field.propertyName}; this.${field.propertyName} = ${field.propertyName};
} }
<#elseif field.formFieldValue == "radio" || field.formFieldValue == "checkbox" || field.formFieldValue == "select"> <#elseif field.formFieldValue == "radio" || field.formFieldValue == "checkbox" || field.formFieldValue == "select">
public String get${field.firstUpperPropertyName}() { public String get${field.firstUpperPropertyName}() {
return ${field.propertyName} == null ? "" : ${field.propertyName}.trim(); return ${field.propertyName} == null ? "" : ${field.propertyName}.trim();
} }
@ -59,7 +61,7 @@ public class ${firstUpperTableName}DTO {
this.${field.propertyName} = ${field.propertyName}; this.${field.propertyName} = ${field.propertyName};
} }
<#else> <#else>
public String get${field.firstUpperPropertyName}() { public String get${field.firstUpperPropertyName}() {
return ${field.propertyName} == null ? "" : ${field.propertyName}.trim(); return ${field.propertyName} == null ? "" : ${field.propertyName}.trim();
} }
@ -68,6 +70,7 @@ public class ${firstUpperTableName}DTO {
this.${field.propertyName} = ${field.propertyName}; this.${field.propertyName} = ${field.propertyName};
} }
</#if>
</#if> </#if>
</#list> </#list>

View File

@ -8,7 +8,6 @@ package ${codePackage}.pojo.pos.${lowerTableName};
* @Date: ${date} * @Date: ${date}
* @Version: ${version} * @Version: ${version}
**/ **/
@ApiModel
public class ${firstUpperTableName}PO { public class ${firstUpperTableName}PO {
<#list fieldList! as field> <#list fieldList! as field>

View File

@ -17,47 +17,50 @@ import io.swagger.annotations.ApiModelProperty;
public class ${firstUpperTableName}VO { public class ${firstUpperTableName}VO {
<#list fieldList! as field> <#list fieldList! as field>
<#if field.formShow>
@ApiModelProperty(name = "${field.propertyName}", value = "${field.columnComment}") @ApiModelProperty(name = "${field.propertyName}", value = "${field.columnComment}")
<#if field.formFieldValue == "number"> <#if field.formFieldValue == "number">
@CheckNumberAnnotation(name = "${field.columnComment}") @CheckNumberAnnotation(name = "${field.columnComment}")
private Integer ${field.propertyName}; private Integer ${field.propertyName};
<#elseif field.formFieldValue == "double"> <#elseif field.formFieldValue == "double">
@CheckNumberAnnotation(name = "${field.columnComment}") @CheckNumberAnnotation(name = "${field.columnComment}")
private Double ${field.propertyName}; private Double ${field.propertyName};
<#elseif field.formFieldValue == "date"> <#elseif field.formFieldValue == "date">
@CheckEmptyAnnotation(name = "${field.columnComment}", verifyType = "date") @CheckEmptyAnnotation(name = "${field.columnComment}", verifyType = "date")
private String ${field.propertyName}; private String ${field.propertyName};
<#elseif field.formFieldValue == "datetime"> <#elseif field.formFieldValue == "datetime">
@CheckEmptyAnnotation(name = "${field.columnComment}", verifyType = "datetime") @CheckEmptyAnnotation(name = "${field.columnComment}", verifyType = "datetime")
private String ${field.propertyName}; private String ${field.propertyName};
<#else> <#else>
<#if field.formFieldValue == "string"> <#if field.formFieldValue == "string">
<#if field.verifyType?? && field.verifyType != "none"> <#if field.verifyType?? && field.verifyType != "none">
<#if field.verifyType == "phone"> <#if field.verifyType == "phone">
@CheckEmptyAnnotation(name = "${field.columnComment}", verifyType = "phone") @CheckEmptyAnnotation(name = "${field.columnComment}", verifyType = "phone")
<#elseif field.verifyType == "email"> <#elseif field.verifyType == "email">
@CheckEmptyAnnotation(name = "${field.columnComment}", verifyType = "email") @CheckEmptyAnnotation(name = "${field.columnComment}", verifyType = "email")
<#elseif field.verifyType == "url"> <#elseif field.verifyType == "url">
@CheckEmptyAnnotation(name = "${field.columnComment}", verifyType = "url") @CheckEmptyAnnotation(name = "${field.columnComment}", verifyType = "url")
<#elseif field.verifyType == "number"> <#elseif field.verifyType == "number">
@CheckEmptyAnnotation(name = "${field.columnComment}", verifyType = "number") @CheckEmptyAnnotation(name = "${field.columnComment}", verifyType = "number")
<#elseif field.verifyType == "date"> <#elseif field.verifyType == "date">
@CheckEmptyAnnotation(name = "${field.columnComment}", verifyType = "date") @CheckEmptyAnnotation(name = "${field.columnComment}", verifyType = "date")
<#elseif field.verifyType == "identity"> <#elseif field.verifyType == "identity">
@CheckEmptyAnnotation(name = "${field.columnComment}", verifyType = "identity") @CheckEmptyAnnotation(name = "${field.columnComment}", verifyType = "identity")
<#elseif field.verifyType == "custom"> <#elseif field.verifyType == "custom">
@CheckEmptyAnnotation(name = "${field.columnComment}", verifyType = "custom", regex = "${field.verifyType}") @CheckEmptyAnnotation(name = "${field.columnComment}", verifyType = "custom", regex = "${field.verifyType}")
<#elseif field.verifyType == "required"> <#elseif field.verifyType == "required">
@CheckEmptyAnnotation(name = "${field.columnComment}") @CheckEmptyAnnotation(name = "${field.columnComment}")
</#if>
</#if> </#if>
</#if> </#if>
</#if>
private String ${field.propertyName}; private String ${field.propertyName};
</#if>
</#if> </#if>
</#list> </#list>
<#list fieldList! as field> <#list fieldList! as field>
<#if field.formFieldValue == "number"> <#if field.formShow>
<#if field.formFieldValue == "number">
public Integer get${field.firstUpperPropertyName}() { public Integer get${field.firstUpperPropertyName}() {
return ${field.propertyName} == null ? 0 : ${field.propertyName}; return ${field.propertyName} == null ? 0 : ${field.propertyName};
} }
@ -66,7 +69,7 @@ public class ${firstUpperTableName}VO {
this.${field.propertyName} = ${field.propertyName}; this.${field.propertyName} = ${field.propertyName};
} }
<#elseif field.formFieldValue == "double"> <#elseif field.formFieldValue == "double">
public Double get${field.firstUpperPropertyName}() { public Double get${field.firstUpperPropertyName}() {
return ${field.propertyName} == null ? 0D : ${field.propertyName}; return ${field.propertyName} == null ? 0D : ${field.propertyName};
} }
@ -75,7 +78,7 @@ public class ${firstUpperTableName}VO {
this.${field.propertyName} = ${field.propertyName}; this.${field.propertyName} = ${field.propertyName};
} }
<#elseif field.formFieldValue == "date" || field.formFieldValue == "datetime"> <#elseif field.formFieldValue == "date" || field.formFieldValue == "datetime">
public String get${field.firstUpperPropertyName}() { public String get${field.firstUpperPropertyName}() {
return ${field.propertyName} == null ? "" : ${field.propertyName}.trim(); return ${field.propertyName} == null ? "" : ${field.propertyName}.trim();
} }
@ -84,7 +87,7 @@ public class ${firstUpperTableName}VO {
this.${field.propertyName} = ${field.propertyName}; this.${field.propertyName} = ${field.propertyName};
} }
<#else> <#else>
public String get${field.firstUpperPropertyName}() { public String get${field.firstUpperPropertyName}() {
return ${field.propertyName} == null ? "" : ${field.propertyName}.trim(); return ${field.propertyName} == null ? "" : ${field.propertyName}.trim();
} }
@ -93,6 +96,7 @@ public class ${firstUpperTableName}VO {
this.${field.propertyName} = ${field.propertyName}; this.${field.propertyName} = ${field.propertyName};
} }
</#if>
</#if> </#if>
</#list> </#list>

View File

@ -75,7 +75,6 @@ public interface I${firstUpperTableName}Service {
* 删除${tableExplain}(物理删除) * 删除${tableExplain}(物理删除)
* *
* @param ids id列表 * @param ids id列表
* @throws RemoveException
*/ */
void delete(List<String> ids); void delete(List<String> ids);
@ -175,7 +174,6 @@ public interface I${firstUpperTableName}Service {
* *
* @param page * @param page
* @return * @return
* @throws SearchException
*/ */
SuccessResultList<List<${firstUpperTableName}DTO>> listPage(ListPage page); SuccessResultList<List<${firstUpperTableName}DTO>> listPage(ListPage page);
@ -184,7 +182,6 @@ public interface I${firstUpperTableName}Service {
* *
* @param params * @param params
* @return * @return
* @throws SearchException
*/ */
Integer count(Map<String, Object> params); Integer count(Map<String, Object> params);

View File

@ -4,7 +4,7 @@ import ink.wgink.common.base.DefaultBaseService;
import ink.wgink.pojo.ListPage; import ink.wgink.pojo.ListPage;
import ink.wgink.pojo.result.SuccessResult; import ink.wgink.pojo.result.SuccessResult;
import ink.wgink.pojo.result.SuccessResultList; import ink.wgink.pojo.result.SuccessResultList;
import ink.wgink.pojo.utils.HashMapUtil; import ink.wgink.util.map.HashMapUtil;
import ink.wgink.util.UUIDUtil; import ink.wgink.util.UUIDUtil;
import ${codePackage}.dao.${lowerTableName}.I${firstUpperTableName}Dao; import ${codePackage}.dao.${lowerTableName}.I${firstUpperTableName}Dao;
import ${codePackage}.pojo.dtos.${lowerTableName}.${firstUpperTableName}DTO; import ${codePackage}.pojo.dtos.${lowerTableName}.${firstUpperTableName}DTO;
@ -34,12 +34,12 @@ public class ${firstUpperTableName}ServiceImpl extends DefaultBaseService implem
private I${firstUpperTableName}Dao ${firstLowerTableName}Dao; private I${firstUpperTableName}Dao ${firstLowerTableName}Dao;
@Override @Override
public SuccessResult save(${firstUpperTableName}VO ${firstLowerTableName}VO) { public void save(${firstUpperTableName}VO ${firstLowerTableName}VO) {
saveReturnId(${firstLowerTableName}VO); saveReturnId(${firstLowerTableName}VO);
} }
@Override @Override
public SuccessResult save(String token, ${firstUpperTableName}VO ${firstLowerTableName}VO) { public void save(String token, ${firstUpperTableName}VO ${firstLowerTableName}VO) {
saveReturnId(token, ${firstLowerTableName}VO); saveReturnId(token, ${firstLowerTableName}VO);
} }
@ -63,20 +63,20 @@ public class ${firstUpperTableName}ServiceImpl extends DefaultBaseService implem
} }
@Override @Override
public void remove(String ids) { public void remove(List<String> ids) {
remove(null, ids); remove(null, ids);
} }
@Override @Override
public void remove(String token, String ids) { public void remove(String token, List<String> ids) {
Map<String, Object> params = getHashMap(2); Map<String, Object> params = getHashMap(2);
params.put("${firstLowerTableName}Ids", ids); params.put("${firstLowerTableName}Ids", ids);
if (StringUtils.isBlank(token)) { if (StringUtils.isBlank(token)) {
setUpdateInfo(params); setUpdateInfo(params);
} else { } else {
setAppUpdateInfo(params, token); setAppUpdateInfo(token, params);
} }
userDao.remove(params); ${firstLowerTableName}Dao.remove(params);
} }
@Override @Override
@ -104,58 +104,58 @@ public class ${firstUpperTableName}ServiceImpl extends DefaultBaseService implem
} }
@Override @Override
public ${firstUpperTableName}DTO get(Map<String, Object> params) throws SearchException { public ${firstUpperTableName}DTO get(Map<String, Object> params) {
return ${firstLowerTableName}Dao.get(params); return ${firstLowerTableName}Dao.get(params);
} }
@Override @Override
public ${firstUpperTableName}DTO get(String ${firstLowerTableName}Id) throws SearchException { public ${firstUpperTableName}DTO get(String ${firstLowerTableName}Id) {
Map<String, Object> params = super.getHashMap(2); Map<String, Object> params = super.getHashMap(2);
params.put("${firstLowerTableName}Id", ${firstLowerTableName}Id); params.put("${firstLowerTableName}Id", ${firstLowerTableName}Id);
return get(params); return get(params);
} }
@Override @Override
public ${firstUpperTableName}BO getBO(Map<String, Object> params) throws SearchException { public ${firstUpperTableName}BO getBO(Map<String, Object> params) {
return ${firstLowerTableName}Dao.getBO(params); return ${firstLowerTableName}Dao.getBO(params);
} }
@Override @Override
public ${firstUpperTableName}BO getBO(String ${firstLowerTableName}Id) throws SearchException { public ${firstUpperTableName}BO getBO(String ${firstLowerTableName}Id) {
Map<String, Object> params = super.getHashMap(2); Map<String, Object> params = super.getHashMap(2);
params.put("${firstLowerTableName}Id", ${firstLowerTableName}Id); params.put("${firstLowerTableName}Id", ${firstLowerTableName}Id);
return getBO(params); return getBO(params);
} }
@Override @Override
public ${firstUpperTableName}PO getPO(Map<String, Object> params) throws SearchException { public ${firstUpperTableName}PO getPO(Map<String, Object> params) {
return ${firstLowerTableName}Dao.getPO(params); return ${firstLowerTableName}Dao.getPO(params);
} }
@Override @Override
public ${firstUpperTableName}PO getPO(String ${firstLowerTableName}Id) throws SearchException { public ${firstUpperTableName}PO getPO(String ${firstLowerTableName}Id) {
Map<String, Object> params = super.getHashMap(2); Map<String, Object> params = super.getHashMap(2);
params.put("${firstLowerTableName}Id", ${firstLowerTableName}Id); params.put("${firstLowerTableName}Id", ${firstLowerTableName}Id);
return getPO(params); return getPO(params);
} }
@Override @Override
public List<${firstUpperTableName}DTO> list(Map<String, Object> params) throws SearchException { public List<${firstUpperTableName}DTO> list(Map<String, Object> params) {
return ${firstLowerTableName}Dao.list(params); return ${firstLowerTableName}Dao.list(params);
} }
@Override @Override
public List<${firstUpperTableName}BO> listBO(Map<String, Object> params) throws SearchException { public List<${firstUpperTableName}BO> listBO(Map<String, Object> params) {
return ${firstLowerTableName}Dao.listBO(params); return ${firstLowerTableName}Dao.listBO(params);
} }
@Override @Override
public List<${firstUpperTableName}PO> listPO(Map<String, Object> params) throws SearchException { public List<${firstUpperTableName}PO> listPO(Map<String, Object> params) {
return ${firstLowerTableName}Dao.listPO(params); return ${firstLowerTableName}Dao.listPO(params);
} }
@Override @Override
public SuccessResultList<List<${firstUpperTableName}DTO>> listPage(ListPage page) throws SearchException { public SuccessResultList<List<${firstUpperTableName}DTO>> listPage(ListPage page) {
PageHelper.startPage(page.getPage(), page.getRows()); PageHelper.startPage(page.getPage(), page.getRows());
List<${firstUpperTableName}DTO> ${firstLowerTableName}DTOs = list(page.getParams()); List<${firstUpperTableName}DTO> ${firstLowerTableName}DTOs = list(page.getParams());
PageInfo<${firstUpperTableName}DTO> pageInfo = new PageInfo<>(${firstLowerTableName}DTOs); PageInfo<${firstUpperTableName}DTO> pageInfo = new PageInfo<>(${firstLowerTableName}DTOs);
@ -163,8 +163,8 @@ public class ${firstUpperTableName}ServiceImpl extends DefaultBaseService implem
} }
@Override @Override
public Integer count(Map<String, Object> params) throws SearchException { public Integer count(Map<String, Object> params) {
Integer count = ${firstLowerTableName}Dao.count${firstUpperTableName}(params); Integer count = ${firstLowerTableName}Dao.count(params);
return count == null ? 0 : count; return count == null ? 0 : count;
} }