Commit 7174042e authored by eddie.woo's avatar eddie.woo

1.主数据接口;2.ehcache;3.mapper增加注解;4.mybatis plugin;5.改用reflect asm优化现有反射

parent e119ec9e
...@@ -334,6 +334,14 @@ ...@@ -334,6 +334,14 @@
<artifactId>ehcache</artifactId> <artifactId>ehcache</artifactId>
<version>2.10.5</version> <version>2.10.5</version>
</dependency> </dependency>
<!-- reflectasm -->
<dependency>
<groupId>com.esotericsoftware</groupId>
<artifactId>reflectasm</artifactId>
<version>1.11.7</version>
</dependency>
</dependencies> </dependencies>
<profiles> <profiles>
......
package pwc.taxtech.atms.common;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.AfterThrowing;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@Component
@Aspect
public class AopLogger {
private static Logger logger = LoggerFactory.getLogger(AopLogger.class);
@Pointcut("execution(public * pwc.taxtech.atms.service.*.*(..))")
public void pointCut() {
// 定义Pointcut 此方法不能有返回值,该方法只是一个标示
}
@Before("pointCut()")
public void before(JoinPoint joinPoint) {
if (logger.isDebugEnabled()) {
logger.debug("aop before:{}", joinPoint);
}
}
@After("pointCut()")
public void after(JoinPoint joinPoint) {
if (logger.isDebugEnabled()) {
logger.debug("aop after:{}", joinPoint);
}
}
@AfterThrowing(pointcut = "pointCut()", throwing = "error")
public void afterThrowing(JoinPoint joinPoint, Throwable error) {
if (logger.isWarnEnabled()) {
logger.warn("aop afterThrowing:{}, exception class:{}, exception message:{} ", joinPoint,
error.getClass().toString(), error.getMessage());
}
}
// @After("pointCut()")
// public void doAfter(JoinPoint joinPoint) {
// System.out.println("AOP After Advice...");
// }
//
// @AfterReturning(pointcut = "pointCut()", returning = "returnVal")
// public void afterReturn(JoinPoint joinPoint, Object returnVal) {
// System.out.println("AOP AfterReturning Advice:" + returnVal);
// }
//
//
// @Around("pointCut()")
// public void around(ProceedingJoinPoint pjp) {
// System.out.println("AOP Aronud before...");
// try {
// pjp.proceed();
// } catch (Throwable e) {
// e.printStackTrace();
// }
// System.out.println("AOP Aronud after...");
// }
}
\ No newline at end of file
package pwc.taxtech.atms.common.exception;
import com.alibaba.fastjson.JSON;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import pwc.taxtech.atms.common.ServiceException;
import pwc.taxtech.atms.dto.ApiResultDto;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@ControllerAdvice
public class CustomExceptionHandler {
private static final Logger logger = LoggerFactory.getLogger(CustomExceptionHandler.class);
@ExceptionHandler(value = Throwable.class)
public ApiResultDto handle(HttpServletResponse response) {
return ApiResultDto.fail("error.");
}
@ExceptionHandler(value = ServiceException.class)
public void customHandle(ServiceException exception, HttpServletResponse response) {
try {
response.setCharacterEncoding("UTF-8");
response.setContentType("application/json; charset=UTF-8");
response.getWriter().write(JSON.toJSONString(ApiResultDto.fail(exception.getMessage())));
} catch (IOException e) {
logger.error("customHandle error.", e);
}
}
}
package pwc.taxtech.atms.common.util;
import com.esotericsoftware.reflectasm.FieldAccess;
import com.esotericsoftware.reflectasm.MethodAccess;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Component;
import java.lang.reflect.Field;
@Component
public class BeanUtil {
private static final String PREFIX_GET = "get";
private static final String PREFIX_SET = "set";
/**
* 拷贝属性
*
* @param sourceObject 数据源
* @param targetObject 目标对象
* @return T
*/
public <T> T copyProperties(Object sourceObject, T targetObject) {
if (sourceObject == null) {
throw new IllegalArgumentException("sourceObject is null");
}
if (targetObject == null) {
throw new IllegalArgumentException("targetObject is null");
}
MethodAccess targetMa = getMethodAccess(targetObject.getClass());
FieldAccess targetFa = getFieldAccess(targetObject.getClass());
Field[] targetFields = targetFa.getFields();
MethodAccess sourceMa = getMethodAccess(sourceObject.getClass());
FieldAccess sourceFa = getFieldAccess(sourceObject.getClass());
for (Field field : targetFields) {
String name = field.getName();
try {
sourceFa.getIndex(name);
} catch (Exception e) {
//不包含此属性 跳过
continue;
}
String upperName = upperCaseFirstChar(name);
targetMa.invoke(targetObject, PREFIX_SET + upperName,
sourceMa.invoke(sourceObject, PREFIX_GET + upperName));
}
return targetObject;
}
@Cacheable(value = "reflectCache", key = "'ma_' + #className.getName()")
public MethodAccess getMethodAccess(Class className) {
return MethodAccess.get(className);
}
@Cacheable(value = "reflectCache", key = "'fa_' + #className.getName()")
public FieldAccess getFieldAccess(Class className) {
return FieldAccess.get(className);
}
/**
* 首字母大写
*
* @param str str
* @return str
*/
public String upperCaseFirstChar(String str) {
char[] ch = str.toCharArray();
if (ch[0] >= 'a' && ch[0] <= 'z') {
ch[0] = (char) (ch[0] - 32);
}
return new String(ch);
}
}
...@@ -54,6 +54,9 @@ public class SignatureUtil { ...@@ -54,6 +54,9 @@ public class SignatureUtil {
*/ */
public static boolean validate(String key, String api, String nonceStr, String timestamp, String signature) { public static boolean validate(String key, String api, String nonceStr, String timestamp, String signature) {
try { try {
if (StringUtils.isAnyBlank(key, api, nonceStr, timestamp, signature)) {
return false;
}
int now = (int) (System.currentTimeMillis() / 1000); int now = (int) (System.currentTimeMillis() / 1000);
int time = Integer.valueOf(timestamp); int time = Integer.valueOf(timestamp);
if (now - time <= TIME_RANGE) { if (now - time <= TIME_RANGE) {
......
...@@ -6,9 +6,11 @@ import org.springframework.web.bind.annotation.RequestBody; ...@@ -6,9 +6,11 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import pwc.taxtech.atms.common.ServiceException;
import pwc.taxtech.atms.controller.BaseController; import pwc.taxtech.atms.controller.BaseController;
import pwc.taxtech.atms.dto.OperationResultDto; import pwc.taxtech.atms.dto.ApiResultDto;
import pwc.taxtech.atms.dto.vendor.LgItemDto; import pwc.taxtech.atms.dto.vendor.LgItemDto;
import pwc.taxtech.atms.dto.vendor.LgVendorDto;
import pwc.taxtech.atms.service.vendor.LongiService; import pwc.taxtech.atms.service.vendor.LongiService;
import java.util.List; import java.util.List;
...@@ -22,7 +24,24 @@ public class LongiController extends BaseController { ...@@ -22,7 +24,24 @@ public class LongiController extends BaseController {
@ApiOperation(value = "批量更新物料信息") @ApiOperation(value = "批量更新物料信息")
@RequestMapping(value = "updateItems", method = RequestMethod.POST) @RequestMapping(value = "updateItems", method = RequestMethod.POST)
public OperationResultDto updateItems(@RequestBody List<LgItemDto> lgItemDtoList) { public ApiResultDto updateItems(@RequestBody List<LgItemDto> lgItemDtoList) {
return OperationResultDto.success(); try {
longiService.updateItems(lgItemDtoList);
} catch (ServiceException e) {
return ApiResultDto.fail(e.getMessage());
} }
return ApiResultDto.success();
}
@ApiOperation(value = "批量更新供应商信息")
@RequestMapping(value = "updateVendors", method = RequestMethod.POST)
public ApiResultDto updateVendors(@RequestBody List<LgVendorDto> lgVendorDtoList) {
try {
longiService.updateVendors(lgVendorDtoList);
} catch (ServiceException e) {
return ApiResultDto.fail(e.getMessage());
}
return ApiResultDto.success();
}
} }
...@@ -4,11 +4,13 @@ import java.util.List; ...@@ -4,11 +4,13 @@ import java.util.List;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.RowBounds; import org.apache.ibatis.session.RowBounds;
import org.springframework.stereotype.Repository;
import pwc.taxtech.atms.MyMapper; import pwc.taxtech.atms.MyMapper;
import pwc.taxtech.atms.entitiy.InputMaterialItemCategory; import pwc.taxtech.atms.entitiy.InputMaterialItemCategory;
import pwc.taxtech.atms.entitiy.InputMaterialItemCategoryExample; import pwc.taxtech.atms.entitiy.InputMaterialItemCategoryExample;
@Mapper @Mapper
@Repository
public interface InputMaterialItemCategoryMapper extends MyMapper { public interface InputMaterialItemCategoryMapper extends MyMapper {
/** /**
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
......
...@@ -4,11 +4,13 @@ import java.util.List; ...@@ -4,11 +4,13 @@ import java.util.List;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.RowBounds; import org.apache.ibatis.session.RowBounds;
import org.springframework.stereotype.Repository;
import pwc.taxtech.atms.MyMapper; import pwc.taxtech.atms.MyMapper;
import pwc.taxtech.atms.entitiy.InputMaterialItem; import pwc.taxtech.atms.entitiy.InputMaterialItem;
import pwc.taxtech.atms.entitiy.InputMaterialItemExample; import pwc.taxtech.atms.entitiy.InputMaterialItemExample;
@Mapper @Mapper
@Repository
public interface InputMaterialItemMapper extends MyMapper { public interface InputMaterialItemMapper extends MyMapper {
/** /**
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
......
...@@ -4,11 +4,13 @@ import java.util.List; ...@@ -4,11 +4,13 @@ import java.util.List;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.RowBounds; import org.apache.ibatis.session.RowBounds;
import org.springframework.stereotype.Repository;
import pwc.taxtech.atms.MyMapper; import pwc.taxtech.atms.MyMapper;
import pwc.taxtech.atms.entitiy.InputVendorAddress; import pwc.taxtech.atms.entitiy.InputVendorAddress;
import pwc.taxtech.atms.entitiy.InputVendorAddressExample; import pwc.taxtech.atms.entitiy.InputVendorAddressExample;
@Mapper @Mapper
@Repository
public interface InputVendorAddressMapper extends MyMapper { public interface InputVendorAddressMapper extends MyMapper {
/** /**
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
......
...@@ -4,11 +4,13 @@ import java.util.List; ...@@ -4,11 +4,13 @@ import java.util.List;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.RowBounds; import org.apache.ibatis.session.RowBounds;
import org.springframework.stereotype.Repository;
import pwc.taxtech.atms.MyMapper; import pwc.taxtech.atms.MyMapper;
import pwc.taxtech.atms.entitiy.InputVendorBankAccount; import pwc.taxtech.atms.entitiy.InputVendorBankAccount;
import pwc.taxtech.atms.entitiy.InputVendorBankAccountExample; import pwc.taxtech.atms.entitiy.InputVendorBankAccountExample;
@Mapper @Mapper
@Repository
public interface InputVendorBankAccountMapper extends MyMapper { public interface InputVendorBankAccountMapper extends MyMapper {
/** /**
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
......
...@@ -4,11 +4,13 @@ import java.util.List; ...@@ -4,11 +4,13 @@ import java.util.List;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.RowBounds; import org.apache.ibatis.session.RowBounds;
import org.springframework.stereotype.Repository;
import pwc.taxtech.atms.MyMapper; import pwc.taxtech.atms.MyMapper;
import pwc.taxtech.atms.entitiy.InputVendorContactor; import pwc.taxtech.atms.entitiy.InputVendorContactor;
import pwc.taxtech.atms.entitiy.InputVendorContactorExample; import pwc.taxtech.atms.entitiy.InputVendorContactorExample;
@Mapper @Mapper
@Repository
public interface InputVendorContactorMapper extends MyMapper { public interface InputVendorContactorMapper extends MyMapper {
/** /**
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
......
...@@ -4,11 +4,13 @@ import java.util.List; ...@@ -4,11 +4,13 @@ import java.util.List;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.RowBounds; import org.apache.ibatis.session.RowBounds;
import org.springframework.stereotype.Repository;
import pwc.taxtech.atms.MyMapper; import pwc.taxtech.atms.MyMapper;
import pwc.taxtech.atms.entitiy.InputVendor; import pwc.taxtech.atms.entitiy.InputVendor;
import pwc.taxtech.atms.entitiy.InputVendorExample; import pwc.taxtech.atms.entitiy.InputVendorExample;
@Mapper @Mapper
@Repository
public interface InputVendorMapper extends MyMapper { public interface InputVendorMapper extends MyMapper {
/** /**
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
......
...@@ -4,11 +4,13 @@ import java.util.List; ...@@ -4,11 +4,13 @@ import java.util.List;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.RowBounds; import org.apache.ibatis.session.RowBounds;
import org.springframework.stereotype.Repository;
import pwc.taxtech.atms.MyMapper; import pwc.taxtech.atms.MyMapper;
import pwc.taxtech.atms.entitiy.InputVendorSite; import pwc.taxtech.atms.entitiy.InputVendorSite;
import pwc.taxtech.atms.entitiy.InputVendorSiteExample; import pwc.taxtech.atms.entitiy.InputVendorSiteExample;
@Mapper @Mapper
@Repository
public interface InputVendorSiteMapper extends MyMapper { public interface InputVendorSiteMapper extends MyMapper {
/** /**
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
......
package pwc.taxtech.atms.dto;
import org.apache.commons.lang3.StringUtils;
public class ApiResultDto {
private int code;
private Object data;
private String message;
public static final int SUCCESS = 0; //接口成功code
public static final int FAILED = -1; //通用失败code
/**
* 返回成功
*
* @param data data
* @return ApiResultDto
*/
public static ApiResultDto success(Object data) {
return new ApiResultDto(SUCCESS, data, StringUtils.EMPTY);
}
/**
* 返回成功
*
* @return ApiResultDto
*/
public static ApiResultDto success() {
return new ApiResultDto(SUCCESS, null, StringUtils.EMPTY);
}
/**
* 返回失败
*
* @param code fail code
* @param message msg
* @return ApiResultDto
*/
public static ApiResultDto fail(int code, String message) {
return new ApiResultDto(code, null, message);
}
/**
* 返回失败
*
* @param message msg
* @return ApiResultDto
*/
public static ApiResultDto fail(String message) {
return new ApiResultDto(FAILED, null, message);
}
public ApiResultDto() {
}
public ApiResultDto(int code, Object data, String message) {
this.code = code;
this.data = data;
this.message = message;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public Object getData() {
return data;
}
public void setData(Object data) {
this.data = data;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
}
package pwc.taxtech.atms.dto.vendor;
import pwc.taxtech.atms.entitiy.*;
import java.util.List;
public class LgVendorDto extends InputVendor {
private List<InputVendorBankAccount> vendorBankAccounts;
private List<InputVendorAddress> vendorAddresses;
private List<InputVendorSite> vendorSites;
private List<InputVendorContactor> vendorContactors;
public List<InputVendorBankAccount> getVendorBankAccounts() {
return vendorBankAccounts;
}
public void setVendorBankAccounts(List<InputVendorBankAccount> vendorBankAccounts) {
this.vendorBankAccounts = vendorBankAccounts;
}
public List<InputVendorAddress> getVendorAddresses() {
return vendorAddresses;
}
public void setVendorAddresses(List<InputVendorAddress> vendorAddresses) {
this.vendorAddresses = vendorAddresses;
}
public List<InputVendorSite> getVendorSites() {
return vendorSites;
}
public void setVendorSites(List<InputVendorSite> vendorSites) {
this.vendorSites = vendorSites;
}
public List<InputVendorContactor> getVendorContactors() {
return vendorContactors;
}
public void setVendorContactors(List<InputVendorContactor> vendorContactors) {
this.vendorContactors = vendorContactors;
}
}
package pwc.taxtech.atms.entitiy; package pwc.taxtech.atms.entitiy;
import java.io.Serializable;
/** /**
* *
* This class was generated by MyBatis Generator. * This class was generated by MyBatis Generator.
...@@ -9,7 +7,7 @@ import java.io.Serializable; ...@@ -9,7 +7,7 @@ import java.io.Serializable;
* *
* @mbg.generated do_not_delete_during_merge * @mbg.generated do_not_delete_during_merge
*/ */
public class InputMaterialItem extends BaseEntity implements Serializable { public class InputMaterialItem extends BaseEntity {
/** /**
* *
* This field was generated by MyBatis Generator. * This field was generated by MyBatis Generator.
...@@ -338,14 +336,6 @@ public class InputMaterialItem extends BaseEntity implements Serializable { ...@@ -338,14 +336,6 @@ public class InputMaterialItem extends BaseEntity implements Serializable {
*/ */
private String attr5; private String attr5;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table input_material_item
*
* @mbg.generated
*/
private static final long serialVersionUID = 1L;
/** /**
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
* This method returns the value of the database column input_material_item.id * This method returns the value of the database column input_material_item.id
......
package pwc.taxtech.atms.entitiy; package pwc.taxtech.atms.entitiy;
import java.io.Serializable;
/** /**
* *
* This class was generated by MyBatis Generator. * This class was generated by MyBatis Generator.
...@@ -9,7 +7,7 @@ import java.io.Serializable; ...@@ -9,7 +7,7 @@ import java.io.Serializable;
* *
* @mbg.generated do_not_delete_during_merge * @mbg.generated do_not_delete_during_merge
*/ */
public class InputMaterialItemCategory extends BaseEntity implements Serializable { public class InputMaterialItemCategory extends BaseEntity {
/** /**
* *
* This field was generated by MyBatis Generator. * This field was generated by MyBatis Generator.
...@@ -19,6 +17,17 @@ public class InputMaterialItemCategory extends BaseEntity implements Serializabl ...@@ -19,6 +17,17 @@ public class InputMaterialItemCategory extends BaseEntity implements Serializabl
*/ */
private Long id; private Long id;
/**
* Database Column Remarks:
* item表主键
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column input_material_item_category.material_item_id
*
* @mbg.generated
*/
private Long materialItemId;
/** /**
* Database Column Remarks: * Database Column Remarks:
* 类别集代码 * 类别集代码
...@@ -85,14 +94,6 @@ public class InputMaterialItemCategory extends BaseEntity implements Serializabl ...@@ -85,14 +94,6 @@ public class InputMaterialItemCategory extends BaseEntity implements Serializabl
*/ */
private String setValueDescUs; private String setValueDescUs;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table input_material_item_category
*
* @mbg.generated
*/
private static final long serialVersionUID = 1L;
/** /**
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
* This method returns the value of the database column input_material_item_category.id * This method returns the value of the database column input_material_item_category.id
...@@ -117,6 +118,30 @@ public class InputMaterialItemCategory extends BaseEntity implements Serializabl ...@@ -117,6 +118,30 @@ public class InputMaterialItemCategory extends BaseEntity implements Serializabl
this.id = id; this.id = id;
} }
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column input_material_item_category.material_item_id
*
* @return the value of input_material_item_category.material_item_id
*
* @mbg.generated
*/
public Long getMaterialItemId() {
return materialItemId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column input_material_item_category.material_item_id
*
* @param materialItemId the value for input_material_item_category.material_item_id
*
* @mbg.generated
*/
public void setMaterialItemId(Long materialItemId) {
this.materialItemId = materialItemId;
}
/** /**
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
* This method returns the value of the database column input_material_item_category.category_set_code * This method returns the value of the database column input_material_item_category.category_set_code
...@@ -274,6 +299,7 @@ public class InputMaterialItemCategory extends BaseEntity implements Serializabl ...@@ -274,6 +299,7 @@ public class InputMaterialItemCategory extends BaseEntity implements Serializabl
sb.append(" ["); sb.append(" [");
sb.append("Hash = ").append(hashCode()); sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id); sb.append(", id=").append(id);
sb.append(", materialItemId=").append(materialItemId);
sb.append(", categorySetCode=").append(categorySetCode); sb.append(", categorySetCode=").append(categorySetCode);
sb.append(", categorySetNameZhs=").append(categorySetNameZhs); sb.append(", categorySetNameZhs=").append(categorySetNameZhs);
sb.append(", categorySetNameUs=").append(categorySetNameUs); sb.append(", categorySetNameUs=").append(categorySetNameUs);
......
...@@ -255,6 +255,66 @@ public class InputMaterialItemCategoryExample { ...@@ -255,6 +255,66 @@ public class InputMaterialItemCategoryExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andMaterialItemIdIsNull() {
addCriterion("material_item_id is null");
return (Criteria) this;
}
public Criteria andMaterialItemIdIsNotNull() {
addCriterion("material_item_id is not null");
return (Criteria) this;
}
public Criteria andMaterialItemIdEqualTo(Long value) {
addCriterion("material_item_id =", value, "materialItemId");
return (Criteria) this;
}
public Criteria andMaterialItemIdNotEqualTo(Long value) {
addCriterion("material_item_id <>", value, "materialItemId");
return (Criteria) this;
}
public Criteria andMaterialItemIdGreaterThan(Long value) {
addCriterion("material_item_id >", value, "materialItemId");
return (Criteria) this;
}
public Criteria andMaterialItemIdGreaterThanOrEqualTo(Long value) {
addCriterion("material_item_id >=", value, "materialItemId");
return (Criteria) this;
}
public Criteria andMaterialItemIdLessThan(Long value) {
addCriterion("material_item_id <", value, "materialItemId");
return (Criteria) this;
}
public Criteria andMaterialItemIdLessThanOrEqualTo(Long value) {
addCriterion("material_item_id <=", value, "materialItemId");
return (Criteria) this;
}
public Criteria andMaterialItemIdIn(List<Long> values) {
addCriterion("material_item_id in", values, "materialItemId");
return (Criteria) this;
}
public Criteria andMaterialItemIdNotIn(List<Long> values) {
addCriterion("material_item_id not in", values, "materialItemId");
return (Criteria) this;
}
public Criteria andMaterialItemIdBetween(Long value1, Long value2) {
addCriterion("material_item_id between", value1, value2, "materialItemId");
return (Criteria) this;
}
public Criteria andMaterialItemIdNotBetween(Long value1, Long value2) {
addCriterion("material_item_id not between", value1, value2, "materialItemId");
return (Criteria) this;
}
public Criteria andCategorySetCodeIsNull() { public Criteria andCategorySetCodeIsNull() {
addCriterion("category_set_code is null"); addCriterion("category_set_code is null");
return (Criteria) this; return (Criteria) this;
......
package pwc.taxtech.atms.entitiy; package pwc.taxtech.atms.entitiy;
import java.io.Serializable;
/** /**
* *
* This class was generated by MyBatis Generator. * This class was generated by MyBatis Generator.
...@@ -9,7 +7,7 @@ import java.io.Serializable; ...@@ -9,7 +7,7 @@ import java.io.Serializable;
* *
* @mbg.generated do_not_delete_during_merge * @mbg.generated do_not_delete_during_merge
*/ */
public class InputVendor extends BaseEntity implements Serializable { public class InputVendor extends BaseEntity {
/** /**
* *
* This field was generated by MyBatis Generator. * This field was generated by MyBatis Generator.
...@@ -217,14 +215,6 @@ public class InputVendor extends BaseEntity implements Serializable { ...@@ -217,14 +215,6 @@ public class InputVendor extends BaseEntity implements Serializable {
*/ */
private String attr3; private String attr3;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table input_vendor
*
* @mbg.generated
*/
private static final long serialVersionUID = 1L;
/** /**
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
* This method returns the value of the database column input_vendor.id * This method returns the value of the database column input_vendor.id
......
package pwc.taxtech.atms.entitiy; package pwc.taxtech.atms.entitiy;
import java.io.Serializable;
/** /**
* *
* This class was generated by MyBatis Generator. * This class was generated by MyBatis Generator.
...@@ -9,7 +7,7 @@ import java.io.Serializable; ...@@ -9,7 +7,7 @@ import java.io.Serializable;
* *
* @mbg.generated do_not_delete_during_merge * @mbg.generated do_not_delete_during_merge
*/ */
public class InputVendorAddress extends BaseEntity implements Serializable { public class InputVendorAddress extends BaseEntity {
/** /**
* *
* This field was generated by MyBatis Generator. * This field was generated by MyBatis Generator.
...@@ -184,14 +182,6 @@ public class InputVendorAddress extends BaseEntity implements Serializable { ...@@ -184,14 +182,6 @@ public class InputVendorAddress extends BaseEntity implements Serializable {
*/ */
private String attr3; private String attr3;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table input_vendor_address
*
* @mbg.generated
*/
private static final long serialVersionUID = 1L;
/** /**
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
* This method returns the value of the database column input_vendor_address.id * This method returns the value of the database column input_vendor_address.id
......
package pwc.taxtech.atms.entitiy; package pwc.taxtech.atms.entitiy;
import java.io.Serializable;
/** /**
* *
* This class was generated by MyBatis Generator. * This class was generated by MyBatis Generator.
...@@ -9,7 +7,7 @@ import java.io.Serializable; ...@@ -9,7 +7,7 @@ import java.io.Serializable;
* *
* @mbg.generated do_not_delete_during_merge * @mbg.generated do_not_delete_during_merge
*/ */
public class InputVendorBankAccount extends BaseEntity implements Serializable { public class InputVendorBankAccount extends BaseEntity {
/** /**
* *
* This field was generated by MyBatis Generator. * This field was generated by MyBatis Generator.
...@@ -173,14 +171,6 @@ public class InputVendorBankAccount extends BaseEntity implements Serializable { ...@@ -173,14 +171,6 @@ public class InputVendorBankAccount extends BaseEntity implements Serializable {
*/ */
private String attr3; private String attr3;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table input_vendor_bank_account
*
* @mbg.generated
*/
private static final long serialVersionUID = 1L;
/** /**
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
* This method returns the value of the database column input_vendor_bank_account.id * This method returns the value of the database column input_vendor_bank_account.id
......
package pwc.taxtech.atms.entitiy; package pwc.taxtech.atms.entitiy;
import java.io.Serializable;
/** /**
* *
* This class was generated by MyBatis Generator. * This class was generated by MyBatis Generator.
...@@ -9,7 +7,7 @@ import java.io.Serializable; ...@@ -9,7 +7,7 @@ import java.io.Serializable;
* *
* @mbg.generated do_not_delete_during_merge * @mbg.generated do_not_delete_during_merge
*/ */
public class InputVendorContactor extends BaseEntity implements Serializable { public class InputVendorContactor extends BaseEntity {
/** /**
* *
* This field was generated by MyBatis Generator. * This field was generated by MyBatis Generator.
...@@ -85,14 +83,6 @@ public class InputVendorContactor extends BaseEntity implements Serializable { ...@@ -85,14 +83,6 @@ public class InputVendorContactor extends BaseEntity implements Serializable {
*/ */
private String disableDate; private String disableDate;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table input_vendor_contactor
*
* @mbg.generated
*/
private static final long serialVersionUID = 1L;
/** /**
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
* This method returns the value of the database column input_vendor_contactor.id * This method returns the value of the database column input_vendor_contactor.id
......
package pwc.taxtech.atms.entitiy; package pwc.taxtech.atms.entitiy;
import java.io.Serializable;
/** /**
* *
* This class was generated by MyBatis Generator. * This class was generated by MyBatis Generator.
...@@ -9,7 +7,7 @@ import java.io.Serializable; ...@@ -9,7 +7,7 @@ import java.io.Serializable;
* *
* @mbg.generated do_not_delete_during_merge * @mbg.generated do_not_delete_during_merge
*/ */
public class InputVendorSite extends BaseEntity implements Serializable { public class InputVendorSite extends BaseEntity {
/** /**
* *
* This field was generated by MyBatis Generator. * This field was generated by MyBatis Generator.
...@@ -217,14 +215,6 @@ public class InputVendorSite extends BaseEntity implements Serializable { ...@@ -217,14 +215,6 @@ public class InputVendorSite extends BaseEntity implements Serializable {
*/ */
private String attr3; private String attr3;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table input_vendor_site
*
* @mbg.generated
*/
private static final long serialVersionUID = 1L;
/** /**
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
* This method returns the value of the database column input_vendor_site.id * This method returns the value of the database column input_vendor_site.id
......
...@@ -6,7 +6,7 @@ import org.apache.commons.lang3.StringUtils; ...@@ -6,7 +6,7 @@ import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import pwc.taxtech.atms.common.util.SignatureUtil; import pwc.taxtech.atms.common.util.SignatureUtil;
import pwc.taxtech.atms.dto.OperationResultDto; import pwc.taxtech.atms.dto.ApiResultDto;
import javax.servlet.*; import javax.servlet.*;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
...@@ -15,7 +15,7 @@ import java.util.Map; ...@@ -15,7 +15,7 @@ import java.util.Map;
public class ApiSignatureFilter implements Filter { public class ApiSignatureFilter implements Filter {
private static final Logger LOGGER = LoggerFactory.getLogger(ApiSignatureFilter.class); private static final Logger LOGGER = LoggerFactory.getLogger(ApiSignatureFilter.class);
private static String INVALID_RESULT = JSON.toJSONString(OperationResultDto.error("invalid api signature")); private static String INVALID_RESULT = JSON.toJSONString(ApiResultDto.fail("invalid api signature"));
private static Map<String, String> keyMap = new ImmutableMap.Builder<String, String>() private static Map<String, String> keyMap = new ImmutableMap.Builder<String, String>()
.put("longi", "eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJsb25naSIsImV4cCI6MzI0ODczMDE1NjAsImlhdCI6MTUyOTkyMjM2MSwibmJmIjoxNTI5OTIxNzYxLCJqdGkiOiIyNURFRDEyRi0yRTBBLTRERDUtQjkyOS0xRjlCOTI1QzA2MjciLCJhcHBJZCI6ImxvbmdpIn0.fPddvBGXjViEXNrYA7BesndVjM5eYHA0cX_sKZprHbIasD75Sn8vWNVKb5hMDk3wk3M34k7VgkTFHnpj9BF2uw") .put("longi", "eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJsb25naSIsImV4cCI6MzI0ODczMDE1NjAsImlhdCI6MTUyOTkyMjM2MSwibmJmIjoxNTI5OTIxNzYxLCJqdGkiOiIyNURFRDEyRi0yRTBBLTRERDUtQjkyOS0xRjlCOTI1QzA2MjciLCJhcHBJZCI6ImxvbmdpIn0.fPddvBGXjViEXNrYA7BesndVjM5eYHA0cX_sKZprHbIasD75Sn8vWNVKb5hMDk3wk3M34k7VgkTFHnpj9BF2uw")
...@@ -36,25 +36,33 @@ public class ApiSignatureFilter implements Filter { ...@@ -36,25 +36,33 @@ public class ApiSignatureFilter implements Filter {
String signature = StringUtils.defaultString(request.getParameter(SignatureUtil.SIGN_SIGNATURE)); String signature = StringUtils.defaultString(request.getParameter(SignatureUtil.SIGN_SIGNATURE));
String api = StringUtils.defaultString(request.getParameter(SignatureUtil.SIGN_API)); String api = StringUtils.defaultString(request.getParameter(SignatureUtil.SIGN_API));
if (StringUtils.isAnyBlank(appId, signature, timestamp, nonceStr, api)) { if (StringUtils.isAnyBlank(appId, signature, timestamp, nonceStr, api)) {
servletResponse.getWriter().print(INVALID_RESULT); writeError(servletResponse, INVALID_RESULT);
return; return;
} }
String key = keyMap.get(appId); String key = keyMap.get(appId);
if (StringUtils.isBlank(key)) { if (StringUtils.isBlank(key)) {
servletResponse.getWriter().print(INVALID_RESULT); writeError(servletResponse, INVALID_RESULT);
return; return;
} }
if (SignatureUtil.validate(key, api, nonceStr, timestamp, signature)) { if (!SignatureUtil.validate(key, api, nonceStr, timestamp, signature)) {
filterChain.doFilter(servletRequest, servletResponse); writeError(servletResponse, INVALID_RESULT);
return;
} }
filterChain.doFilter(servletRequest, servletResponse);
} catch (Exception e) { } catch (Exception e) {
LOGGER.error("invalid api signature: {}", JSON.toJSONString(servletRequest.getParameterMap()), e); LOGGER.error("invalid api signature: {}", JSON.toJSONString(servletRequest.getParameterMap()), e);
writeError(servletResponse, INVALID_RESULT);
} }
servletResponse.getWriter().print(INVALID_RESULT);
} }
@Override @Override
public void destroy() { public void destroy() {
} }
private void writeError(ServletResponse servletResponse, String msg) throws IOException {
servletResponse.setCharacterEncoding("UTF-8");
servletResponse.setContentType("application/json; charset=UTF-8");
servletResponse.getWriter().write(msg);
}
} }
...@@ -5,6 +5,7 @@ import org.slf4j.LoggerFactory; ...@@ -5,6 +5,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import pwc.taxtech.atms.common.AtmsApiSettings; import pwc.taxtech.atms.common.AtmsApiSettings;
import pwc.taxtech.atms.common.AuthUserHelper; import pwc.taxtech.atms.common.AuthUserHelper;
import pwc.taxtech.atms.common.util.BeanUtil;
import pwc.taxtech.atms.service.OperationLogService; import pwc.taxtech.atms.service.OperationLogService;
public class BaseService { public class BaseService {
...@@ -18,5 +19,7 @@ public class BaseService { ...@@ -18,5 +19,7 @@ public class BaseService {
protected OperationLogService operationLogService; protected OperationLogService operationLogService;
@Autowired @Autowired
protected DistributedIDService idService; protected DistributedIDService idService;
@Autowired
protected BeanUtil beanUtil;
} }
...@@ -5,9 +5,10 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -5,9 +5,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import pwc.taxtech.atms.common.ServiceException; import pwc.taxtech.atms.common.ServiceException;
import pwc.taxtech.atms.dao.InputMaterialItemCategoryMapper; import pwc.taxtech.atms.dao.*;
import pwc.taxtech.atms.dao.InputMaterialItemMapper;
import pwc.taxtech.atms.dto.vendor.LgItemDto; import pwc.taxtech.atms.dto.vendor.LgItemDto;
import pwc.taxtech.atms.dto.vendor.LgVendorDto;
import pwc.taxtech.atms.entitiy.*;
import pwc.taxtech.atms.service.impl.BaseService; import pwc.taxtech.atms.service.impl.BaseService;
import java.util.List; import java.util.List;
...@@ -19,6 +20,16 @@ public class LongiService extends BaseService { ...@@ -19,6 +20,16 @@ public class LongiService extends BaseService {
private InputMaterialItemMapper itemMapper; private InputMaterialItemMapper itemMapper;
@Autowired @Autowired
private InputMaterialItemCategoryMapper itemCategoryMapper; private InputMaterialItemCategoryMapper itemCategoryMapper;
@Autowired
private InputVendorMapper vendorMapper;
@Autowired
private InputVendorAddressMapper vendorAddressMapper;
@Autowired
private InputVendorBankAccountMapper vendorBankAccountMapper;
@Autowired
private InputVendorSiteMapper vendorSiteMapper;
@Autowired
private InputVendorContactorMapper vendorContactorMapper;
/** /**
* 更新物料信息 * 更新物料信息
...@@ -28,11 +39,89 @@ public class LongiService extends BaseService { ...@@ -28,11 +39,89 @@ public class LongiService extends BaseService {
*/ */
@Transactional @Transactional
public void updateItems(List<LgItemDto> itemDtoList) throws ServiceException { public void updateItems(List<LgItemDto> itemDtoList) throws ServiceException {
if (CollectionUtils.isEmpty(itemDtoList)){ if (CollectionUtils.isEmpty(itemDtoList)) {
return; return;
} }
itemDtoList.forEach(dto->{ try {
dto.setId(idService.nextId()); itemDtoList.forEach(dto -> {
long id = idService.nextId();
dto.setId(id);
InputMaterialItem item = new InputMaterialItem();
beanUtil.copyProperties(dto, item);
itemMapper.insertSelective(item);
List<InputMaterialItemCategory> categoryList = dto.getCategorySets();
if (CollectionUtils.isNotEmpty(categoryList)) {
categoryList.forEach(category -> {
category.setId(idService.nextId());
category.setMaterialItemId(id);
itemCategoryMapper.insertSelective(category);
});
}
}); });
} catch (Exception e) {
logger.error("updateItems error.", e);
throw new ServiceException("更新物料信息失败", e);
}
}
/**
* 更新供应商
*
* @param vendorDtoList list
* @throws ServiceException ex
*/
@Transactional
public void updateVendors(List<LgVendorDto> vendorDtoList) throws ServiceException {
if (CollectionUtils.isEmpty(vendorDtoList)) {
return;
}
try {
vendorDtoList.forEach(dto -> {
long id = idService.nextId();
dto.setId(id);
InputVendor vendor = new InputVendor();
beanUtil.copyProperties(dto, vendor);
vendorMapper.insertSelective(vendor);
//InputVendorBankAccount
List<InputVendorBankAccount> vendorBankAccountList = dto.getVendorBankAccounts();
if (CollectionUtils.isNotEmpty(vendorBankAccountList)) {
vendorBankAccountList.forEach(bankAccount -> {
bankAccount.setId(idService.nextId());
bankAccount.setVendorId(id);
vendorBankAccountMapper.insertSelective(bankAccount);
});
}
//InputVendorAddress
List<InputVendorAddress> vendorAddressList = dto.getVendorAddresses();
if (CollectionUtils.isNotEmpty(vendorAddressList)) {
vendorAddressList.forEach(address -> {
address.setId(idService.nextId());
address.setVendorId(id);
vendorAddressMapper.insertSelective(address);
});
}
//InputVendorSite
List<InputVendorSite> vendorSiteList = dto.getVendorSites();
if (CollectionUtils.isNotEmpty(vendorSiteList)) {
vendorSiteList.forEach(site -> {
site.setId(idService.nextId());
site.setVendorId(id);
vendorSiteMapper.insertSelective(site);
});
}
//InputVendorContactor
List<InputVendorContactor> contactorList = dto.getVendorContactors();
if (CollectionUtils.isNotEmpty(contactorList)) {
contactorList.forEach(contactor -> {
contactor.setId(idService.nextId());
contactor.setVendorId(id);
vendorContactorMapper.insertSelective(contactor);
});
}
});
} catch (Exception e) {
logger.error("updateVendors error.", e);
throw new ServiceException("更新供应商信息失败", e);
}
} }
} }
...@@ -12,10 +12,18 @@ ...@@ -12,10 +12,18 @@
<cache name="inputInvoiceCache" <cache name="inputInvoiceCache"
maxElementsOnDisk="1000" maxElementsOnDisk="1000"
maxElementsInMemory="2000" maxElementsInMemory="2000"
eternal="true" eternal="false"
overflowToDisk="true" overflowToDisk="true"
diskPersistent="true"/> diskPersistent="true"/>
<!-- reflect缓存 -->
<cache name="reflectCache"
maxElementsOnDisk="1000"
maxElementsInMemory="1000"
eternal="true"
overflowToDisk="false"
diskPersistent="false"/>
</ehcache> </ehcache>
<!-- <!--
<diskStore>==========当内存缓存中对象数量超过maxElementsInMemory时,将缓存对象写到磁盘缓存中(需对象实现序列化接口) <diskStore>==========当内存缓存中对象数量超过maxElementsInMemory时,将缓存对象写到磁盘缓存中(需对象实现序列化接口)
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
This element is automatically generated by MyBatis Generator, do not modify. This element is automatically generated by MyBatis Generator, do not modify.
--> -->
<id column="id" jdbcType="BIGINT" property="id" /> <id column="id" jdbcType="BIGINT" property="id" />
<result column="material_item_id" jdbcType="BIGINT" property="materialItemId" />
<result column="category_set_code" jdbcType="VARCHAR" property="categorySetCode" /> <result column="category_set_code" jdbcType="VARCHAR" property="categorySetCode" />
<result column="category_set_name_zhs" jdbcType="VARCHAR" property="categorySetNameZhs" /> <result column="category_set_name_zhs" jdbcType="VARCHAR" property="categorySetNameZhs" />
<result column="category_set_name_us" jdbcType="VARCHAR" property="categorySetNameUs" /> <result column="category_set_name_us" jdbcType="VARCHAR" property="categorySetNameUs" />
...@@ -89,8 +90,9 @@ ...@@ -89,8 +90,9 @@
WARNING - @mbg.generated WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify. This element is automatically generated by MyBatis Generator, do not modify.
--> -->
id, category_set_code, category_set_name_zhs, category_set_name_us, set_value, set_value_desc_zhs, id, material_item_id, category_set_code, category_set_name_zhs, category_set_name_us,
set_value_desc_us, create_time, update_time, create_by, update_by set_value, set_value_desc_zhs, set_value_desc_us, create_time, update_time, create_by,
update_by
</sql> </sql>
<select id="selectByExample" parameterType="pwc.taxtech.atms.entitiy.InputMaterialItemCategoryExample" resultMap="BaseResultMap"> <select id="selectByExample" parameterType="pwc.taxtech.atms.entitiy.InputMaterialItemCategoryExample" resultMap="BaseResultMap">
<!-- <!--
...@@ -143,14 +145,16 @@ ...@@ -143,14 +145,16 @@
WARNING - @mbg.generated WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify. This element is automatically generated by MyBatis Generator, do not modify.
--> -->
insert into input_material_item_category (id, category_set_code, category_set_name_zhs, insert into input_material_item_category (id, material_item_id, category_set_code,
category_set_name_us, set_value, set_value_desc_zhs, category_set_name_zhs, category_set_name_us,
set_value_desc_us, create_time, update_time, set_value, set_value_desc_zhs, set_value_desc_us,
create_by, update_by) create_time, update_time, create_by,
values (#{id,jdbcType=BIGINT}, #{categorySetCode,jdbcType=VARCHAR}, #{categorySetNameZhs,jdbcType=VARCHAR}, update_by)
#{categorySetNameUs,jdbcType=VARCHAR}, #{setValue,jdbcType=VARCHAR}, #{setValueDescZhs,jdbcType=VARCHAR}, values (#{id,jdbcType=BIGINT}, #{materialItemId,jdbcType=BIGINT}, #{categorySetCode,jdbcType=VARCHAR},
#{setValueDescUs,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{categorySetNameZhs,jdbcType=VARCHAR}, #{categorySetNameUs,jdbcType=VARCHAR},
#{createBy,jdbcType=VARCHAR}, #{updateBy,jdbcType=VARCHAR}) #{setValue,jdbcType=VARCHAR}, #{setValueDescZhs,jdbcType=VARCHAR}, #{setValueDescUs,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{createBy,jdbcType=VARCHAR},
#{updateBy,jdbcType=VARCHAR})
</insert> </insert>
<insert id="insertSelective" parameterType="pwc.taxtech.atms.entitiy.InputMaterialItemCategory"> <insert id="insertSelective" parameterType="pwc.taxtech.atms.entitiy.InputMaterialItemCategory">
<!-- <!--
...@@ -162,6 +166,9 @@ ...@@ -162,6 +166,9 @@
<if test="id != null"> <if test="id != null">
id, id,
</if> </if>
<if test="materialItemId != null">
material_item_id,
</if>
<if test="categorySetCode != null"> <if test="categorySetCode != null">
category_set_code, category_set_code,
</if> </if>
...@@ -197,6 +204,9 @@ ...@@ -197,6 +204,9 @@
<if test="id != null"> <if test="id != null">
#{id,jdbcType=BIGINT}, #{id,jdbcType=BIGINT},
</if> </if>
<if test="materialItemId != null">
#{materialItemId,jdbcType=BIGINT},
</if>
<if test="categorySetCode != null"> <if test="categorySetCode != null">
#{categorySetCode,jdbcType=VARCHAR}, #{categorySetCode,jdbcType=VARCHAR},
</if> </if>
...@@ -249,6 +259,9 @@ ...@@ -249,6 +259,9 @@
<if test="record.id != null"> <if test="record.id != null">
id = #{record.id,jdbcType=BIGINT}, id = #{record.id,jdbcType=BIGINT},
</if> </if>
<if test="record.materialItemId != null">
material_item_id = #{record.materialItemId,jdbcType=BIGINT},
</if>
<if test="record.categorySetCode != null"> <if test="record.categorySetCode != null">
category_set_code = #{record.categorySetCode,jdbcType=VARCHAR}, category_set_code = #{record.categorySetCode,jdbcType=VARCHAR},
</if> </if>
...@@ -291,6 +304,7 @@ ...@@ -291,6 +304,7 @@
--> -->
update input_material_item_category update input_material_item_category
set id = #{record.id,jdbcType=BIGINT}, set id = #{record.id,jdbcType=BIGINT},
material_item_id = #{record.materialItemId,jdbcType=BIGINT},
category_set_code = #{record.categorySetCode,jdbcType=VARCHAR}, category_set_code = #{record.categorySetCode,jdbcType=VARCHAR},
category_set_name_zhs = #{record.categorySetNameZhs,jdbcType=VARCHAR}, category_set_name_zhs = #{record.categorySetNameZhs,jdbcType=VARCHAR},
category_set_name_us = #{record.categorySetNameUs,jdbcType=VARCHAR}, category_set_name_us = #{record.categorySetNameUs,jdbcType=VARCHAR},
...@@ -312,6 +326,9 @@ ...@@ -312,6 +326,9 @@
--> -->
update input_material_item_category update input_material_item_category
<set> <set>
<if test="materialItemId != null">
material_item_id = #{materialItemId,jdbcType=BIGINT},
</if>
<if test="categorySetCode != null"> <if test="categorySetCode != null">
category_set_code = #{categorySetCode,jdbcType=VARCHAR}, category_set_code = #{categorySetCode,jdbcType=VARCHAR},
</if> </if>
...@@ -351,7 +368,8 @@ ...@@ -351,7 +368,8 @@
This element is automatically generated by MyBatis Generator, do not modify. This element is automatically generated by MyBatis Generator, do not modify.
--> -->
update input_material_item_category update input_material_item_category
set category_set_code = #{categorySetCode,jdbcType=VARCHAR}, set material_item_id = #{materialItemId,jdbcType=BIGINT},
category_set_code = #{categorySetCode,jdbcType=VARCHAR},
category_set_name_zhs = #{categorySetNameZhs,jdbcType=VARCHAR}, category_set_name_zhs = #{categorySetNameZhs,jdbcType=VARCHAR},
category_set_name_us = #{categorySetNameUs,jdbcType=VARCHAR}, category_set_name_us = #{categorySetNameUs,jdbcType=VARCHAR},
set_value = #{setValue,jdbcType=VARCHAR}, set_value = #{setValue,jdbcType=VARCHAR},
......
package pwc.taxtech.atms.plugin;
import org.mybatis.generator.api.IntrospectedTable;
import org.mybatis.generator.api.PluginAdapter;
import org.mybatis.generator.api.dom.java.FullyQualifiedJavaType;
import org.mybatis.generator.api.dom.java.Interface;
import org.mybatis.generator.api.dom.java.TopLevelClass;
import java.util.List;
public class MapperAnnotationPlugin extends PluginAdapter {
@Override
public boolean validate(List<String> warnings) {
return true;
}
@Override
public boolean clientGenerated(Interface interfaze, TopLevelClass topLevelClass,
IntrospectedTable introspectedTable) {
interfaze.addImportedType(new FullyQualifiedJavaType("org.apache.ibatis.annotations.Mapper"));
interfaze.addAnnotation("@Mapper");
interfaze.addImportedType(new FullyQualifiedJavaType("org.springframework.stereotype.Repository"));
interfaze.addAnnotation("@Repository");
return true;
}
}
...@@ -12,10 +12,10 @@ ...@@ -12,10 +12,10 @@
<property name="beginningDelimiter" value="`"/> <property name="beginningDelimiter" value="`"/>
<property name="endingDelimiter" value="`"/> <property name="endingDelimiter" value="`"/>
<property name="javaFileEncoding" value="UTF-8" /> <property name="javaFileEncoding" value="UTF-8" />
<plugin type="org.mybatis.generator.plugins.MapperAnnotationPlugin" /> <plugin type="pwc.taxtech.atms.plugin.MapperAnnotationPlugin" />
<plugin type="org.mybatis.generator.plugins.RowBoundsPlugin" /> <plugin type="org.mybatis.generator.plugins.RowBoundsPlugin" />
<plugin type="org.mybatis.generator.plugins.ToStringPlugin" /> <plugin type="org.mybatis.generator.plugins.ToStringPlugin" />
<plugin type="org.mybatis.generator.plugins.SerializablePlugin" /> <!--<plugin type="org.mybatis.generator.plugins.SerializablePlugin" />-->
<commentGenerator> <commentGenerator>
<property name="suppressDate" value="true" /> <property name="suppressDate" value="true" />
<property name="addRemarkComments" value="true" /> <property name="addRemarkComments" value="true" />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment