Commit 68d66452 by gechengyang

提交springboot+mybatis测试代码

parent 1abfe055
......@@ -107,6 +107,13 @@
<version>2.2.5.RELEASE</version>
</dependency>
<!-- Fastjson依赖 -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.83</version> <!-- 使用时请检查是否有更新的版本 -->
</dependency>
</dependencies>
......
package com.brilliance.controller;
import com.brilliance.entity.Smqinf;
import com.brilliance.mapper.SmqinfMapper;
import com.brilliance.vo.Result;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
/*
*
* @Description
* @Author gechengyang
* @Date 2023/10/23
*/
@RestController
@RequestMapping("/smqinf")
public class SmqInfController {
private Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired
private SmqinfMapper smqinfMapper;
/* @Autowired
public SmqInfController(SmqinfMapper smqinfMapper) {
this.smqinfMapper = smqinfMapper;
}
*/
@GetMapping("/get")
//localhost:8085/smqinf/get?id=123&nam=zhangsan
public Result testParams(@RequestParam("id") String id,@RequestParam("nam") String paramName){
System.out.println("id==="+id);
System.out.println("name==="+paramName);
return new Result(id+"..."+paramName);
}
@GetMapping("/get1")
//localhost:8085/smqinf/get?id=123&nam=zhangsan
public Result testParams1(@RequestParam Map<String,Object> requestMap){
System.out.println("requesMap=="+requestMap);
return new Result(requestMap);
}
@PostMapping("/post2/{inr}/{nam}")
public Result testPathVariable(@PathVariable String inr,@PathVariable String nam) {
Smqinf smqinf=smqinfMapper.selectByPrimaryKey(inr);
return new Result(smqinf);
}
@PostMapping("/post")
public Result getSmqInfo(@RequestBody Smqinf requestSmqInf) {
String inr=requestSmqInf.getInr();
System.out.println("test...test...");
Smqinf smqinf=smqinfMapper.selectByPrimaryKey(inr);
return new Result(smqinf);
}
// 请求头
@GetMapping("/header")
public String getWithHeader(@RequestHeader("tokenid") String header) {
return "Header: " + header;
}
@GetMapping("/header1")
public Map getWithHeader(@RequestHeader Map map) {
return map;
}
}
package com.brilliance.controller;
import com.brilliance.entity.Smqlck;
import com.brilliance.service.SmqlckService;
import com.brilliance.vo.Result;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Optional;
/*
*
* @Description
* @Author gechengyang
* @Date 2023/10/23
*/
@RestController
@RequestMapping("/smqlck")
public class SmqLckController {
private Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired
private SmqlckService smqlckService;
@PostMapping("/post")
public Result getSmqInfo(@RequestBody Smqlck smqlck) {
String inr=smqlck.getInr();
smqlckService.createLck(smqlck);
System.out.println("test...controller");
return new Result();
}
}
package com.brilliance.entity;
import java.util.Date;
public class Smh {
private String inr;
private String crtfrm;
private Date dattim;
public String getInr() {
return inr;
}
public void setInr(String inr) {
this.inr = inr == null ? null : inr.trim();
}
public String getCrtfrm() {
return crtfrm;
}
public void setCrtfrm(String crtfrm) {
this.crtfrm = crtfrm == null ? null : crtfrm.trim();
}
public Date getDattim() {
return dattim;
}
public void setDattim(Date dattim) {
this.dattim = dattim;
}
}
\ No newline at end of file
package com.brilliance.entity;
import java.util.Date;
public class Smqinf {
private String inr;
private String pth;
private Short cnt;
private String sta;
private Date credat;
private String mesgno;
private String objinr;
private String objtyp;
public String getInr() {
return inr;
}
public void setInr(String inr) {
this.inr = inr == null ? null : inr.trim();
}
public String getPth() {
return pth;
}
public void setPth(String pth) {
this.pth = pth == null ? null : pth.trim();
}
public Short getCnt() {
return cnt;
}
public void setCnt(Short cnt) {
this.cnt = cnt;
}
public String getSta() {
return sta;
}
public void setSta(String sta) {
this.sta = sta == null ? null : sta.trim();
}
public Date getCredat() {
return credat;
}
public void setCredat(Date credat) {
this.credat = credat;
}
public String getMesgno() {
return mesgno;
}
public void setMesgno(String mesgno) {
this.mesgno = mesgno == null ? null : mesgno.trim();
}
public String getObjinr() {
return objinr;
}
public void setObjinr(String objinr) {
this.objinr = objinr == null ? null : objinr.trim();
}
public String getObjtyp() {
return objtyp;
}
public void setObjtyp(String objtyp) {
this.objtyp = objtyp == null ? null : objtyp.trim();
}
}
\ No newline at end of file
package com.brilliance.entity;
public class Smqlck {
private String inr;
public String getInr() {
return inr;
}
public void setInr(String inr) {
this.inr = inr == null ? null : inr.trim();
}
}
\ No newline at end of file
package com.brilliance.interceptor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.servlet.HandlerInterceptor;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class AuthInterceptor implements HandlerInterceptor {
private Logger logger = LoggerFactory.getLogger(this.getClass());
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
String token = request.getHeader("token");
logger.info("进入认证拦截器,token:{}", token);
// 可做认证 授权等操作
return true;
}
}
package com.brilliance.interceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class WebConfig implements WebMvcConfigurer {
@Bean
public AuthInterceptor getAuthInterceptor() {
return new AuthInterceptor();
}
@Override
public void addInterceptors(InterceptorRegistry registry) {
//添加认证拦截器
InterceptorRegistration tokenInterceptorRegistration = registry.addInterceptor(getAuthInterceptor());
tokenInterceptorRegistration.addPathPatterns("/**");
tokenInterceptorRegistration.excludePathPatterns("/login");
}
}
package com.brilliance.mapper;
import com.brilliance.entity.Clsmsg;
public interface ClsmsgMapper {
int deleteByPrimaryKey(String inr);
int insert(Clsmsg record);
int insertSelective(Clsmsg record);
Clsmsg selectByPrimaryKey(String inr);
int updateByPrimaryKeySelective(Clsmsg record);
int updateByPrimaryKey(Clsmsg record);
}
\ No newline at end of file
package com.brilliance.mapper;
import com.brilliance.entity.Cnt;
public interface CntMapper {
int insert(Cnt record);
int insertSelective(Cnt record);
}
\ No newline at end of file
package com.brilliance.mapper;
import com.brilliance.entity.Smh;
public interface SmhMapper {
int deleteByPrimaryKey(String inr);
int insert(Smh record);
int insertSelective(Smh record);
Smh selectByPrimaryKey(String inr);
int updateByPrimaryKeySelective(Smh record);
int updateByPrimaryKey(Smh record);
}
\ No newline at end of file
package com.brilliance.mapper;
import com.brilliance.entity.Smqinf;
import org.springframework.stereotype.Repository;
@Repository
public interface SmqinfMapper {
int deleteByPrimaryKey(String inr);
int insert(Smqinf record);
int insertSelective(Smqinf record);
Smqinf selectByPrimaryKey(String inr);
int updateByPrimaryKeySelective(Smqinf record);
int updateByPrimaryKey(Smqinf record);
}
\ No newline at end of file
package com.brilliance.mapper;
import com.brilliance.entity.Smqlck;
public interface SmqlckMapper {
int deleteByPrimaryKey(String inr);
int insert(Smqlck record);
int insertSelective(Smqlck record);
}
\ No newline at end of file
package com.brilliance.service;
import com.brilliance.entity.Smqlck;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.data.jpa.repository.JpaRepository;
//@Mapper
public interface SmqlckService {
boolean createLck(Smqlck smqlck);
}
package com.brilliance.service.impl;
import com.brilliance.entity.Smqlck;
import com.brilliance.mapper.SmqlckMapper;
import com.brilliance.service.SmqlckService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Slf4j
@Service
public class SmqlckServiceImp implements SmqlckService {
@Autowired
private SmqlckMapper smqlckMapper;
@Override
public boolean createLck(Smqlck smqlck) {
System.out.println("it is a test !");
try {
int insert = smqlckMapper.insert(smqlck);
if(insert>0){
return true;
}else{
return false;
}
}catch (Exception e){
e.printStackTrace();;
return false;
}
}
}
package com.brilliance.util;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import java.io.IOException;
import java.io.InputStream;
public class DbCommonUtil {
private static String resource = "mybatis-config.xml";
public static SqlSession getSqlSession() throws IOException {
InputStream inputStream = Resources.getResourceAsStream(resource);
SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream);
// sqlSessionFactory.getConfiguration().addMapper(MpsMapper.class);
//2. 获取SqlSession对象,用它来执行sql
SqlSession openSession = sqlSessionFactory.openSession();
return openSession;
}
public static void close(SqlSession sqlSession){
if(sqlSession==null)
return ;
sqlSession.close();
}
}
package com.brilliance.vo;
import lombok.Data;
/**
* @Description
* @Author gechengyang
* @Date 2023/10/23
*/
@Data
public class Result {
private String code = "success";
private String msg = "请求成功";
private Object data;
public Result() {
}
public Result(Object data) {
this.data = data;
}
public Result(String code, String msg, Object data) {
this.code = code;
this.msg = msg;
this.data = data;
}
}
package com.brilliance;
package com.gcy;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
......@@ -11,7 +11,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
*/
@SpringBootApplication
@MapperScan({"com.brilliance.mapper"})
@MapperScan({"com.gcy.dao"})
public class App {
public static void main(String[] args) {
......
package com.gcy.controller;
import com.gcy.entity.Clsmsg;
import com.gcy.service.ClsmsgService;
import com.github.pagehelper.PageHelper;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* (Clsmsg)表控制层
*
* @author makejava
* @since 2024-07-31 16:01:15
*/
@RestController
@RequestMapping("clsmsg")
public class ClsmsgController {
/**
* 服务对象
*/
@Resource
private ClsmsgService clsmsgService;
/**
* 分页查询
*
* @param clsmsg 筛选条件
* @param pageRequest 分页对象
* @return 查询结果
*/
@GetMapping
public ResponseEntity<Page<Clsmsg>> queryByPage(Clsmsg clsmsg, PageRequest pageRequest) {
return ResponseEntity.ok(this.clsmsgService.queryByPage(clsmsg, pageRequest));
}
/**
* 通过主键查询单条数据
*
* @param id 主键
* @return 单条数据
*/
@GetMapping("{id}")
public ResponseEntity<Clsmsg> queryById(@PathVariable("id") String id) {
return ResponseEntity.ok(this.clsmsgService.queryById(id));
}
@GetMapping("/page")
public String queryByPageHelper(@RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
@RequestParam(value = "pageSize", defaultValue = "10") int pageSize) {
PageHelper.startPage(pageNum, pageSize);
return clsmsgService.findByLimit(pageNum,pageSize);
}
@PostMapping("mulArgs")
public ResponseEntity<List<Clsmsg>> findClsmsgs(@RequestBody Clsmsg clsmsg){
List<Clsmsg> clsMsgList = this.clsmsgService.findClsMsg(clsmsg.getSrc(), clsmsg.getMsgid(), clsmsg.getMsgtyp());
return ResponseEntity.ok(clsMsgList);
}
/**
* 新增数据
*
* @param clsmsg 实体
* @return 新增结果
*/
@PostMapping
public ResponseEntity<Clsmsg> add(Clsmsg clsmsg) {
return ResponseEntity.ok(this.clsmsgService.insert(clsmsg));
}
/**
* 编辑数据
*
* @param clsmsg 实体
* @return 编辑结果
*/
@PutMapping
public ResponseEntity<Clsmsg> edit(Clsmsg clsmsg) {
return ResponseEntity.ok(this.clsmsgService.update(clsmsg));
}
/**
* 删除数据
*
* @param id 主键
* @return 删除是否成功
*/
@DeleteMapping
public ResponseEntity<Boolean> deleteById(String id) {
return ResponseEntity.ok(this.clsmsgService.deleteById(id));
}
}
package com.gcy.controller;
import com.gcy.entity.Cnt;
import com.gcy.service.CntService;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/**
* (Cnt)表控制层
*
* @author makejava
* @since 2024-07-31 17:02:25
*/
@RestController
@RequestMapping("cnt")
public class CntController {
/**
* 服务对象
*/
@Resource
private CntService cntService;
/**
* 分页查询
*
* @param cnt 筛选条件
* @param pageRequest 分页对象
* @return 查询结果
*/
@GetMapping
public ResponseEntity<Page<Cnt>> queryByPage(Cnt cnt, PageRequest pageRequest) {
return ResponseEntity.ok(this.cntService.queryByPage(cnt, pageRequest));
}
/**
* 通过主键查询单条数据
*
* @param id 主键
* @return 单条数据
*/
@GetMapping("{id}")
public ResponseEntity<Cnt> queryById(@PathVariable("id")String id) {
return ResponseEntity.ok(this.cntService.queryById(id));
}
/**
* 新增数据
*
* @param cnt 实体
* @return 新增结果
*/
@PostMapping
public ResponseEntity<Cnt> add(Cnt cnt) {
return ResponseEntity.ok(this.cntService.insert(cnt));
}
/**
* 编辑数据
*
* @param cnt 实体
* @return 编辑结果
*/
@PutMapping
public ResponseEntity<Cnt> edit(Cnt cnt) {
return ResponseEntity.ok(this.cntService.update(cnt));
}
/**
* 删除数据
*
* @param id 主键
* @return 删除是否成功
*/
@DeleteMapping
public ResponseEntity<Boolean> deleteById(String id) {
return ResponseEntity.ok(this.cntService.deleteById(id));
}
}
package com.gcy.dao;
import com.gcy.entity.Clsmsg;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.data.domain.Pageable;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
/**
* (Clsmsg)表数据库访问层
*
* @author makejava
* @since 2024-07-31 16:01:15
*/
public interface ClsmsgDao {
/**
* 通过ID查询单条数据
*
* @param inr 主键
* @return 实例对象
*/
Clsmsg queryById(String inr);
/**
* 查询指定行数据
*
* @param clsmsg 查询条件
* @param pageable 分页对象
* @return 对象列表
*/
List<Clsmsg> queryAllByLimit(Clsmsg clsmsg, @Param("pageable") Pageable pageable);
@Select("select * from clsmsg order by inr")
List<Clsmsg> findByLimit(int pageNum,int pageSize);
/**
* 统计总行数
*
* @param clsmsg 查询条件
* @return 总行数
*/
long count(Clsmsg clsmsg);
/**
* 新增数据
*
* @param clsmsg 实例对象
* @return 影响行数
*/
int insert(Clsmsg clsmsg);
/**
* 批量新增数据(MyBatis原生foreach方法)
*
* @param entities List<Clsmsg> 实例对象列表
* @return 影响行数
*/
int insertBatch(@Param("entities") List<Clsmsg> entities);
/**
* 批量新增或按主键更新数据(MyBatis原生foreach方法)
*
* @param entities List<Clsmsg> 实例对象列表
* @return 影响行数
* @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参
*/
int insertOrUpdateBatch(@Param("entities") List<Clsmsg> entities);
/**
* 修改数据
*
* @param clsmsg 实例对象
* @return 影响行数
*/
int update(Clsmsg clsmsg);
/**
* 通过主键删除数据
*
* @param inr 主键
* @return 影响行数
*/
int deleteById(String inr);
// List<Clsmsg> findClsmsg(@RequestParam("src") String src, @RequestParam("msgid") String msgid, @RequestParam("msgtyp") String msgtyp);
List<Clsmsg> findClsmsg(String src1, String msgid, String msgtyp);
}
package com.gcy.dao;
import com.gcy.entity.Cnt;
import org.apache.ibatis.annotations.Param;
import org.springframework.data.domain.Pageable;
import java.util.List;
/**
* (Cnt)表数据库访问层
*
* @author makejava
* @since 2024-07-31 17:02:25
*/
public interface CntDao {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
Cnt queryById(String id);
/**
* 查询指定行数据
*
* @param cnt 查询条件
* @param pageable 分页对象
* @return 对象列表
*/
List<Cnt> queryAllByLimit(Cnt cnt, @Param("pageable") Pageable pageable);
/**
* 统计总行数
*
* @param cnt 查询条件
* @return 总行数
*/
long count(Cnt cnt);
/**
* 新增数据
*
* @param cnt 实例对象
* @return 影响行数
*/
int insert(Cnt cnt);
/**
* 批量新增数据(MyBatis原生foreach方法)
*
* @param entities List<Cnt> 实例对象列表
* @return 影响行数
*/
int insertBatch(@Param("entities") List<Cnt> entities);
/**
* 批量新增或按主键更新数据(MyBatis原生foreach方法)
*
* @param entities List<Cnt> 实例对象列表
* @return 影响行数
* @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参
*/
int insertOrUpdateBatch(@Param("entities") List<Cnt> entities);
/**
* 修改数据
*
* @param cnt 实例对象
* @return 影响行数
*/
int update(Cnt cnt);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 影响行数
*/
int deleteById(String id);
}
package com.brilliance.entity;
package com.gcy.entity;
import java.io.Serializable;
/**
* (Clsmsg)实体类
*
* @author makejava
* @since 2024-07-31 16:01:15
*/
public class Clsmsg implements Serializable {
private static final long serialVersionUID = -94870075714721474L;
public class Clsmsg {
private String inr;
private String src;
......@@ -31,12 +41,13 @@ public class Clsmsg {
private String vesion;
public String getInr() {
return inr;
}
public void setInr(String inr) {
this.inr = inr == null ? null : inr.trim();
this.inr = inr;
}
public String getSrc() {
......@@ -44,7 +55,7 @@ public class Clsmsg {
}
public void setSrc(String src) {
this.src = src == null ? null : src.trim();
this.src = src;
}
public String getDes() {
......@@ -52,7 +63,7 @@ public class Clsmsg {
}
public void setDes(String des) {
this.des = des == null ? null : des.trim();
this.des = des;
}
public String getApp() {
......@@ -60,7 +71,7 @@ public class Clsmsg {
}
public void setApp(String app) {
this.app = app == null ? null : app.trim();
this.app = app;
}
public String getMsgno() {
......@@ -68,7 +79,7 @@ public class Clsmsg {
}
public void setMsgno(String msgno) {
this.msgno = msgno == null ? null : msgno.trim();
this.msgno = msgno;
}
public String getMsgid() {
......@@ -76,7 +87,7 @@ public class Clsmsg {
}
public void setMsgid(String msgid) {
this.msgid = msgid == null ? null : msgid.trim();
this.msgid = msgid;
}
public String getMsgref() {
......@@ -84,7 +95,7 @@ public class Clsmsg {
}
public void setMsgref(String msgref) {
this.msgref = msgref == null ? null : msgref.trim();
this.msgref = msgref;
}
public String getWorkdate() {
......@@ -92,7 +103,7 @@ public class Clsmsg {
}
public void setWorkdate(String workdate) {
this.workdate = workdate == null ? null : workdate.trim();
this.workdate = workdate;
}
public String getReserve() {
......@@ -100,7 +111,7 @@ public class Clsmsg {
}
public void setReserve(String reserve) {
this.reserve = reserve == null ? null : reserve.trim();
this.reserve = reserve;
}
public String getMsgtyp() {
......@@ -108,7 +119,7 @@ public class Clsmsg {
}
public void setMsgtyp(String msgtyp) {
this.msgtyp = msgtyp == null ? null : msgtyp.trim();
this.msgtyp = msgtyp;
}
public String getGid() {
......@@ -116,7 +127,7 @@ public class Clsmsg {
}
public void setGid(String gid) {
this.gid = gid == null ? null : gid.trim();
this.gid = gid;
}
public String getSendid() {
......@@ -124,7 +135,7 @@ public class Clsmsg {
}
public void setSendid(String sendid) {
this.sendid = sendid == null ? null : sendid.trim();
this.sendid = sendid;
}
public String getRecvid() {
......@@ -132,7 +143,7 @@ public class Clsmsg {
}
public void setRecvid(String recvid) {
this.recvid = recvid == null ? null : recvid.trim();
this.recvid = recvid;
}
public String getSnddattim() {
......@@ -140,7 +151,7 @@ public class Clsmsg {
}
public void setSnddattim(String snddattim) {
this.snddattim = snddattim == null ? null : snddattim.trim();
this.snddattim = snddattim;
}
public String getVesion() {
......@@ -148,6 +159,8 @@ public class Clsmsg {
}
public void setVesion(String vesion) {
this.vesion = vesion == null ? null : vesion.trim();
this.vesion = vesion;
}
}
package com.brilliance.entity;
package com.gcy.entity;
import java.io.Serializable;
/**
* (Cnt)实体类
*
* @author makejava
* @since 2024-07-31 17:02:25
*/
public class Cnt implements Serializable {
private static final long serialVersionUID = 215722679832120335L;
public class Cnt {
private String nam;
private Short val;
private Integer val;
private Integer stp;
private Short stp;
public String getNam() {
return nam;
}
public void setNam(String nam) {
this.nam = nam == null ? null : nam.trim();
this.nam = nam;
}
public Short getVal() {
public Integer getVal() {
return val;
}
public void setVal(Short val) {
public void setVal(Integer val) {
this.val = val;
}
public Short getStp() {
public Integer getStp() {
return stp;
}
public void setStp(Short stp) {
public void setStp(Integer stp) {
this.stp = stp;
}
}
package com.gcy.service;
import com.gcy.entity.Clsmsg;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import java.util.List;
/**
* (Clsmsg)表服务接口
*
* @author makejava
* @since 2024-07-31 16:01:16
*/
public interface ClsmsgService {
/**
* 通过ID查询单条数据
*
* @param inr 主键
* @return 实例对象
*/
Clsmsg queryById(String inr);
/**
* 分页查询
*
* @param clsmsg 筛选条件
* @param pageRequest 分页对象
* @return 查询结果
*/
Page<Clsmsg> queryByPage(Clsmsg clsmsg, PageRequest pageRequest);
/**
* 新增数据
*
* @param clsmsg 实例对象
* @return 实例对象
*/
Clsmsg insert(Clsmsg clsmsg);
/**
* 修改数据
*
* @param clsmsg 实例对象
* @return 实例对象
*/
Clsmsg update(Clsmsg clsmsg);
/**
* 通过主键删除数据
*
* @param inr 主键
* @return 是否成功
*/
boolean deleteById(String inr);
String findByLimit(int pageNum,int pageSize);
List<Clsmsg> findClsMsg(String src,String msgid,String msgtyp);
}
package com.gcy.service;
import com.gcy.entity.Cnt;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
/**
* (Cnt)表服务接口
*
* @author makejava
* @since 2024-07-31 17:02:26
*/
public interface CntService {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
Cnt queryById(String id);
/**
* 分页查询
*
* @param cnt 筛选条件
* @param pageRequest 分页对象
* @return 查询结果
*/
Page<Cnt> queryByPage(Cnt cnt, PageRequest pageRequest);
/**
* 新增数据
*
* @param cnt 实例对象
* @return 实例对象
*/
Cnt insert(Cnt cnt);
/**
* 修改数据
*
* @param cnt 实例对象
* @return 实例对象
*/
Cnt update(Cnt cnt);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
boolean deleteById(String id);
}
package com.gcy.service.impl;
import com.alibaba.druid.support.json.JSONUtils;
import com.alibaba.fastjson.JSON;
import com.gcy.entity.Clsmsg;
import com.gcy.dao.ClsmsgDao;
import com.gcy.service.ClsmsgService;
import org.springframework.stereotype.Service;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.PageRequest;
import javax.annotation.Resource;
import java.util.List;
/**
* (Clsmsg)表服务实现类
*
* @author makejava
* @since 2024-07-31 16:01:16
*/
@Service("clsmsgService")
public class ClsmsgServiceImpl implements ClsmsgService {
@Resource
private ClsmsgDao clsmsgDao;
/**
* 通过ID查询单条数据
*
* @param inr 主键
* @return 实例对象
*/
@Override
public Clsmsg queryById(String inr) {
return this.clsmsgDao.queryById(inr);
}
/**
* 分页查询
*
* @param clsmsg 筛选条件
* @param pageRequest 分页对象
* @return 查询结果
*/
@Override
public Page<Clsmsg> queryByPage(Clsmsg clsmsg, PageRequest pageRequest) {
long total = this.clsmsgDao.count(clsmsg);
return new PageImpl<>(this.clsmsgDao.queryAllByLimit(clsmsg, pageRequest), pageRequest, total);
}
/**
* 新增数据
*
* @param clsmsg 实例对象
* @return 实例对象
*/
@Override
public Clsmsg insert(Clsmsg clsmsg) {
this.clsmsgDao.insert(clsmsg);
return clsmsg;
}
/**
* 修改数据
*
* @param clsmsg 实例对象
* @return 实例对象
*/
@Override
public Clsmsg update(Clsmsg clsmsg) {
this.clsmsgDao.update(clsmsg);
return this.queryById(clsmsg.getInr());
}
/**
* 通过主键删除数据
*
* @param inr 主键
* @return 是否成功
*/
@Override
public boolean deleteById(String inr) {
return this.clsmsgDao.deleteById(inr) > 0;
}
@Override
public String findByLimit(int pageNum, int pageSize) {
List<Clsmsg> byLimit = this.clsmsgDao.findByLimit(pageNum, pageSize);
System.out.println("result==="+byLimit);
// return "OK";
return JSON.toJSONString(byLimit);
}
@Override
public List<Clsmsg> findClsMsg(String src, String msgid, String msgtyp) {
return this.clsmsgDao.findClsmsg(src,msgid,msgtyp);
}
}
package com.gcy.service.impl;
import com.gcy.entity.Cnt;
import com.gcy.dao.CntDao;
import com.gcy.service.CntService;
import org.springframework.stereotype.Service;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.PageRequest;
import javax.annotation.Resource;
/**
* (Cnt)表服务实现类
*
* @author makejava
* @since 2024-07-31 17:02:26
*/
@Service("cntService")
public class CntServiceImpl implements CntService {
@Resource
private CntDao cntDao;
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
@Override
public Cnt queryById(String id) {
return this.cntDao.queryById(id);
}
/**
* 分页查询
*
* @param cnt 筛选条件
* @param pageRequest 分页对象
* @return 查询结果
*/
@Override
public Page<Cnt> queryByPage(Cnt cnt, PageRequest pageRequest) {
long total = this.cntDao.count(cnt);
return new PageImpl<>(this.cntDao.queryAllByLimit(cnt, pageRequest), pageRequest, total);
}
/**
* 新增数据
*
* @param cnt 实例对象
* @return 实例对象
*/
@Override
public Cnt insert(Cnt cnt) {
this.cntDao.insert(cnt);
return cnt;
}
/**
* 修改数据
*
* @param cnt 实例对象
* @return 实例对象
*/
@Override
public Cnt update(Cnt cnt) {
this.cntDao.update(cnt);
return this.queryById(cnt.getNam());
}
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
@Override
public boolean deleteById(String id) {
return this.cntDao.deleteById(id) > 0;
}
}
<?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.gcy.dao.ClsmsgDao">
<resultMap type="com.gcy.entity.Clsmsg" id="ClsmsgMap">
<result property="inr" column="INR" jdbcType="VARCHAR"/>
<result property="src" column="SRC" jdbcType="VARCHAR"/>
<result property="des" column="DES" jdbcType="VARCHAR"/>
<result property="app" column="APP" jdbcType="VARCHAR"/>
<result property="msgno" column="MSGNO" jdbcType="VARCHAR"/>
<result property="msgid" column="MSGID" jdbcType="VARCHAR"/>
<result property="msgref" column="MSGREF" jdbcType="VARCHAR"/>
<result property="workdate" column="WORKDATE" jdbcType="VARCHAR"/>
<result property="reserve" column="RESERVE" jdbcType="VARCHAR"/>
<result property="msgtyp" column="MSGTYP" jdbcType="VARCHAR"/>
<result property="gid" column="GID" jdbcType="VARCHAR"/>
<result property="sendid" column="SENDID" jdbcType="VARCHAR"/>
<result property="recvid" column="RECVID" jdbcType="VARCHAR"/>
<result property="snddattim" column="SNDDATTIM" jdbcType="VARCHAR"/>
<result property="vesion" column="VESION" jdbcType="VARCHAR"/>
</resultMap>
<!--查询单个-->
<select id="queryById" resultMap="ClsmsgMap">
select INR,
SRC,
DES,
APP,
MSGNO,
MSGID,
MSGREF,
WORKDATE,
RESERVE,
MSGTYP,
GID,
SENDID,
RECVID,
SNDDATTIM,
VESION
from CLSMSG
where INR = #{inr}
</select>
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="ClsmsgMap">
select
INR, SRC, DES, APP, MSGNO, MSGID, MSGREF, WORKDATE, RESERVE, MSGTYP, GID, SENDID, RECVID, SNDDATTIM, VESION
from CLSMSG
<where>
<if test="inr != null and inr != ''">
and INR = #{inr}
</if>
<if test="src != null and src != ''">
and SRC = #{src}
</if>
<if test="des != null and des != ''">
and DES = #{des}
</if>
<if test="app != null and app != ''">
and APP = #{app}
</if>
<if test="msgno != null and msgno != ''">
and MSGNO = #{msgno}
</if>
<if test="msgid != null and msgid != ''">
and MSGID = #{msgid}
</if>
<if test="msgref != null and msgref != ''">
and MSGREF = #{msgref}
</if>
<if test="workdate != null and workdate != ''">
and WORKDATE = #{workdate}
</if>
<if test="reserve != null and reserve != ''">
and RESERVE = #{reserve}
</if>
<if test="msgtyp != null and msgtyp != ''">
and MSGTYP = #{msgtyp}
</if>
<if test="gid != null and gid != ''">
and GID = #{gid}
</if>
<if test="sendid != null and sendid != ''">
and SENDID = #{sendid}
</if>
<if test="recvid != null and recvid != ''">
and RECVID = #{recvid}
</if>
<if test="snddattim != null and snddattim != ''">
and SNDDATTIM = #{snddattim}
</if>
<if test="vesion != null and vesion != ''">
and VESION = #{vesion}
</if>
</where>
limit #{pageable.offset}, #{pageable.pageSize}
</select>
<!--统计总行数-->
<select id="count" resultType="java.lang.Long">
select count(1)
from CLSMSG
<where>
<if test="inr != null and inr != ''">
and INR = #{inr}
</if>
<if test="src != null and src != ''">
and SRC = #{src}
</if>
<if test="des != null and des != ''">
and DES = #{des}
</if>
<if test="app != null and app != ''">
and APP = #{app}
</if>
<if test="msgno != null and msgno != ''">
and MSGNO = #{msgno}
</if>
<if test="msgid != null and msgid != ''">
and MSGID = #{msgid}
</if>
<if test="msgref != null and msgref != ''">
and MSGREF = #{msgref}
</if>
<if test="workdate != null and workdate != ''">
and WORKDATE = #{workdate}
</if>
<if test="reserve != null and reserve != ''">
and RESERVE = #{reserve}
</if>
<if test="msgtyp != null and msgtyp != ''">
and MSGTYP = #{msgtyp}
</if>
<if test="gid != null and gid != ''">
and GID = #{gid}
</if>
<if test="sendid != null and sendid != ''">
and SENDID = #{sendid}
</if>
<if test="recvid != null and recvid != ''">
and RECVID = #{recvid}
</if>
<if test="snddattim != null and snddattim != ''">
and SNDDATTIM = #{snddattim}
</if>
<if test="vesion != null and vesion != ''">
and VESION = #{vesion}
</if>
</where>
</select>
<!-- select * from clsmsg where src like '%' || #{src1} || '%'-->
<!-- select * from clsmsg where src like CONCAT(CONCAT('%', #{src1}), '%')-->
<select id="findClsmsg" resultType="com.gcy.entity.Clsmsg">
select * from clsmsg
<where>
<if test="src1 != null || src1 != ''">
and SRC LIKE CONCAT(CONCAT('%', #{src1}), '%')
</if>
<if test="msgid != null">
and MSGID = #{msgid}
</if>
<if test="msgtyp != null">
and MSGTYP = #{msgtyp}
</if>
</where>
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="inr" useGeneratedKeys="true">
insert into CLSMSG(SRC, DES, APP, MSGNO, MSGID, MSGREF, WORKDATE, RESERVE, MSGTYP, GID, SENDID, RECVID,
SNDDATTIM, VESION)
values (#{src}, #{des}, #{app}, #{msgno}, #{msgid}, #{msgref}, #{workdate}, #{reserve}, #{msgtyp}, #{gid},
#{sendid}, #{recvid}, #{snddattim}, #{vesion})
</insert>
<insert id="insertBatch" keyProperty="inr" useGeneratedKeys="true">
insert into CLSMSG(SRC, DES, APP, MSGNO, MSGID, MSGREF, WORKDATE, RESERVE, MSGTYP, GID, SENDID, RECVID,
SNDDATTIM, VESION)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.src}, #{entity.des}, #{entity.app}, #{entity.msgno}, #{entity.msgid}, #{entity.msgref},
#{entity.workdate}, #{entity.reserve}, #{entity.msgtyp}, #{entity.gid}, #{entity.sendid}, #{entity.recvid},
#{entity.snddattim}, #{entity.vesion})
</foreach>
</insert>
<insert id="insertOrUpdateBatch" keyProperty="inr" useGeneratedKeys="true">
insert into CLSMSG(SRC, DES, APP, MSGNO, MSGID, MSGREF, WORKDATE, RESERVE, MSGTYP, GID, SENDID, RECVID,
SNDDATTIM, VESION)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.src}, #{entity.des}, #{entity.app}, #{entity.msgno}, #{entity.msgid}, #{entity.msgref},
#{entity.workdate}, #{entity.reserve}, #{entity.msgtyp}, #{entity.gid}, #{entity.sendid}, #{entity.recvid},
#{entity.snddattim}, #{entity.vesion})
</foreach>
on duplicate key update
SRC = values(SRC),
DES = values(DES),
APP = values(APP),
MSGNO = values(MSGNO),
MSGID = values(MSGID),
MSGREF = values(MSGREF),
WORKDATE = values(WORKDATE),
RESERVE = values(RESERVE),
MSGTYP = values(MSGTYP),
GID = values(GID),
SENDID = values(SENDID),
RECVID = values(RECVID),
SNDDATTIM = values(SNDDATTIM),
VESION = values(VESION)
</insert>
<!--通过主键修改数据-->
<update id="update">
update CLSMSG
<set>
<if test="src != null and src != ''">
SRC = #{src},
</if>
<if test="des != null and des != ''">
DES = #{des},
</if>
<if test="app != null and app != ''">
APP = #{app},
</if>
<if test="msgno != null and msgno != ''">
MSGNO = #{msgno},
</if>
<if test="msgid != null and msgid != ''">
MSGID = #{msgid},
</if>
<if test="msgref != null and msgref != ''">
MSGREF = #{msgref},
</if>
<if test="workdate != null and workdate != ''">
WORKDATE = #{workdate},
</if>
<if test="reserve != null and reserve != ''">
RESERVE = #{reserve},
</if>
<if test="msgtyp != null and msgtyp != ''">
MSGTYP = #{msgtyp},
</if>
<if test="gid != null and gid != ''">
GID = #{gid},
</if>
<if test="sendid != null and sendid != ''">
SENDID = #{sendid},
</if>
<if test="recvid != null and recvid != ''">
RECVID = #{recvid},
</if>
<if test="snddattim != null and snddattim != ''">
SNDDATTIM = #{snddattim},
</if>
<if test="vesion != null and vesion != ''">
VESION = #{vesion},
</if>
</set>
where INR = #{inr}
</update>
<!--通过主键删除-->
<delete id="deleteById">
delete
from CLSMSG
where INR = #{inr}
</delete>
</mapper>
<?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.brilliance.mapper.ClsmsgMapper" >
<resultMap id="BaseResultMap" type="com.brilliance.entity.Clsmsg" >
<id column="INR" property="inr" jdbcType="CHAR" />
<result column="SRC" property="src" jdbcType="VARCHAR" />
<result column="DES" property="des" jdbcType="VARCHAR" />
<result column="APP" property="app" jdbcType="VARCHAR" />
<result column="MSGNO" property="msgno" jdbcType="VARCHAR" />
<result column="MSGID" property="msgid" jdbcType="VARCHAR" />
<result column="MSGREF" property="msgref" jdbcType="VARCHAR" />
<result column="WORKDATE" property="workdate" jdbcType="VARCHAR" />
<result column="RESERVE" property="reserve" jdbcType="VARCHAR" />
<result column="MSGTYP" property="msgtyp" jdbcType="VARCHAR" />
<result column="GID" property="gid" jdbcType="VARCHAR" />
<result column="SENDID" property="sendid" jdbcType="VARCHAR" />
<result column="RECVID" property="recvid" jdbcType="VARCHAR" />
<result column="SNDDATTIM" property="snddattim" jdbcType="VARCHAR" />
<result column="VESION" property="vesion" jdbcType="VARCHAR" />
</resultMap>
<sql id="Base_Column_List" >
INR, SRC, DES, APP, MSGNO, MSGID, MSGREF, WORKDATE, RESERVE, MSGTYP, GID, SENDID,
RECVID, SNDDATTIM, VESION
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from NCB_GJ.CLSMSG
where INR = #{inr,jdbcType=CHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
delete from NCB_GJ.CLSMSG
where INR = #{inr,jdbcType=CHAR}
</delete>
<insert id="insert" parameterType="com.brilliance.entity.Clsmsg" >
insert into NCB_GJ.CLSMSG (INR, SRC, DES, APP,
MSGNO, MSGID, MSGREF,
WORKDATE, RESERVE, MSGTYP,
GID, SENDID, RECVID,
SNDDATTIM, VESION)
values (#{inr,jdbcType=CHAR}, #{src,jdbcType=VARCHAR}, #{des,jdbcType=VARCHAR}, #{app,jdbcType=VARCHAR},
#{msgno,jdbcType=VARCHAR}, #{msgid,jdbcType=VARCHAR}, #{msgref,jdbcType=VARCHAR},
#{workdate,jdbcType=VARCHAR}, #{reserve,jdbcType=VARCHAR}, #{msgtyp,jdbcType=VARCHAR},
#{gid,jdbcType=VARCHAR}, #{sendid,jdbcType=VARCHAR}, #{recvid,jdbcType=VARCHAR},
#{snddattim,jdbcType=VARCHAR}, #{vesion,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.brilliance.entity.Clsmsg" >
insert into NCB_GJ.CLSMSG
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="inr != null" >
INR,
</if>
<if test="src != null" >
SRC,
</if>
<if test="des != null" >
DES,
</if>
<if test="app != null" >
APP,
</if>
<if test="msgno != null" >
MSGNO,
</if>
<if test="msgid != null" >
MSGID,
</if>
<if test="msgref != null" >
MSGREF,
</if>
<if test="workdate != null" >
WORKDATE,
</if>
<if test="reserve != null" >
RESERVE,
</if>
<if test="msgtyp != null" >
MSGTYP,
</if>
<if test="gid != null" >
GID,
</if>
<if test="sendid != null" >
SENDID,
</if>
<if test="recvid != null" >
RECVID,
</if>
<if test="snddattim != null" >
SNDDATTIM,
</if>
<if test="vesion != null" >
VESION,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="inr != null" >
#{inr,jdbcType=CHAR},
</if>
<if test="src != null" >
#{src,jdbcType=VARCHAR},
</if>
<if test="des != null" >
#{des,jdbcType=VARCHAR},
</if>
<if test="app != null" >
#{app,jdbcType=VARCHAR},
</if>
<if test="msgno != null" >
#{msgno,jdbcType=VARCHAR},
</if>
<if test="msgid != null" >
#{msgid,jdbcType=VARCHAR},
</if>
<if test="msgref != null" >
#{msgref,jdbcType=VARCHAR},
</if>
<if test="workdate != null" >
#{workdate,jdbcType=VARCHAR},
</if>
<if test="reserve != null" >
#{reserve,jdbcType=VARCHAR},
</if>
<if test="msgtyp != null" >
#{msgtyp,jdbcType=VARCHAR},
</if>
<if test="gid != null" >
#{gid,jdbcType=VARCHAR},
</if>
<if test="sendid != null" >
#{sendid,jdbcType=VARCHAR},
</if>
<if test="recvid != null" >
#{recvid,jdbcType=VARCHAR},
</if>
<if test="snddattim != null" >
#{snddattim,jdbcType=VARCHAR},
</if>
<if test="vesion != null" >
#{vesion,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.brilliance.entity.Clsmsg" >
update NCB_GJ.CLSMSG
<set >
<if test="src != null" >
SRC = #{src,jdbcType=VARCHAR},
</if>
<if test="des != null" >
DES = #{des,jdbcType=VARCHAR},
</if>
<if test="app != null" >
APP = #{app,jdbcType=VARCHAR},
</if>
<if test="msgno != null" >
MSGNO = #{msgno,jdbcType=VARCHAR},
</if>
<if test="msgid != null" >
MSGID = #{msgid,jdbcType=VARCHAR},
</if>
<if test="msgref != null" >
MSGREF = #{msgref,jdbcType=VARCHAR},
</if>
<if test="workdate != null" >
WORKDATE = #{workdate,jdbcType=VARCHAR},
</if>
<if test="reserve != null" >
RESERVE = #{reserve,jdbcType=VARCHAR},
</if>
<if test="msgtyp != null" >
MSGTYP = #{msgtyp,jdbcType=VARCHAR},
</if>
<if test="gid != null" >
GID = #{gid,jdbcType=VARCHAR},
</if>
<if test="sendid != null" >
SENDID = #{sendid,jdbcType=VARCHAR},
</if>
<if test="recvid != null" >
RECVID = #{recvid,jdbcType=VARCHAR},
</if>
<if test="snddattim != null" >
SNDDATTIM = #{snddattim,jdbcType=VARCHAR},
</if>
<if test="vesion != null" >
VESION = #{vesion,jdbcType=VARCHAR},
</if>
</set>
where INR = #{inr,jdbcType=CHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.brilliance.entity.Clsmsg" >
update NCB_GJ.CLSMSG
set SRC = #{src,jdbcType=VARCHAR},
DES = #{des,jdbcType=VARCHAR},
APP = #{app,jdbcType=VARCHAR},
MSGNO = #{msgno,jdbcType=VARCHAR},
MSGID = #{msgid,jdbcType=VARCHAR},
MSGREF = #{msgref,jdbcType=VARCHAR},
WORKDATE = #{workdate,jdbcType=VARCHAR},
RESERVE = #{reserve,jdbcType=VARCHAR},
MSGTYP = #{msgtyp,jdbcType=VARCHAR},
GID = #{gid,jdbcType=VARCHAR},
SENDID = #{sendid,jdbcType=VARCHAR},
RECVID = #{recvid,jdbcType=VARCHAR},
SNDDATTIM = #{snddattim,jdbcType=VARCHAR},
VESION = #{vesion,jdbcType=VARCHAR}
where INR = #{inr,jdbcType=CHAR}
</update>
</mapper>
\ No newline at end of file
<?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.gcy.dao.CntDao">
<resultMap type="com.gcy.entity.Cnt" id="CntMap">
<result property="nam" column="NAM" jdbcType="VARCHAR"/>
<result property="val" column="VAL" jdbcType="INTEGER"/>
<result property="stp" column="STP" jdbcType="INTEGER"/>
</resultMap>
<!--查询单个-->
<select id="queryById" resultMap="CntMap">
select NAM,
VAL,
STP
from CNT
where NAM= #{nam}
</select>
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="CntMap">
select
NAM, VAL, STP
from CNT
<where>
<if test="nam != null and nam != ''">
and NAM = #{nam}
</if>
<if test="val != null">
and VAL = #{val}
</if>
<if test="stp != null">
and STP = #{stp}
</if>
</where>
limit #{pageable.offset}, #{pageable.pageSize}
</select>
<!--统计总行数-->
<select id="count" resultType="java.lang.Long">
select count(1)
from CNT
<where>
<if test="nam != null and nam != ''">
and NAM = #{nam}
</if>
<if test="val != null">
and VAL = #{val}
</if>
<if test="stp != null">
and STP = #{stp}
</if>
</where>
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="" useGeneratedKeys="true">
insert into CNT(NAM, VAL, STP)
values (#{nam}, #{val}, #{stp})
</insert>
<insert id="insertBatch" keyProperty="" useGeneratedKeys="true">
insert into CNT(NAM, VAL, STP)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.nam}, #{entity.val}, #{entity.stp})
</foreach>
</insert>
<insert id="insertOrUpdateBatch" keyProperty="" useGeneratedKeys="true">
insert into CNT(NAM, VAL, STP)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.nam}, #{entity.val}, #{entity.stp})
</foreach>
on duplicate key update
NAM = values(NAM),
VAL = values(VAL),
STP = values(STP)
</insert>
<!--通过主键修改数据-->
<update id="update">
update CNT
<set>
<if test="nam != null and nam != ''">
NAM = #{nam},
</if>
<if test="val != null">
VAL = #{val},
</if>
<if test="stp != null">
STP = #{stp},
</if>
</set>
where = #{}
</update>
<!--通过主键删除-->
<delete id="deleteById">
delete
from CNT
where NAM= #{nam}
</delete>
</mapper>
<?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.brilliance.mapper.CntMapper" >
<resultMap id="BaseResultMap" type="com.brilliance.entity.Cnt" >
<result column="NAM" property="nam" jdbcType="VARCHAR" />
<result column="VAL" property="val" jdbcType="DECIMAL" />
<result column="STP" property="stp" jdbcType="DECIMAL" />
</resultMap>
<insert id="insert" parameterType="com.brilliance.entity.Cnt" >
insert into NCB_GJ.CNT (NAM, VAL, STP
)
values (#{nam,jdbcType=VARCHAR}, #{val,jdbcType=DECIMAL}, #{stp,jdbcType=DECIMAL}
)
</insert>
<insert id="insertSelective" parameterType="com.brilliance.entity.Cnt" >
insert into NCB_GJ.CNT
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="nam != null" >
NAM,
</if>
<if test="val != null" >
VAL,
</if>
<if test="stp != null" >
STP,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="nam != null" >
#{nam,jdbcType=VARCHAR},
</if>
<if test="val != null" >
#{val,jdbcType=DECIMAL},
</if>
<if test="stp != null" >
#{stp,jdbcType=DECIMAL},
</if>
</trim>
</insert>
</mapper>
\ No newline at end of file
<?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.brilliance.mapper.SmhMapper" >
<resultMap id="BaseResultMap" type="com.brilliance.entity.Smh" >
<id column="INR" property="inr" jdbcType="CHAR" />
<result column="CRTFRM" property="crtfrm" jdbcType="VARCHAR" />
<result column="DATTIM" property="dattim" jdbcType="TIMESTAMP" />
</resultMap>
<sql id="Base_Column_List" >
INR, CRTFRM, DATTIM
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from NCB_GJ.SMH
where INR = #{inr,jdbcType=CHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
delete from NCB_GJ.SMH
where INR = #{inr,jdbcType=CHAR}
</delete>
<insert id="insert" parameterType="com.brilliance.entity.Smh" >
insert into NCB_GJ.SMH (INR, CRTFRM, DATTIM
)
values (#{inr,jdbcType=CHAR}, #{crtfrm,jdbcType=VARCHAR}, #{dattim,jdbcType=TIMESTAMP}
)
</insert>
<insert id="insertSelective" parameterType="com.brilliance.entity.Smh" >
insert into NCB_GJ.SMH
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="inr != null" >
INR,
</if>
<if test="crtfrm != null" >
CRTFRM,
</if>
<if test="dattim != null" >
DATTIM,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="inr != null" >
#{inr,jdbcType=CHAR},
</if>
<if test="crtfrm != null" >
#{crtfrm,jdbcType=VARCHAR},
</if>
<if test="dattim != null" >
#{dattim,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.brilliance.entity.Smh" >
update NCB_GJ.SMH
<set >
<if test="crtfrm != null" >
CRTFRM = #{crtfrm,jdbcType=VARCHAR},
</if>
<if test="dattim != null" >
DATTIM = #{dattim,jdbcType=TIMESTAMP},
</if>
</set>
where INR = #{inr,jdbcType=CHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.brilliance.entity.Smh" >
update NCB_GJ.SMH
set CRTFRM = #{crtfrm,jdbcType=VARCHAR},
DATTIM = #{dattim,jdbcType=TIMESTAMP}
where INR = #{inr,jdbcType=CHAR}
</update>
</mapper>
\ No newline at end of file
<?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.brilliance.mapper.SmqinfMapper" >
<resultMap id="BaseResultMap" type="com.brilliance.entity.Smqinf" >
<id column="INR" property="inr" jdbcType="CHAR" />
<result column="PTH" property="pth" jdbcType="VARCHAR" />
<result column="CNT" property="cnt" jdbcType="DECIMAL" />
<result column="STA" property="sta" jdbcType="CHAR" />
<result column="CREDAT" property="credat" jdbcType="TIMESTAMP" />
<result column="MESGNO" property="mesgno" jdbcType="VARCHAR" />
<result column="OBJINR" property="objinr" jdbcType="CHAR" />
<result column="OBJTYP" property="objtyp" jdbcType="VARCHAR" />
</resultMap>
<sql id="Base_Column_List" >
INR, PTH, CNT, STA, CREDAT, MESGNO, OBJINR, OBJTYP
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from NCB_GJ.SMQINF
where INR = #{inr,jdbcType=CHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
delete from NCB_GJ.SMQINF
where INR = #{inr,jdbcType=CHAR}
</delete>
<insert id="insert" parameterType="com.brilliance.entity.Smqinf" >
insert into NCB_GJ.SMQINF (INR, PTH, CNT, STA,
CREDAT, MESGNO, OBJINR,
OBJTYP)
values (#{inr,jdbcType=CHAR}, #{pth,jdbcType=VARCHAR}, #{cnt,jdbcType=DECIMAL}, #{sta,jdbcType=CHAR},
#{credat,jdbcType=TIMESTAMP}, #{mesgno,jdbcType=VARCHAR}, #{objinr,jdbcType=CHAR},
#{objtyp,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.brilliance.entity.Smqinf" >
insert into NCB_GJ.SMQINF
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="inr != null" >
INR,
</if>
<if test="pth != null" >
PTH,
</if>
<if test="cnt != null" >
CNT,
</if>
<if test="sta != null" >
STA,
</if>
<if test="credat != null" >
CREDAT,
</if>
<if test="mesgno != null" >
MESGNO,
</if>
<if test="objinr != null" >
OBJINR,
</if>
<if test="objtyp != null" >
OBJTYP,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="inr != null" >
#{inr,jdbcType=CHAR},
</if>
<if test="pth != null" >
#{pth,jdbcType=VARCHAR},
</if>
<if test="cnt != null" >
#{cnt,jdbcType=DECIMAL},
</if>
<if test="sta != null" >
#{sta,jdbcType=CHAR},
</if>
<if test="credat != null" >
#{credat,jdbcType=TIMESTAMP},
</if>
<if test="mesgno != null" >
#{mesgno,jdbcType=VARCHAR},
</if>
<if test="objinr != null" >
#{objinr,jdbcType=CHAR},
</if>
<if test="objtyp != null" >
#{objtyp,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.brilliance.entity.Smqinf" >
update NCB_GJ.SMQINF
<set >
<if test="pth != null" >
PTH = #{pth,jdbcType=VARCHAR},
</if>
<if test="cnt != null" >
CNT = #{cnt,jdbcType=DECIMAL},
</if>
<if test="sta != null" >
STA = #{sta,jdbcType=CHAR},
</if>
<if test="credat != null" >
CREDAT = #{credat,jdbcType=TIMESTAMP},
</if>
<if test="mesgno != null" >
MESGNO = #{mesgno,jdbcType=VARCHAR},
</if>
<if test="objinr != null" >
OBJINR = #{objinr,jdbcType=CHAR},
</if>
<if test="objtyp != null" >
OBJTYP = #{objtyp,jdbcType=VARCHAR},
</if>
</set>
where INR = #{inr,jdbcType=CHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.brilliance.entity.Smqinf" >
update NCB_GJ.SMQINF
set PTH = #{pth,jdbcType=VARCHAR},
CNT = #{cnt,jdbcType=DECIMAL},
STA = #{sta,jdbcType=CHAR},
CREDAT = #{credat,jdbcType=TIMESTAMP},
MESGNO = #{mesgno,jdbcType=VARCHAR},
OBJINR = #{objinr,jdbcType=CHAR},
OBJTYP = #{objtyp,jdbcType=VARCHAR}
where INR = #{inr,jdbcType=CHAR}
</update>
</mapper>
\ No newline at end of file
<?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.brilliance.mapper.SmqlckMapper" >
<resultMap id="BaseResultMap" type="com.brilliance.entity.Smqlck" >
<id column="INR" property="inr" jdbcType="CHAR" />
</resultMap>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
delete from NCB_GJ.SMQLCK
where INR = #{inr,jdbcType=CHAR}
</delete>
<insert id="insert" parameterType="com.brilliance.entity.Smqlck" >
insert into NCB_GJ.SMQLCK (INR)
values (#{inr,jdbcType=CHAR})
</insert>
<insert id="insertSelective" parameterType="com.brilliance.entity.Smqlck" >
insert into NCB_GJ.SMQLCK
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="inr != null" >
INR,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="inr != null" >
#{inr,jdbcType=CHAR},
</if>
</trim>
</insert>
</mapper>
\ No newline at end of file
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