Commit 80a28f85 by tangzhaoqian Committed by chenzg

新增自定义异常、faskjson配置更新、冗余java工具类删除

parent 1b1e55d3
...@@ -221,9 +221,9 @@ ...@@ -221,9 +221,9 @@
<version>2.9.0</version> </dependency> --> <version>2.9.0</version> </dependency> -->
<dependency> <dependency>
<groupId>com.alibaba</groupId> <groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId> <artifactId>fastjson</artifactId>
<version>1.2.58</version> <version>1.2.62</version>
</dependency> </dependency>
<dependency> <dependency>
...@@ -236,7 +236,7 @@ ...@@ -236,7 +236,7 @@
<dependency> <dependency>
<groupId>cn.hutool</groupId> <groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId> <artifactId>hutool-all</artifactId>
<version>4.6.1</version> <version>5.3.2</version>
</dependency> </dependency>
<!-- lombok --> <!-- lombok -->
...@@ -261,15 +261,15 @@ ...@@ -261,15 +261,15 @@
</dependency> </dependency>
<!-- jackson --> <!-- jackson -->
<dependency> <!-- <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-json</artifactId> <artifactId>spring-boot-starter-json</artifactId>
</dependency> </dependency> -->
<dependency> <!-- <dependency>
<groupId>com.fasterxml.jackson.core</groupId> <groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId> <artifactId>jackson-databind</artifactId>
</dependency> </dependency> -->
<dependency> <dependency>
<groupId>com.alibaba</groupId> <groupId>com.alibaba</groupId>
......
...@@ -16,10 +16,6 @@ import org.springframework.web.cors.CorsConfiguration; ...@@ -16,10 +16,6 @@ import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource; import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import org.springframework.web.filter.CorsFilter; import org.springframework.web.filter.CorsFilter;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.alibaba.fastjson.support.config.FastJsonConfig;
import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
import cn.hutool.core.net.NetUtil; import cn.hutool.core.net.NetUtil;
@MapperScan("cn.timer.api.dao") // 扫描的mapper @MapperScan("cn.timer.api.dao") // 扫描的mapper
...@@ -38,28 +34,6 @@ public class Application { ...@@ -38,28 +34,6 @@ public class Application {
SpringApplication.run(Application.class, args); SpringApplication.run(Application.class, args);
} }
/**
* 配置FastJson方式二
*
* @return HttpMessageConverters
*/
@Bean
public HttpMessageConverters fastJsonHttpMessageConverters() {
// 1.定义一个converters转换消息的对象
FastJsonHttpMessageConverter fastConverter = new FastJsonHttpMessageConverter();
// 2.添加fastjson的配置信息,比如: 是否需要格式化返回的json数据
FastJsonConfig fastJsonConfig = new FastJsonConfig();
fastJsonConfig.setDateFormat("yyyy-MM-dd HH:mm:ss");
fastJsonConfig.setSerializerFeatures(SerializerFeature.PrettyFormat);
// 3.在converter中添加配置信息
fastConverter.setFastJsonConfig(fastJsonConfig);
// 4.将converter赋值给HttpMessageConverter
HttpMessageConverter<?> converter = fastConverter;
// 5.返回HttpMessageConverters对象
return new HttpMessageConverters(converter);
}
// extends SpringBootServletInitializer
@Autowired @Autowired
private RestTemplateBuilder restTemplateBuilder; private RestTemplateBuilder restTemplateBuilder;
......
package cn.timer.api.bean.clazz;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author Tang 2020-05-09
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel("地区")
public class CommonArea extends Model<CommonArea> {
/**
*
*/
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue
@TableId (type = IdType.AUTO)
@ApiModelProperty(value="编号",example="1")
private Integer codeId;
@ApiModelProperty(value="父编号",example="10")
private Integer parentId;
@ApiModelProperty(value="城市名称",example="1")
private String cityName;
@ApiModelProperty(value="下级",example="1")
private List<CommonArea> commonAreas;
}
\ No newline at end of file
...@@ -88,11 +88,11 @@ public class SpmkApproveSummary extends Model<SpmkApproveSummary> { ...@@ -88,11 +88,11 @@ public class SpmkApproveSummary extends Model<SpmkApproveSummary> {
private String digest; private String digest;
@ApiModelProperty(value = "岗位名称", example = "摘要") @ApiModelProperty(value = "岗位名称", example = "岗位名称")
private String gwName; private String gwName;
@ApiModelProperty(value = "岗位名称", example = "摘要") @ApiModelProperty(value = "部门id", example = "1")
private String bmId; private String bmId;
@ApiModelProperty(value = "岗位名称", example = "摘要") @ApiModelProperty(value = "部门名称", example = "部门名称")
private String bmName; private String bmName;
......
package cn.timer.api.config.exception;
/**
* 自定义异常
*
* @author Tang
*/
public class CustomException extends RuntimeException
{
private static final long serialVersionUID = 1L;
private String code;
private String message;
public CustomException(String message)
{
this.message = message;
}
public CustomException(String message, String code)
{
this.message = message;
this.code = code;
}
public CustomException(String message, Throwable e)
{
super(message, e);
this.message = message;
}
@Override
public String getMessage()
{
return message;
}
public String getCode()
{
return code;
}
}
package cn.timer.api.config.exception;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import cn.hutool.core.util.StrUtil;
import cn.timer.api.utils.Result;
import cn.timer.api.utils.ResultUtil;
/**
* 全局异常处理器
*
* @author Tang
*/
@RestControllerAdvice // @ControllerAdvice + @ResponseBody 组合注解
public class GlobalExceptionHandler {
private static final Logger log = LoggerFactory.getLogger(GlobalExceptionHandler.class);
@ExceptionHandler(Exception.class)
public Result<Object> handleException(Exception e) {
log.error(e.getMessage(), e);
return ResultUtil.error(e.getMessage());
}
/**
* 空指针异常
* @param e
* @return
*/
@ExceptionHandler(NullPointerException.class)
public Result<Object> nullPointerException(NullPointerException e) {
log.error(e.getMessage(), e);
return ResultUtil.error(e.getMessage());
}
/**
* 类型强制转换异常
* @param e
* @return
*/
@ExceptionHandler(ClassCastException.class)
public Result<Object> classCastException(ClassCastException e) {
log.error(e.getMessage(), e);
return ResultUtil.error(e.getMessage());
}
/**
* 业务异常
*/
@ExceptionHandler(CustomException.class)
public Result<Object> businessException(CustomException e) {
if (StrUtil.isBlank(e.getCode())) {
return ResultUtil.error(e.getMessage());
}
return ResultUtil.error(e.getCode(), e.getMessage());
}
}
package cn.timer.api.config.interceptor;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.alibaba.fastjson.support.config.FastJsonConfig;
import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType;
import org.springframework.http.converter.StringHttpMessageConverter;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
@Configuration
public class MyConfiguration {
@Bean
public HttpMessageConverters customConverters() {
FastJsonHttpMessageConverter fastConverter = new FastJsonHttpMessageConverter();
// 创建配置类
FastJsonConfig config = new FastJsonConfig();
config.setSerializerFeatures(
SerializerFeature.WriteNullListAsEmpty,
SerializerFeature.WriteMapNullValue,
SerializerFeature.WriteNullStringAsEmpty
);
//此处是全局处理方式
config.setDateFormat("yyyy-MM-dd HH:mm:ss");
config.setCharset(Charset.forName("UTF-8"));
fastConverter.setFastJsonConfig(config);
List<MediaType> supportedMediaTypes = new ArrayList<>();
supportedMediaTypes.add(MediaType.ALL);
fastConverter.setSupportedMediaTypes(supportedMediaTypes);
//支持text 转string
StringHttpMessageConverter stringHttpMessageConverter = new StringHttpMessageConverter();
return new HttpMessageConverters(fastConverter, stringHttpMessageConverter);
}
}
package cn.timer.api.config.interceptor; package cn.timer.api.config.interceptor;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List; import java.util.List;
import javax.annotation.Resource; import javax.annotation.Resource;
...@@ -9,11 +11,13 @@ import org.springframework.context.annotation.Bean; ...@@ -9,11 +11,13 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.http.converter.HttpMessageConverter; import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.web.method.support.HandlerMethodArgumentResolver; import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import com.alibaba.fastjson.serializer.SerializerFeature; import com.alibaba.fastjson.serializer.SerializerFeature;
import com.alibaba.fastjson.serializer.ValueFilter;
import com.alibaba.fastjson.support.config.FastJsonConfig; import com.alibaba.fastjson.support.config.FastJsonConfig;
import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter; import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
...@@ -51,8 +55,21 @@ public class WebSecurityConfig implements WebMvcConfigurer { ...@@ -51,8 +55,21 @@ public class WebSecurityConfig implements WebMvcConfigurer {
// registry.addInterceptor(getSessionInterceptor()).addPathPatterns("/**").excludePathPatterns("/swagger-ui*"); // registry.addInterceptor(getSessionInterceptor()).addPathPatterns("/**").excludePathPatterns("/swagger-ui*");
} }
/**
* 配置消息转换器--这里我用的是alibaba 开源的 fastjson
* @param converters
*/
@Override @Override
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) { public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
// Iterator<HttpMessageConverter<?>> iterator = converters.iterator();
// while(iterator.hasNext()){
// HttpMessageConverter<?> converter = iterator.next();
// if(converter instanceof MappingJackson2HttpMessageConverter){
// iterator.remove();
// }
// }
// 1.需要先定义一个convert 转换消息的对象 // 1.需要先定义一个convert 转换消息的对象
FastJsonHttpMessageConverter fastConverter = new FastJsonHttpMessageConverter(); FastJsonHttpMessageConverter fastConverter = new FastJsonHttpMessageConverter();
// 2.添加fastJson的配置信息,比如,是否需要格式化返回的json数据 // 2.添加fastJson的配置信息,比如,是否需要格式化返回的json数据
...@@ -66,10 +83,21 @@ public class WebSecurityConfig implements WebMvcConfigurer { ...@@ -66,10 +83,21 @@ public class WebSecurityConfig implements WebMvcConfigurer {
// WriteNullNumberAsZero 将数值类型字段的空值输出为0 // WriteNullNumberAsZero 将数值类型字段的空值输出为0
// WriteNullBooleanAsFalse 将Boolean类型字段的空值输出为false // WriteNullBooleanAsFalse 将Boolean类型字段的空值输出为false
fastJsonConfig.setSerializerFeatures( fastJsonConfig.setSerializerFeatures(
SerializerFeature.PrettyFormat, SerializerFeature.PrettyFormat
SerializerFeature.WriteMapNullValue, // SerializerFeature.WriteEnumUsingToString,
SerializerFeature.WriteDateUseDateFormat, // SerializerFeature.WriteNullStringAsEmpty,
SerializerFeature.WriteNullStringAsEmpty); // SerializerFeature.WriteMapNullValue,
// SerializerFeature.WriteDateUseDateFormat
);
// fastJsonConfig.setSerializeFilters((ValueFilter) (o, s, source) -> {
// if (source == null) {
// return "";//此处是关键,如果返回对象的变量为null,则自动变成""
// }
// if (source instanceof Date) {
// return ((Date) source).getTime();
// }
// return source;
// });
// 处理中文乱码问题 // 处理中文乱码问题
List<MediaType> fastMediaTypes = new ArrayList<>(); List<MediaType> fastMediaTypes = new ArrayList<>();
fastMediaTypes.add(MediaType.APPLICATION_JSON_UTF8); fastMediaTypes.add(MediaType.APPLICATION_JSON_UTF8);
...@@ -77,7 +105,7 @@ public class WebSecurityConfig implements WebMvcConfigurer { ...@@ -77,7 +105,7 @@ public class WebSecurityConfig implements WebMvcConfigurer {
// 3.在convert中添加配置信息 // 3.在convert中添加配置信息
fastConverter.setFastJsonConfig(fastJsonConfig); fastConverter.setFastJsonConfig(fastJsonConfig);
// 4.将convert添加到converters当中 // 4.将convert添加到converters当中
converters.add(fastConverter); converters.add(0,fastConverter);
} }
......
...@@ -43,6 +43,7 @@ import cn.timer.api.bean.spmk.SpmkInitiatorConfig; ...@@ -43,6 +43,7 @@ import cn.timer.api.bean.spmk.SpmkInitiatorConfig;
import cn.timer.api.bean.yggl.YgglMainEmp; import cn.timer.api.bean.yggl.YgglMainEmp;
import cn.timer.api.config.annotation.CurrentUser; import cn.timer.api.config.annotation.CurrentUser;
import cn.timer.api.config.annotation.UserBean; import cn.timer.api.config.annotation.UserBean;
import cn.timer.api.config.exception.CustomException;
import cn.timer.api.controller.spmk.service.SpmkServiceImpl; import cn.timer.api.controller.spmk.service.SpmkServiceImpl;
import cn.timer.api.controller.zzgl.service.ZzglBmgwMService; import cn.timer.api.controller.zzgl.service.ZzglBmgwMService;
import cn.timer.api.dao.spmk.SpmkApprovalGMapper; import cn.timer.api.dao.spmk.SpmkApprovalGMapper;
...@@ -450,7 +451,7 @@ public class SpmkController { ...@@ -450,7 +451,7 @@ public class SpmkController {
.currentApprover(currentApprover).build(); .currentApprover(currentApprover).build();
if (!as.insert()) { if (!as.insert()) {
return ResultUtil.error("操作失败!"); throw new CustomException("审批汇总-新增异常");
} }
// 插入记录 // 插入记录
...@@ -466,7 +467,7 @@ public class SpmkController { ...@@ -466,7 +467,7 @@ public class SpmkController {
ad.setFlowChildren(ObjectUtil.serialize(listFlowChildren)); ad.setFlowChildren(ObjectUtil.serialize(listFlowChildren));
if (!ad.insert()) if (!ad.insert())
throw new Exception(); throw new CustomException("审批详情-新增异常");
return ResultUtil.success("操作成功!"); return ResultUtil.success("操作成功!");
...@@ -477,6 +478,7 @@ public class SpmkController { ...@@ -477,6 +478,7 @@ public class SpmkController {
* 审批汇总 * 审批汇总
* @param summaryQueryDto * @param summaryQueryDto
* @return * @return
* @throws
*/ */
@PostMapping(value = "/select_approve_summary") @PostMapping(value = "/select_approve_summary")
@ApiOperation(value = "18.审批汇总", httpMethod = "POST", notes = "审批汇总") @ApiOperation(value = "18.审批汇总", httpMethod = "POST", notes = "审批汇总")
...@@ -544,8 +546,7 @@ public class SpmkController { ...@@ -544,8 +546,7 @@ public class SpmkController {
@ApiOperationSupport(order = 20) @ApiOperationSupport(order = 20)
// @BindingResultCtrol(title = "审批人审批") // @BindingResultCtrol(title = "审批人审批")
public Result<Object> approving(@Valid @RequestBody ApprovingDto approvingDto, BindingResult bindingResult) throws Exception { public Result<Object> approving(@Valid @RequestBody ApprovingDto approvingDto, BindingResult bindingResult) throws Exception {
SpmkApproveDetail ad = SpmkApproveDetail.builder().build() SpmkApproveDetail ad = SpmkApproveDetail.builder().build().selectOne(new QueryWrapper<SpmkApproveDetail>()
.selectOne(new QueryWrapper<SpmkApproveDetail>()
.lambda() .lambda()
.select(SpmkApproveDetail::getId, .select(SpmkApproveDetail::getId,
SpmkApproveDetail::getRequestData, SpmkApproveDetail::getRequestData,
...@@ -594,9 +595,6 @@ public class SpmkController { ...@@ -594,9 +595,6 @@ public class SpmkController {
if (aSummary.getSts() != 3) { if (aSummary.getSts() != 3) {
SpmkApproveSummary.builder().id(approvingDto.getAsId()).endTime(new Date()).sts(2).build().updateById(); SpmkApproveSummary.builder().id(approvingDto.getAsId()).endTime(new Date()).sts(2).build().updateById();
//审批完成后 业务 //审批完成后 业务
SpmkAssoBusiness sab = SpmkAssoBusinessFactory.createSpmkAssoType(ApproveEnum.getEnums(aSummary.getAssoType())); SpmkAssoBusiness sab = SpmkAssoBusinessFactory.createSpmkAssoType(ApproveEnum.getEnums(aSummary.getAssoType()));
if (sab != null) if (sab != null)
...@@ -661,7 +659,7 @@ public class SpmkController { ...@@ -661,7 +659,7 @@ public class SpmkController {
.lambda() .lambda()
.select(SpmkApproveExecuteRecord::getId) .select(SpmkApproveExecuteRecord::getId)
.eq(SpmkApproveExecuteRecord::getApproveSummaryId, id)); .eq(SpmkApproveExecuteRecord::getApproveSummaryId, id));
if (listAer != null) { if (listAer != null && listAer.size() > 0) {
for (SpmkApproveExecuteRecord aer : listAer) { for (SpmkApproveExecuteRecord aer : listAer) {
spmkExecutorMapper.delete(new QueryWrapper<SpmkExecutor>().lambda().eq(SpmkExecutor::getApproveExecuteRecordId, aer.getId())); spmkExecutorMapper.delete(new QueryWrapper<SpmkExecutor>().lambda().eq(SpmkExecutor::getApproveExecuteRecordId, aer.getId()));
} }
...@@ -680,7 +678,7 @@ public class SpmkController { ...@@ -680,7 +678,7 @@ public class SpmkController {
* 删除-审批组、自定义审批、审批汇总、审批详情、审批执行记录、审批执行人记录 所有数据 * 删除-审批组、自定义审批、审批汇总、审批详情、审批执行记录、审批执行人记录 所有数据
*/ */
@DeleteMapping(value = "/delete_approval_data") @DeleteMapping(value = "/delete_approval_data")
@ApiOperation(value = "90.(开发使用)删除-审批数据", httpMethod = "DELETE", notes = "审批汇总、审批详情、审批执行记录、审批执行人记录 所有数据") @ApiOperation(value = "90.(开发使用)删除-审批数据", httpMethod = "DELETE", notes = "审批组、自定义审批、审批汇总、审批详情、审批执行记录、审批执行人记录 所有数据")
@ApiOperationSupport(order = 90) @ApiOperationSupport(order = 90)
public Result<Object> deleteApprovalData(@CurrentUser UserBean userBean){ public Result<Object> deleteApprovalData(@CurrentUser UserBean userBean){
...@@ -690,7 +688,7 @@ public class SpmkController { ...@@ -690,7 +688,7 @@ public class SpmkController {
spmkApproveDetailMapper.delete(null); spmkApproveDetailMapper.delete(null);
spmkApproveExecuteRecordMapper.delete(null); spmkApproveExecuteRecordMapper.delete(null);
spmkExecutorMapper.delete(null); spmkExecutorMapper.delete(null);
System.out.println("删除-审批汇总、审批详情、审批执行记录、审批执行人记录 所有数据 完成!"); System.out.println("删除-审批组、自定义审批、审批汇总、审批详情、审批执行记录、审批执行人记录 所有数据 完成!");
return ResultUtil.data(null, "操作成功!"); return ResultUtil.data(null, "操作成功!");
} }
......
...@@ -49,6 +49,7 @@ import cn.hutool.core.collection.ListUtil; ...@@ -49,6 +49,7 @@ import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.date.BetweenFormater.Level; import cn.hutool.core.date.BetweenFormater.Level;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.timer.api.bean.clazz.CommonArea;
import cn.timer.api.bean.qyzx.QyzxEmpEntAsso; import cn.timer.api.bean.qyzx.QyzxEmpEntAsso;
import cn.timer.api.bean.qyzx.QyzxEmpLogin; import cn.timer.api.bean.qyzx.QyzxEmpLogin;
import cn.timer.api.bean.yggl.YgglAttaClfjb; import cn.timer.api.bean.yggl.YgglAttaClfjb;
...@@ -71,6 +72,7 @@ import cn.timer.api.config.annotation.UserBean; ...@@ -71,6 +72,7 @@ import cn.timer.api.config.annotation.UserBean;
import cn.timer.api.config.enuminterface.YgEnumInterface; import cn.timer.api.config.enuminterface.YgEnumInterface;
import cn.timer.api.config.enums.CommonEnum; import cn.timer.api.config.enums.CommonEnum;
import cn.timer.api.controller.yggl.service.YgglService; import cn.timer.api.controller.yggl.service.YgglService;
import cn.timer.api.dao.clazz.CommonAreaMapper;
import cn.timer.api.dao.qyzx.QyzxEmpLoginMapper; import cn.timer.api.dao.qyzx.QyzxEmpLoginMapper;
import cn.timer.api.dao.yggl.YgAreaDtoMapper; import cn.timer.api.dao.yggl.YgAreaDtoMapper;
import cn.timer.api.dao.yggl.YgCityDtoMapper; import cn.timer.api.dao.yggl.YgCityDtoMapper;
...@@ -1661,6 +1663,25 @@ public class YgglController { ...@@ -1661,6 +1663,25 @@ public class YgglController {
List<YgmzDto> mz = new LambdaQueryChainWrapper<YgmzDto>(ygMzDtoMapper).eq(YgmzDto::getNumber, id).list(); List<YgmzDto> mz = new LambdaQueryChainWrapper<YgmzDto>(ygMzDtoMapper).eq(YgmzDto::getNumber, id).list();
return ResultUtil.data(mz, "展示该民族"); return ResultUtil.data(mz, "展示该民族");
} }
@Autowired
CommonAreaMapper commonAreaMapper;
/**
* 籍贯树-Mini
*
* @param
* @return
*/
@GetMapping(value = "/native_place")
@ApiOperation(value = "籍贯树-Mini", httpMethod = "GET", notes = "籍贯树-Mini")
@ApiOperationSupport(order = 60)
public Result<List<CommonArea>> selectNativePlace() {
List<CommonArea> listCommonArea = commonAreaMapper.AllAreaForTree();
return ResultUtil.data(listCommonArea, "操作成功!");
}
/** /**
* 展示籍贯/展示所有籍贯 * 展示籍贯/展示所有籍贯
......
package cn.timer.api.dao.clazz;
import java.util.List;
import org.springframework.stereotype.Repository;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.timer.api.bean.clazz.CommonArea;
/**
* 地区
* @author Tang 2020-05-09
*/
@Repository
public interface CommonAreaMapper extends BaseMapper<CommonArea> {
List<CommonArea> AllAreaForTree();
}
...@@ -31,7 +31,6 @@ public class SpmkApproveSummaryDto{ ...@@ -31,7 +31,6 @@ public class SpmkApproveSummaryDto{
@ApiModelProperty(value = "审批名称 ", example = "审批名称", required = true) @ApiModelProperty(value = "审批名称 ", example = "审批名称", required = true)
private String approveName; private String approveName;
@NotBlank(message = "digest为空")
@ApiModelProperty(value = "摘要", example = "摘要", required = true) @ApiModelProperty(value = "摘要", example = "摘要", required = true)
private String digest; private String digest;
......
package cn.timer.api.utils;
import java.io.Serializable;
import lombok.Data;
@Data
public class ApiReturnObject implements Serializable{
private static final long serialVersionUID = 1L;
public ApiReturnObject(String errorCode, Object errorMessage, Object returnObject) {
super();
this.errorCode = errorCode;
this.errorMessage = errorMessage;
this.returnObject = returnObject;
}
public ApiReturnObject(Object errorMessage, Object returnObject) {
super();
this.errorMessage = errorMessage;
this.returnObject = returnObject;
}
String errorCode="00";
Object errorMessage;
Object returnObject;
String pageNumber;
String pageSize;
String totalElements;
String totalPages;
public ApiReturnObject(String pageNumber,String pageSize,String totalElements,String totalPages,String errorCode, Object errorMessage, Object returnObject) {
super();
this.pageNumber = pageNumber;
this.errorCode = errorCode;
this.errorMessage = errorMessage;
this.returnObject = returnObject;
this.pageSize = pageSize;
this.totalElements = totalElements;
this.totalPages = totalPages;
}
}
package cn.timer.api.utils;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
public class ApiReturnUtil implements Serializable{
private static final long serialVersionUID = 1L;
public static ApiReturnObject error(Object errorMessage) {
System.out.println(errorMessage);
List<Object> object=new ArrayList<Object>();
return new ApiReturnObject("01",errorMessage,object);
}
public static ApiReturnObject error(Object errorMessage, Object returnObject) {
List<Object> object=new ArrayList<Object>();
object.add(returnObject);
return new ApiReturnObject("01",errorMessage,object);
}
public static ApiReturnObject success(Object returnObject) {
if(returnObject instanceof java.util.List){
return new ApiReturnObject("00","success",returnObject);
}else {
List<Object> object=new ArrayList<Object>();
object.add(returnObject);
return new ApiReturnObject("00","success",object);
}
}
public static ApiReturnObject success(Object errorMessage, Object returnObject) {
if(returnObject instanceof java.util.List){
return new ApiReturnObject("00",errorMessage,returnObject);
}else {
List<Object> object=new ArrayList<Object>();
object.add(returnObject);
return new ApiReturnObject("00",errorMessage,object);
}
}
public static ApiReturnObject pageManual(Integer pageNumber, Integer pageSize,Integer countNum, List<Void> returnObject) {
return new ApiReturnObject(pageNumber+"",pageSize+"",countNum+"",getTotalPages(countNum, pageSize),"00","success",returnObject);
}
public static String getTotalPages(Integer countNum, Integer pageSize) {
if((countNum%pageSize)==0) {
return ((countNum/pageSize))+"";
}else {
return ((countNum/pageSize)+1)+"";
}
}
}
package cn.timer.api.utils;
import java.lang.reflect.Field;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.reflect.FieldUtils;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFDataFormat;
import org.apache.poi.hssf.usermodel.HSSFDateUtil;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.apache.poi.ss.usermodel.Cell;
import org.springframework.web.multipart.MultipartFile;
/**
*
* @author Tang
* @date 2019年7月26日
*
*/
public class ImportExcelUntil {
/**
* 拼装单个obj
*
* @param obj
* @param row
* @return
* @throws Exception
*/
private static Map<String, Object> dataObj(Object obj, HSSFRow row)
throws Exception {
Class<?> rowClazz = obj.getClass();
Field[] fields = FieldUtils.getAllFields(rowClazz);
if (fields == null || fields.length < 1) {
return null;
}
// 容器
Map<String, Object> map = new HashMap<String, Object>();
// 注意excel表格字段顺序要和obj字段顺序对齐 (如果有多余字段请另作特殊下标对应处理)
for (int j = 0; j < fields.length; j++) {
map.put(fields[j].getName(), getVal(row.getCell(j)));
}
return map;
}
@SuppressWarnings("deprecation")
public static List<Map<String, Object>> importExcel(MultipartFile file,Object obj) throws Exception {
// 装载流
POIFSFileSystem fs = new POIFSFileSystem(file.getInputStream());
HSSFWorkbook hw = new HSSFWorkbook(fs);
// 获取第一个sheet页
HSSFSheet sheet = hw.getSheetAt(0);
// 容器
List<Map<String, Object>> ret = new ArrayList<Map<String, Object>>();
// 遍历行 从下标第一行开始(去除标题)
for (int i = 1; i < sheet.getLastRowNum() + 1; i++) {
HSSFRow row = sheet.getRow(i);
String result = new String();
if (row != null) {
// 装载obj
for (int k = 0; k < row.getLastCellNum(); k++) {
HSSFCell cell = row.getCell(k);
if (null != cell) {
switch (cell.getCellType()) {
case HSSFCell.CELL_TYPE_NUMERIC: // 数字
// System.out.print(cell.getNumericCellValue()
// + " ");
// System.out.print( new DecimalFormat("#").format(cellValue));
DecimalFormat df=new DecimalFormat("0");
String cellValue = df.format(cell.getNumericCellValue());;
if(cellValue.lastIndexOf("E")>-1){
cell.setCellValue(new DecimalFormat("#").format(cell.getNumericCellValue()));
}
String str = String.valueOf(cell);
if (str.indexOf(".0") != -1 || str.indexOf("-") != -1) {
if (HSSFDateUtil.isCellDateFormatted(cell)) {// 处理日期格式、时间格式
SimpleDateFormat sdf = null;
if (cell.getCellStyle().getDataFormat() == HSSFDataFormat.getBuiltinFormat("h:mm")) {
sdf = new SimpleDateFormat("HH:mm");
} else {// 日期
sdf = new SimpleDateFormat("yyyyMMdd");
}
Date date = cell.getDateCellValue();
result = sdf.format(date);
cell.setCellValue(result);
} else if (cell.getCellStyle().getDataFormat() == 176) {
// 处理自定义日期格式:m月d日(通过判断单元格的格式id解决,id的值是58)
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
double value = cell.getNumericCellValue();
Date date = org.apache.poi.ss.usermodel.DateUtil.getJavaDate(value);
result = sdf.format(date);
cell.setCellValue(result);
} else if(cell.getCellStyle().getDataFormat() == 14 || cell.getCellStyle().getDataFormat() == 31){
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
double value = cell.getNumericCellValue();
Date date = org.apache.poi.ss.usermodel.DateUtil.getJavaDate(value);
result = sdf.format(date);
cell.setCellValue(result);
}
System.out.println(result);
}
break;
case HSSFCell.CELL_TYPE_STRING: // 字符串
// System.out.print(cell.getStringCellValue()
// + " ");
break;
case HSSFCell.CELL_TYPE_BOOLEAN: // Boolean
// System.out.println(cell.getBooleanCellValue()
// + " ");
break;
case HSSFCell.CELL_TYPE_FORMULA: // 公式
// System.out.print(cell.getCellFormula() + " ");
break;
case HSSFCell.CELL_TYPE_BLANK: // 空值
// System.out.println(" ");
break;
case HSSFCell.CELL_TYPE_ERROR: // 故障
// System.out.println(" ");
break;
default:
// System.out.print("未知类型 ");
break;
}
}
}
ret.add(dataObj(obj, row));
}
}
hw.close();
return ret;
}
/**
* 处理val(暂时只处理string和number,可以自己添加自己需要的val类型)
*
* @param hssfCell
* @return
*/
@SuppressWarnings("deprecation")
public static String getVal(HSSFCell hssfCell) {
if(hssfCell!=null){
hssfCell.setCellType(Cell.CELL_TYPE_STRING);
return hssfCell.getStringCellValue();
}else {
return "";
}
}
}
\ No newline at end of file
package cn.timer.api.utils;
import java.util.Calendar;
import java.util.Date;
public class LevelPriceDateFromatUtils {
/**
* 时间运算
* @param unit
* @param num
* @param time
* @return
*/
public static Long getTimestampByUnitAndNumAddTime(String unit,Long num,Long time) {
//单位 1天 2月 3季 4年 5两年
Calendar calendar = LevelPriceDateFromatUtils.getCalendarByTimestamp(time);
switch (unit) {
case "1":
calendar.add(Calendar.DATE, num.intValue());
break;
case "2":
calendar.add(Calendar.DAY_OF_MONTH, num.intValue());
break;
case "3":
calendar.add(Calendar.DAY_OF_MONTH, num.intValue()*3);//一季度等于三个月
break;
case "4":
calendar.add(Calendar.YEAR, num.intValue());
break;
case "5":
calendar.add(Calendar.YEAR, num.intValue()*2);
for (int i = 0; i < num; i++) {
calendar.add(Calendar.YEAR, 1);//买二送一
}
break;
default:
break;
}
return calendar.getTimeInMillis();
}
public static Calendar getCalendarByTimestamp(Long time) {
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(time);
return cal;
}
public static Long getTimestampByNow() {
Date date = new Date();
return date.getTime();
}
public static void main(String[] args) {
//System.out.println(3/2);
System.out.println(getCalendarByTimestamp(0L).get(Calendar.YEAR));
}
}
package cn.timer.api.utils;
import java.text.SimpleDateFormat;
/**
* 随机数生成
* @author Administrator
*/
public class NumberedGeneration {
public static Integer test(int l) {
String str = new SimpleDateFormat("yy-mm-dd")
.format(new java.util.Date());
long m = Long.parseLong((str));
Integer ret = (int) (m + l);
long n = l + 1;
System.out.println(n);
return ret+1000;
}
public static Integer six() {
Integer ret =(int)((Math.random()*9+1)*100000);
return ret;
}
public static Integer eight() {
Integer ret =(int)((Math.random()*9+1)*10000000);
return ret;
}
public static Integer nine() {
Integer ret =(int)((Math.random()*9+1)*100000000);
return ret;
}
public static Integer test2() {
Integer ret = (int) (Math.random()*9000+1000);
return ret;
}
public static void main(String[] args) {
//System.out.println(six());
}
}
package cn.timer.api.utils;
import java.io.Serializable;
import org.springframework.stereotype.Service;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* @Description:Json返回结果集工具类
* @Package:org.jeese.model
* @author:wubc
* @version:1.0
* @date:2017年10月30日-下午1:51:24
* @Copyright:2017 Inc. All rights reserved.
*/
@ApiModel
@Service("responseResultnew")
public class ResponseResultNew<T> implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value="code",example="101")
private String code;
@ApiModelProperty(value="result",example="101")
private boolean result;
@ApiModelProperty(value="message",example="101")
private String message;
@ApiModelProperty(value="data",example="101")
private T data;
// private List<T> datas;
//
// private T page;
//
//
// private static final String PAGE_KEY = "page";
// private static final String NUMBER_KEY = "number";
// private static final String SIZE_KEY = "size";
// private static final String TOTALELEMENTS_KEY = "totalelements";
// private static final String TOTALPAGES_KEY = "totalpages";
// private static final String OFFSET_KEY = "offset";
private static final String MESSAGE_SUCCESS = "操作成功";
// private static final String MESSAGE_FAIL = "操作失败";
// private static final String MESSAGE_ERROR = "操作错误";
// private static final String MESSAGE_UNLOGIN = "会话超时,请重新登录";
// private static final String MESSAGE_KICKOUT = "当前账户已在其他地方登录,请重新登录";
// private static final String MESSAGE_PARAMERROR = "参数错误";
// private static final String MESSAGE_UNAUTHORIZED = "授权错误";
// private static final String MESSAGE_UNAUTHENTICATED = "认证错误";
// private static final String MESSAGE_EXCEPTION = "服务器异常";
private static final String STATUS_CODE_SUCCESS = "200";
// private static final String STATUS_CODE_FAIL = "201";
// private static final String STATUS_CODE_ERROR = "202";
// private static final String STATUS_CODE_UNLOGIN = "301";
// private static final String STATUS_CODE_KICKOUT = "302";
// private static final String STATUS_CODE_UNPARAM = "400";
// private static final String STATUS_CODE_UNAUTHORIZED = "401";
// private static final String STATUS_CODE_UNAUTHENTICATED = "405";
// private static final String STATUS_CODE_EXCEPTION = "500";
public ResponseResultNew() {
this.code = STATUS_CODE_SUCCESS;
this.result = Boolean.TRUE;
this.message = MESSAGE_SUCCESS;
this.data = null;
}
/**
* 请求成功
*
* @return
*/
@SuppressWarnings("rawtypes")
public ResponseResultNew success() {
this.code = STATUS_CODE_SUCCESS;
this.result = Boolean.TRUE;
this.message = MESSAGE_SUCCESS;
this.data = null;
return this;
}
/**
* 请求成功,并带消息
*
* @param message
* @return
*/
@SuppressWarnings("rawtypes")
public ResponseResultNew success(String message) {
this.code = STATUS_CODE_SUCCESS;
this.result = Boolean.TRUE;
this.message = message;
this.data = null;
return this;
}
@SuppressWarnings("rawtypes")
public ResponseResultNew fail(String message) {
this.code = STATUS_CODE_SUCCESS;
this.result = Boolean.TRUE;
this.message = message;
this.data = null;
return this;
}
/**
* @param obj
* @return
*/
@SuppressWarnings("rawtypes")
public ResponseResultNew successData(T data) {
this.code = STATUS_CODE_SUCCESS;
this.result = Boolean.TRUE;
this.message = MESSAGE_SUCCESS;
this.data = data;
return this;
}
}
...@@ -3,8 +3,10 @@ package cn.timer.api.utils; ...@@ -3,8 +3,10 @@ package cn.timer.api.utils;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.ObjectInputStream; import java.io.ObjectInputStream;
import java.util.List; import java.util.List;
/** /**
* 反序列化 * 反序列化
*
* @author Administrator * @author Administrator
*/ */
public class SerializationUtils { public class SerializationUtils {
...@@ -24,7 +26,7 @@ public class SerializationUtils { ...@@ -24,7 +26,7 @@ public class SerializationUtils {
} }
} }
public static Object toSerializationObject(byte[] object) { public static Object toSerializationObject(byte[] object) {
try { try {
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(object); ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(object);
...@@ -37,7 +39,7 @@ public class SerializationUtils { ...@@ -37,7 +39,7 @@ public class SerializationUtils {
e.printStackTrace(); e.printStackTrace();
return null; return null;
} }
} }
} }
...@@ -11,8 +11,8 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; ...@@ -11,8 +11,8 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.convert.ConvertException;
import cn.hutool.core.lang.Console; import cn.hutool.core.lang.Console;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.json.JSONObject; import cn.hutool.json.JSONObject;
import cn.timer.api.bean.spmk.SpmkApproveExecuteRecord; import cn.timer.api.bean.spmk.SpmkApproveExecuteRecord;
import cn.timer.api.bean.spmk.SpmkApproveSummary; import cn.timer.api.bean.spmk.SpmkApproveSummary;
...@@ -44,12 +44,12 @@ public class RouterUtils { ...@@ -44,12 +44,12 @@ public class RouterUtils {
private final static String RELATION_TYPE_DEPARTMENT = "department"; private final static String RELATION_TYPE_DEPARTMENT = "department";
private final static String RELATION_TYPE_USERS = "users"; private final static String RELATION_TYPE_USERS = "users";
public static List<Router> NextNode(List<Router> listRouter,JSONObject obj, boolean isFirse) { public static List<Router> NextNode(List<Router> listRouter,JSONObject obj, boolean isFirse) throws NumberFormatException, ConvertException, Exception {
return NextNode(listRouter, obj, isFirse, false); return NextNode(listRouter, obj, isFirse, false);
} }
// 执行下一个节点 // 执行下一个节点
public static List<Router> NextNode(List<Router> listRouter,JSONObject obj, boolean isFirse, boolean isAuditNext) { public static List<Router> NextNode(List<Router> listRouter,JSONObject obj, boolean isFirse, boolean isAuditNext) throws NumberFormatException, ConvertException, Exception {
Router router; Router router;
if (listRouter != null && listRouter.size() != 0) { if (listRouter != null && listRouter.size() != 0) {
...@@ -261,39 +261,6 @@ public class RouterUtils { ...@@ -261,39 +261,6 @@ public class RouterUtils {
} }
private static boolean stringCompare(String s1,String s2,String symbol) {
double d1;
double d2;
switch (symbol) {
case "<":
d1 = Double.parseDouble(s1);
d2 = Double.parseDouble(s2);
if (NumberUtil.compare(d1,d2) == -1) return true;
break;
case "<=":
d1 = Double.parseDouble(s1);
d2 = Double.parseDouble(s2);
if (NumberUtil.compare(d1,d2) == -1 || NumberUtil.compare(d1,d2) == 0) return true;
break;
case "=":
if (s2.equals(s1)) return true;
break;
case ">":
d1 = Double.parseDouble(s1);
d2 = Double.parseDouble(s2);
if (NumberUtil.compare(d1,d2) == 1) return true;
break;
case ">=":
d1 = Double.parseDouble(s1);
d2 = Double.parseDouble(s2);
if (NumberUtil.compare(d1,d2) == 0 || NumberUtil.compare(d1,d2) == 1) return true;
break;
}
return false;
}
public static void getIsFlowChildren(List<Router> listRouter, List<FlowChildren> listFlowChildren) { public static void getIsFlowChildren(List<Router> listRouter, List<FlowChildren> listFlowChildren) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
Router router; Router router;
...@@ -320,7 +287,7 @@ public class RouterUtils { ...@@ -320,7 +287,7 @@ public class RouterUtils {
// 审批执行记录 持久化 // 审批执行记录 持久化
public static void insertogExecuteRecord(List<FlowChildren> listFlowChildren,Integer asId) { public static void insertogExecuteRecord(List<FlowChildren> listFlowChildren,Integer asId) throws Exception{
for (int i = 0,m = listFlowChildren.size() ; i < m; i++) { for (int i = 0,m = listFlowChildren.size() ; i < m; i++) {
if (UNEXECUTED.equals(listFlowChildren.get(i).getExecute())) { if (UNEXECUTED.equals(listFlowChildren.get(i).getExecute())) {
...@@ -429,7 +396,7 @@ public class RouterUtils { ...@@ -429,7 +396,7 @@ public class RouterUtils {
* @param opinion 意见 * @param opinion 意见
* @param sts 状态 1执行中 2通过 3拒绝 * @param sts 状态 1执行中 2通过 3拒绝
*/ */
public static void approving(List<FlowChildren> listFlowChildren,Integer asId,Integer executeRecordId, Integer executorId, String opinion,Integer sts,User redeployUser ) { public static void approving(List<FlowChildren> listFlowChildren,Integer asId,Integer executeRecordId, Integer executorId, String opinion,Integer sts,User redeployUser ) throws Exception {
boolean hasNextApprover = false; boolean hasNextApprover = false;
......
<?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="cn.timer.api.dao.clazz.CommonAreaMapper">
<resultMap id="BaseResultMap" type="cn.timer.api.bean.clazz.CommonArea" >
<id column="code_id" property="codeId" />
<result column="parent_id" property="parentId" />
<result column="city_name" property="cityName" />
</resultMap>
<resultMap id="BaseResultMap_b" type="cn.timer.api.bean.clazz.CommonArea" >
<id column="code_id" property="codeId" />
<result column="parent_id" property="parentId" />
<result column="city_name" property="cityName" />
<collection column="CommonArea_c_code_id" property="commonAreas" ofType="cn.timer.api.bean.clazz.CommonArea"
resultMap="cn.timer.api.dao.clazz.CommonAreaMapper.BaseResultMap" columnPrefix="CommonArea_c_">
</collection>
</resultMap>
<resultMap id="BaseResultMap_Tree" type="cn.timer.api.bean.clazz.CommonArea" >
<id column="code_id" property="codeId" />
<result column="parent_id" property="parentId" />
<result column="city_name" property="cityName" />
<collection column="CommonArea_b_code_id" property="commonAreas" ofType="cn.timer.api.bean.clazz.CommonArea"
resultMap="cn.timer.api.dao.clazz.CommonAreaMapper.BaseResultMap_b" columnPrefix="CommonArea_b_">
</collection>
</resultMap>
<sql id="Base_Column_List">
code_id,
parent_id,
city_name
</sql>
<sql id="Base_Column_List_Alias">
code_id CommonArea_code_id,
parent_id CommonArea_parent_id,
city_name CommonArea_city_name
</sql>
<sql id="Base_Column_List_Alias_a">
a.code_id code_id,
a.parent_id parent_id,
a.city_name city_name
</sql>
<sql id="Base_Column_List_Alias_b">
b.code_id CommonArea_b_code_id,
b.parent_id CommonArea_b_parent_id,
b.city_name CommonArea_b_city_name
</sql>
<sql id="Base_Column_List_Alias_c">
c.code_id CommonArea_b_CommonArea_c_code_id,
c.parent_id CommonArea_b_CommonArea_c_parent_id,
c.city_name CommonArea_b_CommonArea_c_city_name
</sql>
<select id="AllAreaForTree" resultMap="BaseResultMap_Tree">
SELECT
<include refid="Base_Column_List_Alias_a" />,
<include refid="Base_Column_List_Alias_b" />,
<include refid="Base_Column_List_Alias_c" />
FROM common_area a
LEFT JOIN common_area b ON a.code_id = b.parent_id
LEFT JOIN common_area c ON b.code_id = c.parent_id
WHERE a.parent_id = 0
</select>
<!--
<insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.clazz.CommonArea">
INSERT INTO common_area
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test ='null != codeId'>
code_id,
</if>
<if test ='null != parentId'>
parent_id,
</if>
<if test ='null != cityName'>
city_name
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test ='null != codeId'>
#{codeId},
</if>
<if test ='null != parentId'>
#{parentId},
</if>
<if test ='null != cityName'>
#{cityName}
</if>
</trim>
</insert>
<delete id="delete" >
DELETE FROM common_area
WHERE id = #{id}
</delete>
<update id="update" parameterType="cn.timer.api.bean.clazz.CommonArea">
UPDATE common_area
<set>
<if test ='null != codeId'>code_id = #{codeId},</if>
<if test ='null != parentId'>parent_id = #{parentId},</if>
<if test ='null != cityName'>city_name = #{cityName}</if>
</set>
WHERE id = #{id}
</update>
<select id="load" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List" />
FROM common_area
WHERE id = #{id}
</select>
<select id="pageList" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List" />
FROM common_area
LIMIT #{offset}, #{pageSize}
</select>
<select id="pageListCount" resultType="java.lang.Integer">
SELECT count(1)
FROM common_area
</select>
-->
</mapper>
\ No newline at end of file
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
<result column="current_approver" property="currentApprover" /> <result column="current_approver" property="currentApprover" />
<result column="history_approver" property="historyApprover" /> <result column="history_approver" property="historyApprover" />
<result column="asso_type" property="assoType" /> <result column="asso_type" property="assoType" />
<result column="digest" property="digest" />
<result column="update_time" property="updateTime" /> <result column="update_time" property="updateTime" />
<result column="end_time" property="endTime" /> <result column="end_time" property="endTime" />
<result column="digest" property="digest" /> <result column="digest" property="digest" />
...@@ -37,7 +38,6 @@ ...@@ -37,7 +38,6 @@
<result column="update_time" property="updateTime" /> <result column="update_time" property="updateTime" />
<result column="end_time" property="endTime" /> <result column="end_time" property="endTime" />
<result column="digest" property="digest" /> <result column="digest" property="digest" />
<result column="gw_name" property="gwName" /> <result column="gw_name" property="gwName" />
<result column="bm_id" property="bmId" /> <result column="bm_id" property="bmId" />
<result column="bm_name" property="bmName" /> <result column="bm_name" property="bmName" />
......
<?xml version="1.0" encoding="UTF-8"?>
<!--
This is the JRebel configuration file. It maps the running application to your IDE workspace, enabling JRebel reloading for this project.
Refer to https://manuals.jrebel.com/jrebel/standalone/config.html for more information.
-->
<application generated-by="eclipse" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.zeroturnaround.com" xsi:schemaLocation="http://www.zeroturnaround.com http://update.zeroturnaround.com/jrebel/rebel-2_1.xsd">
<classpath>
<dir name="C:/Users/Administrator/git/8timerapiv200/target/classes">
</dir>
</classpath>
</application>
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