commit
d8768fe744
@ -0,0 +1,31 @@ |
|||||||
|
package com.dxhy.core.dao; |
||||||
|
|
||||||
|
|
||||||
|
import com.dxhy.core.entity.GsClient; |
||||||
|
import org.apache.ibatis.annotations.Mapper; |
||||||
|
import org.apache.ibatis.annotations.Param; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
@Mapper |
||||||
|
public interface GsClientMapper { |
||||||
|
int deleteByPrimaryKey(Integer id); |
||||||
|
|
||||||
|
int deleteAll(); |
||||||
|
|
||||||
|
int insert(GsClient record); |
||||||
|
|
||||||
|
int insertSelective(GsClient record); |
||||||
|
|
||||||
|
int insertList(@Param("list") List<GsClient> recordList); |
||||||
|
|
||||||
|
GsClient selectByPrimaryKey(Integer id); |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
List<GsClient> selectByGsdm(String gsdm); |
||||||
|
|
||||||
|
int updateByPrimaryKeySelective(GsClient record); |
||||||
|
|
||||||
|
int updateByPrimaryKey(GsClient record); |
||||||
|
} |
@ -0,0 +1,32 @@ |
|||||||
|
package com.dxhy.core.entity; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
/** |
||||||
|
* @Description: PO输出参数 |
||||||
|
* @Author liufeilong |
||||||
|
* @Date 2023-02-06 |
||||||
|
**/ |
||||||
|
@Data |
||||||
|
public class EsOutput { |
||||||
|
/** |
||||||
|
* 外围系统数据唯一标识 |
||||||
|
*/ |
||||||
|
private String BSKEY; |
||||||
|
/** |
||||||
|
* SAP数据唯一标识 |
||||||
|
*/ |
||||||
|
private String SAPKEY; |
||||||
|
/** |
||||||
|
* 数据处理标识(S:成功,E:失败) |
||||||
|
*/ |
||||||
|
private String ZTYPE; |
||||||
|
/** |
||||||
|
* 数据处理描述 |
||||||
|
*/ |
||||||
|
private String ZMESSAGE; |
||||||
|
/** |
||||||
|
* 业务报文 |
||||||
|
*/ |
||||||
|
private Object ZDATA; |
||||||
|
} |
@ -0,0 +1,19 @@ |
|||||||
|
package com.dxhy.core.entity; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
import java.util.Date; |
||||||
|
|
||||||
|
@Data |
||||||
|
public class GsClient { |
||||||
|
private Integer id; |
||||||
|
|
||||||
|
private String gsdm; |
||||||
|
|
||||||
|
private String gsmc; |
||||||
|
|
||||||
|
private String client; |
||||||
|
|
||||||
|
private Date createTime; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,16 @@ |
|||||||
|
package com.dxhy.core.entity; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
/** |
||||||
|
* @Description: PO接口公共响应参数 |
||||||
|
* @Author liufeilong |
||||||
|
* @Date 2023-02-06 |
||||||
|
**/ |
||||||
|
@Data |
||||||
|
public class PoCommonResponseParam { |
||||||
|
/** |
||||||
|
* ES_OUTPUT |
||||||
|
*/ |
||||||
|
private EsOutput ES_OUTPUT; |
||||||
|
} |
@ -0,0 +1,136 @@ |
|||||||
|
package com.dxhy.core.task; |
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil; |
||||||
|
import com.alibaba.fastjson.JSONObject; |
||||||
|
import com.dxhy.common.constant.DbConstant; |
||||||
|
import com.dxhy.common.controller.AbstractController; |
||||||
|
import com.dxhy.common.datasource.config.DynamicContextHolder; |
||||||
|
import com.dxhy.core.dao.ConfirmDao; |
||||||
|
import com.dxhy.core.dao.GsClientMapper; |
||||||
|
import com.dxhy.core.entity.EsOutput; |
||||||
|
import com.dxhy.core.entity.GsClient; |
||||||
|
import com.dxhy.core.entity.PoCommonResponseParam; |
||||||
|
import com.dxhy.core.job.entity.SNSAPObject; |
||||||
|
import com.dxhy.core.job.entity.ScheduleJobEntity; |
||||||
|
import com.dxhy.core.job.service.InvoiceInterfaceService; |
||||||
|
import com.dxhy.core.job.service.ScheduleJobService; |
||||||
|
import com.dxhy.core.util.HttpUtils; |
||||||
|
import com.dxhy.core.util.JsonUtils; |
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
|
import org.springframework.beans.factory.annotation.Value; |
||||||
|
import org.springframework.stereotype.Component; |
||||||
|
|
||||||
|
import javax.annotation.Resource; |
||||||
|
import java.util.*; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author fth |
||||||
|
* @date 2018年04月13日 下午10:57:22 |
||||||
|
*/ |
||||||
|
@SuppressWarnings({"rawtypes", "DuplicatedCode"}) |
||||||
|
@Component("sdnyClientTask") |
||||||
|
@Slf4j |
||||||
|
public class SdnyClientTask extends AbstractController { |
||||||
|
|
||||||
|
private static final String LOGGER_MSG = "(SAP获取公司client)"; |
||||||
|
|
||||||
|
@Value("${sdny.snYxUrl}") |
||||||
|
private String snYxUrl; |
||||||
|
|
||||||
|
@Value("${po.userName}") |
||||||
|
private String userName; |
||||||
|
|
||||||
|
@Value("${po.password}") |
||||||
|
private String password; |
||||||
|
|
||||||
|
@Resource |
||||||
|
private GsClientMapper gsClientMapper; |
||||||
|
|
||||||
|
@Resource |
||||||
|
private InvoiceInterfaceService invoiceInterfaceService; |
||||||
|
@Resource |
||||||
|
private ConfirmDao confirmDao; |
||||||
|
@Resource |
||||||
|
private ScheduleJobService scheduleJobService; |
||||||
|
|
||||||
|
/** |
||||||
|
* 核心线程池大小 |
||||||
|
*/ |
||||||
|
private int corePoolSize = 10; |
||||||
|
/** |
||||||
|
* 最大线程池大小 |
||||||
|
*/ |
||||||
|
|
||||||
|
private int maximumPoolSize = 20; |
||||||
|
|
||||||
|
/** |
||||||
|
* @throws InterruptedException 异常 |
||||||
|
* @Desc 发票获取接口 |
||||||
|
*/ |
||||||
|
|
||||||
|
public void getSdnyClient() throws InterruptedException { |
||||||
|
log.info("获取山东能源Client定时任务开始"); |
||||||
|
DynamicContextHolder.push(DbConstant.BASICS_READ); |
||||||
|
ScheduleJobEntity scheduleJobEntity = scheduleJobService.queryByBeanName("sdnyClientTask", "getSdnyClient"); |
||||||
|
if (scheduleJobEntity != null && "0".equals(scheduleJobEntity.getJobStatus())) { |
||||||
|
try { |
||||||
|
scheduleJobEntity.setJobStatus("1"); |
||||||
|
DynamicContextHolder.push(DbConstant.BASICS_WRITE); |
||||||
|
scheduleJobService.updateById(scheduleJobEntity); |
||||||
|
// 准备请求参数
|
||||||
|
// 需判断 设置不认证状态
|
||||||
|
|
||||||
|
List<GsClient> list = new ArrayList<>(); |
||||||
|
long startTime = System.currentTimeMillis(); |
||||||
|
SNSAPObject object = new SNSAPObject(); |
||||||
|
object.setSYSID("FPXT"); |
||||||
|
object.setIFYWID("FI846"); |
||||||
|
object.setBSKEY(UUID.randomUUID().toString().replace("-", "")); |
||||||
|
object.setZFILED5("200"); |
||||||
|
object.setZDATA(""); |
||||||
|
|
||||||
|
//推送到SAP
|
||||||
|
log.info("推送山能数据:{}", JSONObject.toJSONString(object)); |
||||||
|
JSONObject request = new JSONObject(); |
||||||
|
request.put("IS_INPUT", object); |
||||||
|
|
||||||
|
log.info("{}获取公司client入参:{}", LOGGER_MSG, request.toJSONString()); |
||||||
|
String result = HttpUtils.sendPo(snYxUrl, request.toJSONString(), userName, password); |
||||||
|
log.info("{}获取公司client出参:{}", LOGGER_MSG, result); |
||||||
|
PoCommonResponseParam poCommonResponseParam = JsonUtils.getInstance().parseObject(result, PoCommonResponseParam.class); |
||||||
|
EsOutput es_output = poCommonResponseParam.getES_OUTPUT(); |
||||||
|
String ztype = es_output.getZTYPE(); |
||||||
|
String zmessage = es_output.getZMESSAGE(); |
||||||
|
Object zdata = es_output.getZDATA(); |
||||||
|
if ("s".equals(ztype)) { |
||||||
|
List<Map<String, String>> gsClientList = JsonUtils.getInstance().parseObject(zdata.toString(), List.class); |
||||||
|
gsClientList.stream().forEach(f -> { |
||||||
|
GsClient gsClient = new GsClient(); |
||||||
|
gsClient.setGsdm(ObjectUtil.isNull(f.get("BUKRS")) ? "" : f.get("BUKRS").toString()); |
||||||
|
gsClient.setGsmc(ObjectUtil.isNull(f.get("BUTXT")) ? "" : f.get("BUTXT").toString()); |
||||||
|
gsClient.setClient(ObjectUtil.isNull(f.get("MANDT")) ? "" : f.get("MANDT").toString()); |
||||||
|
gsClient.setCreateTime(new Date()); |
||||||
|
list.add(gsClient); |
||||||
|
}); |
||||||
|
} else { |
||||||
|
log.error("{}client:{},获取公司client出错:{}", LOGGER_MSG, "200", zmessage); |
||||||
|
} |
||||||
|
log.info("{}删除gs_client表数据", LOGGER_MSG); |
||||||
|
gsClientMapper.deleteAll(); |
||||||
|
log.info("{}插入gs_client表", LOGGER_MSG); |
||||||
|
gsClientMapper.insertList(list); |
||||||
|
long endTime = System.currentTimeMillis(); |
||||||
|
log.debug("{}任务结束,耗时:{}", LOGGER_MSG, endTime - startTime); |
||||||
|
|
||||||
|
} catch (Exception e) { |
||||||
|
e.printStackTrace(); |
||||||
|
} finally { |
||||||
|
log.info("获取山东能源Client定时任务--重置执行状态"); |
||||||
|
scheduleJobEntity.setJobStatus("0"); |
||||||
|
DynamicContextHolder.push(DbConstant.BASICS_WRITE); |
||||||
|
scheduleJobService.updateById(scheduleJobEntity); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,88 @@ |
|||||||
|
package com.dxhy.core.util; |
||||||
|
|
||||||
|
import cn.hutool.http.HttpRequest; |
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
|
|
||||||
|
import java.io.IOException; |
||||||
|
import java.util.HashMap; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author ZSC-DXHY |
||||||
|
*/ |
||||||
|
@Slf4j |
||||||
|
public class HttpUtils { |
||||||
|
|
||||||
|
private static final String LOGGER_MSG = "(请求http访问)"; |
||||||
|
|
||||||
|
/** |
||||||
|
* 执行post请求 |
||||||
|
* |
||||||
|
* @param url |
||||||
|
* @param paramMap |
||||||
|
* @return |
||||||
|
* @throws IOException |
||||||
|
*/ |
||||||
|
public static String doPost(String url, Map<String, ?> paramMap) { |
||||||
|
Map<String, Object> requestMap = new HashMap<>(paramMap); |
||||||
|
long startTime = System.currentTimeMillis(); |
||||||
|
String body = HttpRequest.post(url).form(requestMap).timeout(300000).execute().body(); |
||||||
|
long endTime = System.currentTimeMillis(); |
||||||
|
log.debug("{}以Map调用post请求url:{},耗时:{}", LOGGER_MSG, url, endTime - startTime); |
||||||
|
return body; |
||||||
|
} |
||||||
|
|
||||||
|
public static String doPost(String url, String request) { |
||||||
|
long startTime = System.currentTimeMillis(); |
||||||
|
String body = HttpRequest.post(url).body(request).timeout(300000).execute().body(); |
||||||
|
long endTime = System.currentTimeMillis(); |
||||||
|
log.debug("{}以字符串调用post请求url:{},耗时:{}", LOGGER_MSG, url, endTime - startTime); |
||||||
|
return body; |
||||||
|
} |
||||||
|
|
||||||
|
public static String doPostWithHeader(String url, String data, Map<String, String> header) { |
||||||
|
long startTime = System.currentTimeMillis(); |
||||||
|
String body = HttpRequest.post(url).addHeaders(header).body(data).timeout(300000).execute().body(); |
||||||
|
long endTime = System.currentTimeMillis(); |
||||||
|
log.debug("{}带head调用post请求url:{},耗时:{}", LOGGER_MSG, url, endTime - startTime); |
||||||
|
return body; |
||||||
|
} |
||||||
|
|
||||||
|
public static String doPostFormWithHeader(String url, Map<String, ?> paramMap, Map<String, String> header) { |
||||||
|
Map<String, Object> requestMap = new HashMap<>(paramMap); |
||||||
|
long startTime = System.currentTimeMillis(); |
||||||
|
String body = HttpRequest.post(url).addHeaders(header).form(requestMap).timeout(300000).execute().body(); |
||||||
|
long endTime = System.currentTimeMillis(); |
||||||
|
log.debug("{}带head和form调用post请求url:{},耗时:{}", LOGGER_MSG, url, endTime - startTime); |
||||||
|
return body; |
||||||
|
} |
||||||
|
|
||||||
|
public static String doGetWithHeader(String url, Map<String, String> header) { |
||||||
|
long startTime = System.currentTimeMillis(); |
||||||
|
String body = HttpRequest.get(url).addHeaders(header).timeout(300000).execute().body(); |
||||||
|
long endTime = System.currentTimeMillis(); |
||||||
|
log.debug("{}带head调用get请求url:{},耗时:{}", LOGGER_MSG, url, endTime - startTime); |
||||||
|
return body; |
||||||
|
} |
||||||
|
|
||||||
|
public static String doGet(String url, String request) { |
||||||
|
long startTime = System.currentTimeMillis(); |
||||||
|
String body = HttpRequest.get(url).body(request).timeout(300000).execute().body(); |
||||||
|
long endTime = System.currentTimeMillis(); |
||||||
|
log.debug("{}以字符串调用get请求url:{},耗时:{}", LOGGER_MSG, url, endTime - startTime); |
||||||
|
return body; |
||||||
|
} |
||||||
|
|
||||||
|
//请求山能PO
|
||||||
|
public static String sendPo(String url, String request,String userName,String password) { |
||||||
|
long startTime = System.currentTimeMillis(); |
||||||
|
HttpRequest httpRequest = new HttpRequest(url); |
||||||
|
httpRequest.basicAuth(userName,password); |
||||||
|
String body = httpRequest.body(request).timeout(300000).execute().body(); |
||||||
|
long endTime = System.currentTimeMillis(); |
||||||
|
log.debug("{}以字符串调用post请求url:{},耗时:{}", LOGGER_MSG, url, endTime - startTime); |
||||||
|
return body; |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
@ -0,0 +1,90 @@ |
|||||||
|
package com.dxhy.core.util; |
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON; |
||||||
|
import com.alibaba.fastjson.serializer.SerializeConfig; |
||||||
|
import com.alibaba.fastjson.serializer.SerializerFeature; |
||||||
|
import com.alibaba.fastjson.serializer.SimpleDateFormatSerializer; |
||||||
|
import com.alibaba.fastjson.util.TypeUtils; |
||||||
|
|
||||||
|
import java.sql.Timestamp; |
||||||
|
import java.util.Date; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author: chendognzhi |
||||||
|
* @Date: 2017年10月17日 |
||||||
|
* @Description: json转换工具 |
||||||
|
*/ |
||||||
|
public class JsonUtils { |
||||||
|
private JsonUtils() { |
||||||
|
} |
||||||
|
|
||||||
|
private static final SerializeConfig SERIALIZE_CONFIG = new SerializeConfig(); |
||||||
|
|
||||||
|
static { |
||||||
|
SERIALIZE_CONFIG.put(Date.class, new SimpleDateFormatSerializer("yyyy-MM-dd HH:mm:ss")); |
||||||
|
SERIALIZE_CONFIG.put(Timestamp.class, new SimpleDateFormatSerializer("yyyy-MM-dd HH:mm:ss")); |
||||||
|
/** |
||||||
|
* 设置json格式化第一个字母大写 |
||||||
|
*/ |
||||||
|
TypeUtils.compatibleWithJavaBean = true; |
||||||
|
} |
||||||
|
|
||||||
|
private static final JsonUtils HELPER = new JsonUtils(); |
||||||
|
|
||||||
|
public static JsonUtils getInstance() { |
||||||
|
return HELPER; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* parseObject(json转换为java bean) |
||||||
|
*/ |
||||||
|
public <T> T parseObject(String text, Class<T> clazz) { |
||||||
|
return JSON.parseObject(text, clazz); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* toJsonString(对象转换为json字符串) |
||||||
|
*/ |
||||||
|
public <T> String toJsonString(T obj) { |
||||||
|
return toJsonString(obj, SERIALIZE_CONFIG); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* toJsonString(对象转换为自定义格式的json字符串) |
||||||
|
*/ |
||||||
|
public <T> String toJsonString(T obj, SerializeConfig serializeConfig) { |
||||||
|
return JSON.toJSONString(obj, serializeConfig, SerializerFeature.DisableCircularReferenceDetect); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 把json串转为指定的对象 |
||||||
|
*/ |
||||||
|
public <T> T fromJson(String str, Class<T> clazz) { |
||||||
|
return JSON.parseObject(str, clazz); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 把对象转换 为json字符串 null的字符串转换为"" |
||||||
|
*/ |
||||||
|
|
||||||
|
public <T> String toJsonStringNullToEmpty(T obj) { |
||||||
|
return JSON.toJSONString(obj, SerializerFeature.WriteNullStringAsEmpty); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* json字符串转list |
||||||
|
*/ |
||||||
|
public <T> List<T> jsonToList(String text, Class<T> clazz) { |
||||||
|
|
||||||
|
return JSON.parseArray(text, clazz); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* json字符串转list |
||||||
|
*/ |
||||||
|
public <T> List<T> listBeanCopy(Object text, Class<T> clazz) { |
||||||
|
return JSON.parseArray(JSON.toJSONString(text), clazz); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,111 @@ |
|||||||
|
<?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="com.dxhy.core.dao.GsClientMapper" > |
||||||
|
<resultMap id="BaseResultMap" type="com.dxhy.core.entity.GsClient" > |
||||||
|
<id column="id" property="id" jdbcType="INTEGER" /> |
||||||
|
<result column="gsdm" property="gsdm" jdbcType="VARCHAR" /> |
||||||
|
<result column="gsmc" property="gsmc" jdbcType="VARCHAR" /> |
||||||
|
<result column="client" property="client" jdbcType="VARCHAR" /> |
||||||
|
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" /> |
||||||
|
</resultMap> |
||||||
|
<sql id="Base_Column_List" > |
||||||
|
id, gsdm, gsmc, client, create_time |
||||||
|
</sql> |
||||||
|
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" > |
||||||
|
select |
||||||
|
<include refid="Base_Column_List" /> |
||||||
|
from gs_client |
||||||
|
where id = #{id,jdbcType=INTEGER} |
||||||
|
</select> |
||||||
|
<select id="selectByGsdm" resultMap="BaseResultMap" parameterType="java.lang.String" > |
||||||
|
select |
||||||
|
<include refid="Base_Column_List" /> |
||||||
|
from gs_client |
||||||
|
where gsdm = #{gsdm,jdbcType=VARCHAR} |
||||||
|
</select> |
||||||
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" > |
||||||
|
delete from gs_client |
||||||
|
where id = #{id,jdbcType=INTEGER} |
||||||
|
</delete> |
||||||
|
<delete id="deleteAll" > |
||||||
|
delete from gs_client |
||||||
|
</delete> |
||||||
|
<insert id="insert" parameterType="com.dxhy.core.entity.GsClient" > |
||||||
|
insert into gs_client (id, gsdm, gsmc, |
||||||
|
client, create_time) |
||||||
|
values (#{id,jdbcType=INTEGER}, #{gsdm,jdbcType=VARCHAR}, #{gsmc,jdbcType=VARCHAR}, |
||||||
|
#{client,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}) |
||||||
|
</insert> |
||||||
|
<insert id="insertSelective" parameterType="com.dxhy.core.entity.GsClient" > |
||||||
|
insert into gs_client |
||||||
|
<trim prefix="(" suffix=")" suffixOverrides="," > |
||||||
|
<if test="id != null" > |
||||||
|
id, |
||||||
|
</if> |
||||||
|
<if test="gsdm != null" > |
||||||
|
gsdm, |
||||||
|
</if> |
||||||
|
<if test="gsmc != null" > |
||||||
|
gsmc, |
||||||
|
</if> |
||||||
|
<if test="client != null" > |
||||||
|
client, |
||||||
|
</if> |
||||||
|
<if test="createTime != null" > |
||||||
|
create_time, |
||||||
|
</if> |
||||||
|
</trim> |
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides="," > |
||||||
|
<if test="id != null" > |
||||||
|
#{id,jdbcType=INTEGER}, |
||||||
|
</if> |
||||||
|
<if test="gsdm != null" > |
||||||
|
#{gsdm,jdbcType=VARCHAR}, |
||||||
|
</if> |
||||||
|
<if test="gsmc != null" > |
||||||
|
#{gsmc,jdbcType=VARCHAR}, |
||||||
|
</if> |
||||||
|
<if test="client != null" > |
||||||
|
#{client,jdbcType=VARCHAR}, |
||||||
|
</if> |
||||||
|
<if test="createTime != null" > |
||||||
|
#{createTime,jdbcType=TIMESTAMP}, |
||||||
|
</if> |
||||||
|
</trim> |
||||||
|
</insert> |
||||||
|
<update id="updateByPrimaryKeySelective" parameterType="com.dxhy.core.entity.GsClient" > |
||||||
|
update gs_client |
||||||
|
<set > |
||||||
|
<if test="gsdm != null" > |
||||||
|
gsdm = #{gsdm,jdbcType=VARCHAR}, |
||||||
|
</if> |
||||||
|
<if test="gsmc != null" > |
||||||
|
gsmc = #{gsmc,jdbcType=VARCHAR}, |
||||||
|
</if> |
||||||
|
<if test="client != null" > |
||||||
|
client = #{client,jdbcType=VARCHAR}, |
||||||
|
</if> |
||||||
|
<if test="createTime != null" > |
||||||
|
create_time = #{createTime,jdbcType=TIMESTAMP}, |
||||||
|
</if> |
||||||
|
</set> |
||||||
|
where id = #{id,jdbcType=INTEGER} |
||||||
|
</update> |
||||||
|
<update id="updateByPrimaryKey" parameterType="com.dxhy.core.entity.GsClient" > |
||||||
|
update gs_client |
||||||
|
set gsdm = #{gsdm,jdbcType=VARCHAR}, |
||||||
|
gsmc = #{gsmc,jdbcType=VARCHAR}, |
||||||
|
client = #{client,jdbcType=VARCHAR}, |
||||||
|
create_time = #{createTime,jdbcType=TIMESTAMP} |
||||||
|
where id = #{id,jdbcType=INTEGER} |
||||||
|
</update> |
||||||
|
<insert id="insertList" parameterType="java.util.List" useGeneratedKeys="false"> |
||||||
|
insert into gs_client (gsdm,gsmc,client,create_time) |
||||||
|
values |
||||||
|
<foreach collection="list" item="item" index="index" |
||||||
|
separator=","> |
||||||
|
(#{item.gsdm,jdbcType=VARCHAR}, #{item.gsmc,jdbcType=VARCHAR}, |
||||||
|
#{item.client,jdbcType=VARCHAR},#{item.createTime,jdbcType=TIMESTAMP}) |
||||||
|
</foreach> |
||||||
|
</insert> |
||||||
|
</mapper> |
@ -0,0 +1,29 @@ |
|||||||
|
package com.dxhy.erp.dao; |
||||||
|
|
||||||
|
|
||||||
|
import com.dxhy.erp.entity.GsClient; |
||||||
|
import org.apache.ibatis.annotations.Mapper; |
||||||
|
import org.apache.ibatis.annotations.Param; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
@Mapper |
||||||
|
public interface GsClientMapper { |
||||||
|
int deleteByPrimaryKey(Integer id); |
||||||
|
|
||||||
|
int deleteAll(); |
||||||
|
|
||||||
|
int insert(GsClient record); |
||||||
|
|
||||||
|
int insertSelective(GsClient record); |
||||||
|
|
||||||
|
int insertList(@Param("list") List<GsClient> recordList); |
||||||
|
|
||||||
|
GsClient selectByPrimaryKey(Integer id); |
||||||
|
|
||||||
|
List<GsClient> selectByGsdm(String gsdm); |
||||||
|
|
||||||
|
int updateByPrimaryKeySelective(GsClient record); |
||||||
|
|
||||||
|
int updateByPrimaryKey(GsClient record); |
||||||
|
} |
@ -0,0 +1,19 @@ |
|||||||
|
package com.dxhy.erp.entity; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
import java.util.Date; |
||||||
|
|
||||||
|
@Data |
||||||
|
public class GsClient { |
||||||
|
private Integer id; |
||||||
|
|
||||||
|
private String gsdm; |
||||||
|
|
||||||
|
private String gsmc; |
||||||
|
|
||||||
|
private String client; |
||||||
|
|
||||||
|
private Date createTime; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,111 @@ |
|||||||
|
<?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="com.dxhy.erp.dao.GsClientMapper" > |
||||||
|
<resultMap id="BaseResultMap" type="com.dxhy.erp.entity.GsClient" > |
||||||
|
<id column="id" property="id" jdbcType="INTEGER" /> |
||||||
|
<result column="gsdm" property="gsdm" jdbcType="VARCHAR" /> |
||||||
|
<result column="gsmc" property="gsmc" jdbcType="VARCHAR" /> |
||||||
|
<result column="client" property="client" jdbcType="VARCHAR" /> |
||||||
|
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" /> |
||||||
|
</resultMap> |
||||||
|
<sql id="Base_Column_List" > |
||||||
|
id, gsdm, gsmc, client, create_time |
||||||
|
</sql> |
||||||
|
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" > |
||||||
|
select |
||||||
|
<include refid="Base_Column_List" /> |
||||||
|
from gs_client |
||||||
|
where id = #{id,jdbcType=INTEGER} |
||||||
|
</select> |
||||||
|
<select id="selectByGsdm" resultMap="BaseResultMap" parameterType="java.lang.String" > |
||||||
|
select |
||||||
|
<include refid="Base_Column_List" /> |
||||||
|
from gs_client |
||||||
|
where gsdm = #{gsdm,jdbcType=VARCHAR} |
||||||
|
</select> |
||||||
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" > |
||||||
|
delete from gs_client |
||||||
|
where id = #{id,jdbcType=INTEGER} |
||||||
|
</delete> |
||||||
|
<delete id="deleteAll" > |
||||||
|
delete from gs_client |
||||||
|
</delete> |
||||||
|
<insert id="insert" parameterType="com.dxhy.erp.entity.GsClient" > |
||||||
|
insert into gs_client (id, gsdm, gsmc, |
||||||
|
client, create_time) |
||||||
|
values (#{id,jdbcType=INTEGER}, #{gsdm,jdbcType=VARCHAR}, #{gsmc,jdbcType=VARCHAR}, |
||||||
|
#{client,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}) |
||||||
|
</insert> |
||||||
|
<insert id="insertSelective" parameterType="com.dxhy.erp.entity.GsClient" > |
||||||
|
insert into gs_client |
||||||
|
<trim prefix="(" suffix=")" suffixOverrides="," > |
||||||
|
<if test="id != null" > |
||||||
|
id, |
||||||
|
</if> |
||||||
|
<if test="gsdm != null" > |
||||||
|
gsdm, |
||||||
|
</if> |
||||||
|
<if test="gsmc != null" > |
||||||
|
gsmc, |
||||||
|
</if> |
||||||
|
<if test="client != null" > |
||||||
|
client, |
||||||
|
</if> |
||||||
|
<if test="createTime != null" > |
||||||
|
create_time, |
||||||
|
</if> |
||||||
|
</trim> |
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides="," > |
||||||
|
<if test="id != null" > |
||||||
|
#{id,jdbcType=INTEGER}, |
||||||
|
</if> |
||||||
|
<if test="gsdm != null" > |
||||||
|
#{gsdm,jdbcType=VARCHAR}, |
||||||
|
</if> |
||||||
|
<if test="gsmc != null" > |
||||||
|
#{gsmc,jdbcType=VARCHAR}, |
||||||
|
</if> |
||||||
|
<if test="client != null" > |
||||||
|
#{client,jdbcType=VARCHAR}, |
||||||
|
</if> |
||||||
|
<if test="createTime != null" > |
||||||
|
#{createTime,jdbcType=TIMESTAMP}, |
||||||
|
</if> |
||||||
|
</trim> |
||||||
|
</insert> |
||||||
|
<update id="updateByPrimaryKeySelective" parameterType="com.dxhy.erp.entity.GsClient" > |
||||||
|
update gs_client |
||||||
|
<set > |
||||||
|
<if test="gsdm != null" > |
||||||
|
gsdm = #{gsdm,jdbcType=VARCHAR}, |
||||||
|
</if> |
||||||
|
<if test="gsmc != null" > |
||||||
|
gsmc = #{gsmc,jdbcType=VARCHAR}, |
||||||
|
</if> |
||||||
|
<if test="client != null" > |
||||||
|
client = #{client,jdbcType=VARCHAR}, |
||||||
|
</if> |
||||||
|
<if test="createTime != null" > |
||||||
|
create_time = #{createTime,jdbcType=TIMESTAMP}, |
||||||
|
</if> |
||||||
|
</set> |
||||||
|
where id = #{id,jdbcType=INTEGER} |
||||||
|
</update> |
||||||
|
<update id="updateByPrimaryKey" parameterType="com.dxhy.erp.entity.GsClient" > |
||||||
|
update gs_client |
||||||
|
set gsdm = #{gsdm,jdbcType=VARCHAR}, |
||||||
|
gsmc = #{gsmc,jdbcType=VARCHAR}, |
||||||
|
client = #{client,jdbcType=VARCHAR}, |
||||||
|
create_time = #{createTime,jdbcType=TIMESTAMP} |
||||||
|
where id = #{id,jdbcType=INTEGER} |
||||||
|
</update> |
||||||
|
<insert id="insertList" parameterType="java.util.List" useGeneratedKeys="false"> |
||||||
|
insert into gs_client (gsdm,gsmc,client,create_time) |
||||||
|
values |
||||||
|
<foreach collection="list" item="item" index="index" |
||||||
|
separator=","> |
||||||
|
(#{item.gsdm,jdbcType=VARCHAR}, #{item.gsmc,jdbcType=VARCHAR}, |
||||||
|
#{item.client,jdbcType=VARCHAR},#{item.createTime,jdbcType=TIMESTAMP}) |
||||||
|
</foreach> |
||||||
|
</insert> |
||||||
|
</mapper> |
Loading…
Reference in new issue