ソースを参照

碳源投加部分接口新增 数据源改成SqlServer的

王苗苗 6 ヶ月 前
コミット
3a74bd3104

+ 30 - 0
pom.xml

@@ -52,6 +52,36 @@
             <groupId>org.projectlombok</groupId>
             <artifactId>lombok</artifactId>
         </dependency>
+
+        <!-- MyBatis Spring Boot Starter -->
+        <dependency>
+            <groupId>org.mybatis.spring.boot</groupId>
+            <artifactId>mybatis-spring-boot-starter</artifactId>
+            <version>2.2.2</version>
+        </dependency>
+
+        <!-- MySQL数据库驱动 -->
+        <!--<dependency>
+            <groupId>mysql</groupId>
+            <artifactId>mysql-connector-java</artifactId>
+            <scope>runtime</scope>
+        </dependency>-->
+
+        <!-- SQL Server Driver -->
+        <dependency>
+            <groupId>com.microsoft.sqlserver</groupId>
+            <artifactId>mssql-jdbc</artifactId>
+            <!--<scope>runtime</scope>-->
+            <version>8.1.0.jre8-preview</version>
+        </dependency>
+
+        <!-- https://mvnrepository.com/artifact/com.alibaba.fastjson2/fastjson2 -->
+        <dependency>
+            <groupId>com.alibaba.fastjson2</groupId>
+            <artifactId>fastjson2</artifactId>
+            <version>2.0.51</version>
+        </dependency>
+
     </dependencies>
     <dependencyManagement>
         <dependencies>

+ 3 - 0
src/main/java/com/xlht/xlhtproject/XlhtProjectApplication.java

@@ -1,9 +1,12 @@
 package com.xlht.xlhtproject;
 
+import org.mybatis.spring.annotation.MapperScan;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 
 @SpringBootApplication
+//@MapperScan("com.xlht.**.mapper")
+@MapperScan("com.xlht.xlhtproject.mapper")
 public class XlhtProjectApplication {
 
     public static void main(String[] args) {

+ 15 - 0
src/main/java/com/xlht/xlhtproject/controller/TestController.java

@@ -1,7 +1,11 @@
 package com.xlht.xlhtproject.controller;
 
 
+import com.alibaba.fastjson2.JSON;
+import com.xlht.xlhtproject.domain.TXinyiMedicineParam;
+import com.xlht.xlhtproject.mapper.TXinyiMedicineParamMapper;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
@@ -13,8 +17,19 @@ import javax.annotation.Resource;
 @Slf4j
 public class TestController {
 
+    @Autowired
+    private TXinyiMedicineParamMapper xinyiMedicineParamMapper;
+
     @GetMapping("/hello")
     public String hello() {
         return "hello";
     }
+
+    @GetMapping("/testMyBatis")
+    public TXinyiMedicineParam testMyBatis() {
+        TXinyiMedicineParam tXinyiMedicineParam = xinyiMedicineParamMapper.selectTXinyiMedicineParamById(1L);
+        System.out.println(JSON.toJSONString(tXinyiMedicineParam));
+        return tXinyiMedicineParam;
+    }
+
 }

+ 155 - 0
src/main/java/com/xlht/xlhtproject/domain/TXinyiMedicineParam.java

@@ -0,0 +1,155 @@
+package com.xlht.xlhtproject.domain;
+
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 智能投药参数设置对象 t_xinyi_medicine_param
+ * 
+ * @author slibra
+ * @date 2024-09-09
+ */
+@Data
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class TXinyiMedicineParam
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 主键 */
+    private Long id;
+
+    /** 加药泵(1 1号泵 ;2 2号泵 ;3 3号泵) */
+    private Long numberBeng;
+
+    /** 加药方式(0自动 1一号池 2二号池 3人工投放) */
+    private Long type;
+
+    /** 进水流量类型(0手动 1仪表) */
+    private Long jsLlType;
+
+    /** 进水流量1号池 */
+    private BigDecimal jsLlOne;
+
+    /** 进水流量2号池 */
+    private BigDecimal jsLlTwo;
+
+    /** 进水cod类型(0手动 1仪表 2化验) */
+    private Long jsCodType;
+
+    /** 进水cod1号池 */
+    private BigDecimal jsCodOne;
+
+    /** 进水cod二号池 */
+    private BigDecimal jsCodTwo;
+
+    /** 好氧池硝酸盐类型(0手动 1化验 2预测) */
+    private Long hycXsyType;
+
+    /** 好氧池硝酸盐1号池 */
+    private BigDecimal hycXsyOne;
+
+    /** 好氧池硝酸盐二号池 */
+    private BigDecimal hycXsyTwo;
+
+    /** 缺氧池硝酸盐类型(0手动 1化验) */
+    private Long qycYxyType;
+
+    /** 缺氧池硝酸盐1号池 */
+    private BigDecimal qycYxyOne;
+
+    /** 缺氧池硝酸盐2号池 */
+    private BigDecimal qycYxyTwo;
+
+    /** 缺氧池氨氮类型(0手动 1化验) */
+    private Long qycAdType;
+
+    /** 缺氧池氨氮1号池 */
+    private BigDecimal qycAdOne;
+
+    /** 缺氧池氨氮二号池 */
+    private BigDecimal qycAdTwo;
+
+    /** 进水总氮类型(0手动 1仪表) */
+    private Long jsTnType;
+
+    /** 进水总氮1号池 */
+    private BigDecimal jsTnOne;
+
+    /** 进水总氮2号池 */
+    private BigDecimal jsTnTwo;
+
+    /** 后台反馈设定 */
+    private BigDecimal htfksd;
+
+    /** 基准系数 */
+    private BigDecimal jzxs;
+
+    /** 修正系数 */
+    private BigDecimal xzxs;
+
+    /** 控制系数 */
+    private BigDecimal kzxs;
+
+    /** 水量分配系数 */
+    private BigDecimal slfpxs;
+
+    /** 碳源当量 */
+    private BigDecimal tydl;
+
+    /** 转换系数 */
+    private BigDecimal zhxs;
+
+    /** 稀释配属 */
+    private BigDecimal sxps;
+
+    /** 药剂密度 */
+    private BigDecimal yymd;
+
+    /** 最小启动流量 */
+    private BigDecimal zxqdll;
+
+    /** 碳氮比 */
+    private BigDecimal tdb;
+
+    /** 加药量 */
+    private BigDecimal medicineAmount;
+
+    /** 删除标志(0代表存在 2代表删除) */
+    private Long delFlag;
+
+    /** 乐观锁 */
+    private Long revision;
+
+    //额外查询的字段
+    //碳源投加瞬时流量
+    private BigDecimal tytjTransientLL;
+
+
+
+
+    /** 创建者 */
+    private String createBy;
+
+    /** 创建时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date createTime;
+
+    /** 更新者 */
+    private String updateBy;
+
+    /** 更新时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date updateTime;
+
+    /** 备注 */
+    private String remark;
+}

+ 67 - 0
src/main/java/com/xlht/xlhtproject/mapper/TXinyiMedicineParamMapper.java

@@ -0,0 +1,67 @@
+package com.xlht.xlhtproject.mapper;
+
+
+import com.xlht.xlhtproject.domain.TXinyiMedicineParam;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+/**
+ * 智能投药参数设置Mapper接口
+ * 
+ * @author slibra
+ * @date 2024-09-09
+ */
+@Mapper
+public interface TXinyiMedicineParamMapper 
+{
+    /**
+     * 查询智能投药参数设置
+     * 
+     * @param id 智能投药参数设置主键
+     * @return 智能投药参数设置
+     */
+    public TXinyiMedicineParam selectTXinyiMedicineParamById(Long id);
+
+    /**
+     * 查询智能投药参数设置列表
+     * 
+     * @param tXinyiMedicineParam 智能投药参数设置
+     * @return 智能投药参数设置集合
+     */
+    public List<TXinyiMedicineParam> selectTXinyiMedicineParamList(TXinyiMedicineParam tXinyiMedicineParam);
+
+    /**
+     * 新增智能投药参数设置
+     * 
+     * @param tXinyiMedicineParam 智能投药参数设置
+     * @return 结果
+     */
+    public int insertTXinyiMedicineParam(TXinyiMedicineParam tXinyiMedicineParam);
+
+    /**
+     * 修改智能投药参数设置
+     * 
+     * @param tXinyiMedicineParam 智能投药参数设置
+     * @return 结果
+     */
+    public int updateTXinyiMedicineParam(TXinyiMedicineParam tXinyiMedicineParam);
+
+    /**
+     * 删除智能投药参数设置
+     * 
+     * @param id 智能投药参数设置主键
+     * @return 结果
+     */
+    public int deleteTXinyiMedicineParamById(Long id);
+
+    /**
+     * 批量删除智能投药参数设置
+     * 
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteTXinyiMedicineParamByIds(Long[] ids);
+
+    TXinyiMedicineParam getLatestRecord();
+}

+ 65 - 0
src/main/java/com/xlht/xlhtproject/service/ITXinyiMedicineParamService.java

@@ -0,0 +1,65 @@
+package com.xlht.xlhtproject.service;
+
+
+import com.xlht.xlhtproject.domain.TXinyiMedicineParam;
+
+import java.util.List;
+
+/**
+ * 智能投药参数设置Service接口
+ * 
+ * @author slibra
+ * @date 2024-09-09
+ */
+public interface ITXinyiMedicineParamService 
+{
+    /**
+     * 查询智能投药参数设置
+     * 
+     * @param id 智能投药参数设置主键
+     * @return 智能投药参数设置
+     */
+    public TXinyiMedicineParam selectTXinyiMedicineParamById(Long id);
+
+    /**
+     * 查询智能投药参数设置列表
+     * 
+     * @param tXinyiMedicineParam 智能投药参数设置
+     * @return 智能投药参数设置集合
+     */
+    public List<TXinyiMedicineParam> selectTXinyiMedicineParamList(TXinyiMedicineParam tXinyiMedicineParam);
+
+    /**
+     * 新增智能投药参数设置
+     * 
+     * @param tXinyiMedicineParam 智能投药参数设置
+     * @return 结果
+     */
+    public int insertTXinyiMedicineParam(TXinyiMedicineParam tXinyiMedicineParam);
+
+    /**
+     * 修改智能投药参数设置
+     * 
+     * @param tXinyiMedicineParam 智能投药参数设置
+     * @return 结果
+     */
+    public int updateTXinyiMedicineParam(TXinyiMedicineParam tXinyiMedicineParam);
+
+    /**
+     * 批量删除智能投药参数设置
+     * 
+     * @param ids 需要删除的智能投药参数设置主键集合
+     * @return 结果
+     */
+    public int deleteTXinyiMedicineParamByIds(Long[] ids);
+
+    /**
+     * 删除智能投药参数设置信息
+     * 
+     * @param id 智能投药参数设置主键
+     * @return 结果
+     */
+    public int deleteTXinyiMedicineParamById(Long id);
+
+    TXinyiMedicineParam getLatestRecord();
+}

+ 114 - 0
src/main/java/com/xlht/xlhtproject/service/impl/TXinyiMedicineParamServiceImpl.java

@@ -0,0 +1,114 @@
+package com.xlht.xlhtproject.service.impl;
+
+
+import com.xlht.xlhtproject.domain.TXinyiMedicineParam;
+import com.xlht.xlhtproject.mapper.TXinyiMedicineParamMapper;
+import com.xlht.xlhtproject.service.ITXinyiMedicineParamService;
+import com.xlht.xlhtproject.utils.DateUtils;
+import org.apache.ibatis.annotations.Mapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Objects;
+
+
+/**
+ * 智能投药参数设置Service业务层处理
+ * 
+ * @author slibra
+ * @date 2024-09-09
+ */
+@Service
+public class TXinyiMedicineParamServiceImpl implements ITXinyiMedicineParamService
+{
+    @Autowired
+    private TXinyiMedicineParamMapper tXinyiMedicineParamMapper;
+
+    /*@Autowired
+    private TXinyiIndustryMapper xinyiIndustryMapper;*/
+
+    /**
+     * 查询智能投药参数设置
+     * 
+     * @param id 智能投药参数设置主键
+     * @return 智能投药参数设置
+     */
+    @Override
+    public TXinyiMedicineParam selectTXinyiMedicineParamById(Long id)
+    {
+        return tXinyiMedicineParamMapper.selectTXinyiMedicineParamById(id);
+    }
+
+    /**
+     * 查询智能投药参数设置列表
+     * 
+     * @param tXinyiMedicineParam 智能投药参数设置
+     * @return 智能投药参数设置
+     */
+    @Override
+    public List<TXinyiMedicineParam> selectTXinyiMedicineParamList(TXinyiMedicineParam tXinyiMedicineParam)
+    {
+        return tXinyiMedicineParamMapper.selectTXinyiMedicineParamList(tXinyiMedicineParam);
+    }
+
+    /**
+     * 新增智能投药参数设置
+     * 
+     * @param tXinyiMedicineParam 智能投药参数设置
+     * @return 结果
+     */
+    @Override
+    public int insertTXinyiMedicineParam(TXinyiMedicineParam tXinyiMedicineParam)
+    {
+        tXinyiMedicineParam.setCreateTime(DateUtils.getNowDate());
+        return tXinyiMedicineParamMapper.insertTXinyiMedicineParam(tXinyiMedicineParam);
+    }
+
+    /**
+     * 修改智能投药参数设置
+     * 
+     * @param tXinyiMedicineParam 智能投药参数设置
+     * @return 结果
+     */
+    @Override
+    public int updateTXinyiMedicineParam(TXinyiMedicineParam tXinyiMedicineParam)
+    {
+        tXinyiMedicineParam.setUpdateTime(DateUtils.getNowDate());
+        return tXinyiMedicineParamMapper.updateTXinyiMedicineParam(tXinyiMedicineParam);
+    }
+
+    /**
+     * 批量删除智能投药参数设置
+     * 
+     * @param ids 需要删除的智能投药参数设置主键
+     * @return 结果
+     */
+    @Override
+    public int deleteTXinyiMedicineParamByIds(Long[] ids)
+    {
+        return tXinyiMedicineParamMapper.deleteTXinyiMedicineParamByIds(ids);
+    }
+
+    /**
+     * 删除智能投药参数设置信息
+     * 
+     * @param id 智能投药参数设置主键
+     * @return 结果
+     */
+    @Override
+    public int deleteTXinyiMedicineParamById(Long id)
+    {
+        return tXinyiMedicineParamMapper.deleteTXinyiMedicineParamById(id);
+    }
+
+    @Override
+    public TXinyiMedicineParam getLatestRecord() {
+        TXinyiMedicineParam latestRecord = this.tXinyiMedicineParamMapper.getLatestRecord();
+        //todo 额外查询 碳源投加瞬时流量
+        if(!Objects.isNull(latestRecord)){
+
+        }
+        return latestRecord;
+    }
+}

+ 259 - 0
src/main/java/com/xlht/xlhtproject/utils/DateUtils.java

@@ -0,0 +1,259 @@
+package com.xlht.xlhtproject.utils;
+
+import org.apache.commons.lang3.time.DateFormatUtils;
+
+import java.lang.management.ManagementFactory;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.time.*;
+import java.time.format.DateTimeFormatter;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 时间工具类
+ * 
+ *
+ */
+public class DateUtils extends org.apache.commons.lang3.time.DateUtils
+{
+    public static String YYYY = "yyyy";
+
+    public static String YYYY_MM = "yyyy-MM";
+
+    public static String YYYY_MM_DD = "yyyy-MM-dd";
+
+    public static String YYYY_MM_DD_HH = "yyyy-MM-dd HH";
+    public static String YYYY_MM_DD_HH_MM = "yyyy-MM-dd HH:mm";
+
+    public static String YYYYMMDDHHMMSS = "yyyyMMddHHmmss";
+
+    public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
+
+    public static String YYYYMMDDHHMM_TS = "yyyy/MM/dd HH:mm";
+    public static String YYYYMMDDHH_TS = "yyyy/MM/dd HH";
+    public static String YYYYMMDD_TS = "yyyy/MM/dd";
+    public static String YYYYMM_TS = "yyyy/MM";
+    public static String YYYYMMDDHH_CHINESE = "yyyy年MM月dd日 HH";
+
+    private static String[] parsePatterns = {
+            "yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM", 
+            "yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy/MM",
+            "yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss", "yyyy.MM.dd HH:mm", "yyyy.MM"};
+
+    /**
+     * 获取当前Date型日期
+     * 
+     * @return Date() 当前日期
+     */
+    public static Date getNowDate()
+    {
+        return new Date();
+    }
+
+    /**
+     * 获取当前日期, 默认格式为yyyy-MM-dd
+     * 
+     * @return String
+     */
+    public static String getDate()
+    {
+        return dateTimeNow(YYYY_MM_DD);
+    }
+
+    public static final String getTime()
+    {
+        return dateTimeNow(YYYY_MM_DD_HH_MM_SS);
+    }
+
+    public static final String dateTimeNow()
+    {
+        return dateTimeNow(YYYYMMDDHHMMSS);
+    }
+
+    public static final String dateTimeNow(final String format)
+    {
+        return parseDateToStr(format, new Date());
+    }
+
+    public static final String dateTime(final Date date)
+    {
+        return parseDateToStr(YYYY_MM_DD, date);
+    }
+
+    public static final String parseDateToStr(final String format, final Date date)
+    {
+        return new SimpleDateFormat(format).format(date);
+    }
+
+    public static final Date dateTime(final String format, final String ts)
+    {
+        try
+        {
+            return new SimpleDateFormat(format).parse(ts);
+        }
+        catch (ParseException e)
+        {
+            throw new RuntimeException(e);
+        }
+    }
+
+    /**
+     * 日期路径 即年/月/日 如2018/08/08
+     */
+    public static final String datePath()
+    {
+        Date now = new Date();
+        return DateFormatUtils.format(now, "yyyy/MM/dd");
+    }
+
+    /**
+     * 日期路径 即年/月/日 如20180808
+     */
+    public static final String dateTime()
+    {
+        Date now = new Date();
+        return DateFormatUtils.format(now, "yyyyMMdd");
+    }
+
+    /**
+     * 日期型字符串转化为日期 格式
+     */
+    public static Date parseDate(Object str)
+    {
+        if (str == null)
+        {
+            return null;
+        }
+        try
+        {
+            return parseDate(str.toString(), parsePatterns);
+        }
+        catch (ParseException e)
+        {
+            return null;
+        }
+    }
+
+    /**
+     * 获取服务器启动时间
+     */
+    public static Date getServerStartDate()
+    {
+        long time = ManagementFactory.getRuntimeMXBean().getStartTime();
+        return new Date(time);
+    }
+
+    /**
+     * 计算相差天数
+     */
+    public static int differentDaysByMillisecond(Date date1, Date date2)
+    {
+        return Math.abs((int) ((date2.getTime() - date1.getTime()) / (1000 * 3600 * 24)));
+    }
+
+
+
+    /**
+     * 计算相差小时数
+     */
+    public static int differentHoursByMillisecond(Date date1, Date date2)
+    {
+        return Math.abs((int) ((date2.getTime() - date1.getTime()) / (1000 * 3600)));
+    }
+
+    /**
+     * 计算时间差
+     *
+     * @param endDate 最后时间
+     * @param startTime 开始时间
+     * @return 时间差(天/小时/分钟)
+     */
+    public static String timeDistance(Date endDate, Date startTime)
+    {
+        long nd = 1000 * 24 * 60 * 60;
+        long nh = 1000 * 60 * 60;
+        long nm = 1000 * 60;
+        // long ns = 1000;
+        // 获得两个时间的毫秒时间差异
+        long diff = endDate.getTime() - startTime.getTime();
+        // 计算差多少天
+        long day = diff / nd;
+        // 计算差多少小时
+        long hour = diff % nd / nh;
+        // 计算差多少分钟
+        long min = diff % nd % nh / nm;
+        // 计算差多少秒//输出结果
+        // long sec = diff % nd % nh % nm / ns;
+        return day + "天" + hour + "小时" + min + "分钟";
+    }
+
+    /**
+     * 增加 LocalDateTime ==> Date
+     */
+    public static Date toDate(LocalDateTime temporalAccessor)
+    {
+        ZonedDateTime zdt = temporalAccessor.atZone(ZoneId.systemDefault());
+        return Date.from(zdt.toInstant());
+    }
+
+    /**
+     * 增加 LocalDate ==> Date
+     */
+    public static Date toDate(LocalDate temporalAccessor)
+    {
+        LocalDateTime localDateTime = LocalDateTime.of(temporalAccessor, LocalTime.of(0, 0, 0));
+        ZonedDateTime zdt = localDateTime.atZone(ZoneId.systemDefault());
+        return Date.from(zdt.toInstant());
+    }
+
+
+    public static Date plusDate(int day, Date current)
+    {
+
+        // 创建一个Calendar实例,并将日期设置为今天
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(current);
+        // 将日期设置为前一天
+        calendar.add(Calendar.DATE, day);
+
+        // 转换
+        return calendar.getTime();
+    }
+
+
+    public static List<String> getAllDatesBetween(LocalDate startDate, LocalDate endDate) {
+        List<String> dates = new ArrayList<>();
+        LocalDate currentDate = startDate;
+
+        while (!currentDate.isAfter(endDate)) {
+            dates.add(currentDate.format(DateTimeFormatter.ofPattern(DateUtils.YYYYMMDD_TS)));
+            currentDate = currentDate.plusDays(1);
+        }
+
+        return dates;
+    }
+
+
+    public static String getMonthsBefore(String inputDate, int n) {
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern(YYYY_MM_DD);
+        DateTimeFormatter formatterOut = DateTimeFormatter.ofPattern(YYYY_MM);
+        LocalDate date = LocalDate.parse(inputDate + "-01", formatter.withZone(ZoneId.systemDefault()));
+        // 获取 n 个月之前的日期
+        LocalDate targetDate = date.minusMonths(n);
+        // 格式化目标日期为 "yyyy-MM" 格式
+        return targetDate.format(formatterOut);
+    }
+
+
+    public static void main(String[] args) {
+        Date nowDate = DateUtils.getNowDate();
+        Date date = plusDate(1, nowDate);
+        Date date1 = plusDate(-1, nowDate);
+        System.out.println(date);
+        System.out.println(date1);
+        System.out.println(getMonthsBefore("2024-02", 2));
+    }
+}

+ 17 - 0
src/main/resources/application.yml

@@ -23,4 +23,21 @@ logging:
     org.springframework: warn
 
 
+spring:
+  datasource:
+    url: jdbc:sqlserver://10.1.100.119:1433;DatabaseName=HS_WEB;encrypt=false;trustServerCertificate=true;
+    username: sa
+    password: Abc123456
+    driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
+
+## MyBatis配置
+mybatis:
+  # 搜索指定包别名
+  typeAliasesPackage: com.xlht.**.domain
+  # 配置mapper的扫描,找到所有的mapper.xml映射文件
+  mapperLocations: classpath*:mapper/**/*Mapper.xml
+  # 加载全局的配置文件
+  configLocation: classpath:mybatis/mybatis-config.xml
+
+
 

+ 251 - 0
src/main/resources/mapper/TXinyiMedicineParamMapper.xml

@@ -0,0 +1,251 @@
+<?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.xlht.xlhtproject.mapper.TXinyiMedicineParamMapper">
+    
+    <resultMap type="com.xlht.xlhtproject.domain.TXinyiMedicineParam" id="TXinyiMedicineParamResult">
+        <result property="id"    column="id"    />
+        <result property="numberBeng"    column="number_beng"    />
+        <result property="type"    column="type"    />
+        <result property="jsLlType"    column="js_ll_type"    />
+        <result property="jsLlOne"    column="js_ll_one"    />
+        <result property="jsLlTwo"    column="js_ll_two"    />
+        <result property="jsCodType"    column="js_cod_type"    />
+        <result property="jsCodOne"    column="js_cod_one"    />
+        <result property="jsCodTwo"    column="js_cod_two"    />
+        <result property="hycXsyType"    column="hyc_xsy_type"    />
+        <result property="hycXsyOne"    column="hyc_xsy_one"    />
+        <result property="hycXsyTwo"    column="hyc_xsy_two"    />
+        <result property="qycYxyType"    column="qyc_yxy_type"    />
+        <result property="qycYxyOne"    column="qyc_yxy_one"    />
+        <result property="qycYxyTwo"    column="qyc_yxy_two"    />
+        <result property="qycAdType"    column="qyc_ad_type"    />
+        <result property="qycAdOne"    column="qyc_ad_one"    />
+        <result property="qycAdTwo"    column="qyc_ad_two"    />
+        <result property="jsTnType"    column="js_tn_type"    />
+        <result property="jsTnOne"    column="js_tn_one"    />
+        <result property="jsTnTwo"    column="js_tn_two"    />
+        <result property="htfksd"    column="htfksd"    />
+        <result property="jzxs"    column="jzxs"    />
+        <result property="xzxs"    column="xzxs"    />
+        <result property="kzxs"    column="kzxs"    />
+        <result property="slfpxs"    column="slfpxs"    />
+        <result property="tydl"    column="tydl"    />
+        <result property="zhxs"    column="zhxs"    />
+        <result property="sxps"    column="sxps"    />
+        <result property="yymd"    column="yymd"    />
+        <result property="zxqdll"    column="zxqdll"    />
+        <result property="tdb"    column="tdb"    />
+        <result property="medicineAmount"    column="medicine_amount"    />
+        <result property="delFlag"    column="del_flag"    />
+        <result property="revision"    column="revision"    />
+        <result property="createBy"    column="create_by"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateBy"    column="update_by"    />
+        <result property="updateTime"    column="update_time"    />
+        <result property="remark"    column="remark"    />
+    </resultMap>
+
+    <sql id="selectTXinyiMedicineParamVo">
+        select id, number_beng, type, js_ll_type, js_ll_one, js_ll_two, js_cod_type, js_cod_one, js_cod_two, hyc_xsy_type, hyc_xsy_one, hyc_xsy_two, qyc_yxy_type, qyc_yxy_one, qyc_yxy_two, qyc_ad_type, qyc_ad_one, qyc_ad_two, js_tn_type, js_tn_one, js_tn_two, htfksd, jzxs, xzxs, kzxs, slfpxs, tydl, zhxs, sxps, yymd, zxqdll, tdb, medicine_amount, del_flag, revision, create_by, create_time, update_by, update_time, remark from t_xinyi_medicine_param
+    </sql>
+
+    <select id="selectTXinyiMedicineParamList" parameterType="com.xlht.xlhtproject.domain.TXinyiMedicineParam" resultMap="TXinyiMedicineParamResult">
+        <include refid="selectTXinyiMedicineParamVo"/>
+        <where>
+            1 = 1
+            <if test="numberBeng != null "> and number_beng = #{numberBeng}</if>
+            <if test="type != null "> and type = #{type}</if>
+            <if test="jsLlType != null "> and js_ll_type = #{jsLlType}</if>
+            <if test="jsLlOne != null "> and js_ll_one = #{jsLlOne}</if>
+            <if test="jsLlTwo != null "> and js_ll_two = #{jsLlTwo}</if>
+            <if test="jsCodType != null "> and js_cod_type = #{jsCodType}</if>
+            <if test="jsCodOne != null "> and js_cod_one = #{jsCodOne}</if>
+            <if test="jsCodTwo != null "> and js_cod_two = #{jsCodTwo}</if>
+            <if test="hycXsyType != null "> and hyc_xsy_type = #{hycXsyType}</if>
+            <if test="hycXsyOne != null "> and hyc_xsy_one = #{hycXsyOne}</if>
+            <if test="hycXsyTwo != null "> and hyc_xsy_two = #{hycXsyTwo}</if>
+            <if test="qycYxyType != null "> and qyc_yxy_type = #{qycYxyType}</if>
+            <if test="qycYxyOne != null "> and qyc_yxy_one = #{qycYxyOne}</if>
+            <if test="qycYxyTwo != null "> and qyc_yxy_two = #{qycYxyTwo}</if>
+            <if test="qycAdType != null "> and qyc_ad_type = #{qycAdType}</if>
+            <if test="qycAdOne != null "> and qyc_ad_one = #{qycAdOne}</if>
+            <if test="qycAdTwo != null "> and qyc_ad_two = #{qycAdTwo}</if>
+            <if test="jsTnType != null "> and js_tn_type = #{jsTnType}</if>
+            <if test="jsTnOne != null "> and js_tn_one = #{jsTnOne}</if>
+            <if test="jsTnTwo != null "> and js_tn_two = #{jsTnTwo}</if>
+            <if test="htfksd != null "> and htfksd = #{htfksd}</if>
+            <if test="jzxs != null "> and jzxs = #{jzxs}</if>
+            <if test="xzxs != null "> and xzxs = #{xzxs}</if>
+            <if test="kzxs != null "> and kzxs = #{kzxs}</if>
+            <if test="slfpxs != null "> and slfpxs = #{slfpxs}</if>
+            <if test="tydl != null "> and tydl = #{tydl}</if>
+            <if test="zhxs != null "> and zhxs = #{zhxs}</if>
+            <if test="sxps != null "> and sxps = #{sxps}</if>
+            <if test="yymd != null "> and yymd = #{yymd}</if>
+            <if test="zxqdll != null "> and zxqdll = #{zxqdll}</if>
+            <if test="tdb != null "> and tdb = #{tdb}</if>
+            <if test="medicineAmount != null "> and medicine_amount = #{medicineAmount}</if>
+            <if test="revision != null "> and revision = #{revision}</if>
+        </where>
+        and del_flag = 0 order by id desc
+    </select>
+    
+    <select id="selectTXinyiMedicineParamById" parameterType="Long" resultMap="TXinyiMedicineParamResult">
+        <include refid="selectTXinyiMedicineParamVo"/>
+        where id = #{id} and del_flag = 0
+    </select>
+        
+    <insert id="insertTXinyiMedicineParam" parameterType="com.xlht.xlhtproject.domain.TXinyiMedicineParam" useGeneratedKeys="true" keyProperty="id">
+        insert into t_xinyi_medicine_param
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="numberBeng != null">number_beng,</if>
+            <if test="type != null">type,</if>
+            <if test="jsLlType != null">js_ll_type,</if>
+            <if test="jsLlOne != null">js_ll_one,</if>
+            <if test="jsLlTwo != null">js_ll_two,</if>
+            <if test="jsCodType != null">js_cod_type,</if>
+            <if test="jsCodOne != null">js_cod_one,</if>
+            <if test="jsCodTwo != null">js_cod_two,</if>
+            <if test="hycXsyType != null">hyc_xsy_type,</if>
+            <if test="hycXsyOne != null">hyc_xsy_one,</if>
+            <if test="hycXsyTwo != null">hyc_xsy_two,</if>
+            <if test="qycYxyType != null">qyc_yxy_type,</if>
+            <if test="qycYxyOne != null">qyc_yxy_one,</if>
+            <if test="qycYxyTwo != null">qyc_yxy_two,</if>
+            <if test="qycAdType != null">qyc_ad_type,</if>
+            <if test="qycAdOne != null">qyc_ad_one,</if>
+            <if test="qycAdTwo != null">qyc_ad_two,</if>
+            <if test="jsTnType != null">js_tn_type,</if>
+            <if test="jsTnOne != null">js_tn_one,</if>
+            <if test="jsTnTwo != null">js_tn_two,</if>
+            <if test="htfksd != null">htfksd,</if>
+            <if test="jzxs != null">jzxs,</if>
+            <if test="xzxs != null">xzxs,</if>
+            <if test="kzxs != null">kzxs,</if>
+            <if test="slfpxs != null">slfpxs,</if>
+            <if test="tydl != null">tydl,</if>
+            <if test="zhxs != null">zhxs,</if>
+            <if test="sxps != null">sxps,</if>
+            <if test="yymd != null">yymd,</if>
+            <if test="zxqdll != null">zxqdll,</if>
+            <if test="tdb != null">tdb,</if>
+            <if test="medicineAmount != null">medicine_amount,</if>
+            <if test="delFlag != null">del_flag,</if>
+            <if test="revision != null">revision,</if>
+            <if test="createBy != null">create_by,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="updateBy != null">update_by,</if>
+            <if test="updateTime != null">update_time,</if>
+            <if test="remark != null">remark,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="numberBeng != null">#{numberBeng},</if>
+            <if test="type != null">#{type},</if>
+            <if test="jsLlType != null">#{jsLlType},</if>
+            <if test="jsLlOne != null">#{jsLlOne},</if>
+            <if test="jsLlTwo != null">#{jsLlTwo},</if>
+            <if test="jsCodType != null">#{jsCodType},</if>
+            <if test="jsCodOne != null">#{jsCodOne},</if>
+            <if test="jsCodTwo != null">#{jsCodTwo},</if>
+            <if test="hycXsyType != null">#{hycXsyType},</if>
+            <if test="hycXsyOne != null">#{hycXsyOne},</if>
+            <if test="hycXsyTwo != null">#{hycXsyTwo},</if>
+            <if test="qycYxyType != null">#{qycYxyType},</if>
+            <if test="qycYxyOne != null">#{qycYxyOne},</if>
+            <if test="qycYxyTwo != null">#{qycYxyTwo},</if>
+            <if test="qycAdType != null">#{qycAdType},</if>
+            <if test="qycAdOne != null">#{qycAdOne},</if>
+            <if test="qycAdTwo != null">#{qycAdTwo},</if>
+            <if test="jsTnType != null">#{jsTnType},</if>
+            <if test="jsTnOne != null">#{jsTnOne},</if>
+            <if test="jsTnTwo != null">#{jsTnTwo},</if>
+            <if test="htfksd != null">#{htfksd},</if>
+            <if test="jzxs != null">#{jzxs},</if>
+            <if test="xzxs != null">#{xzxs},</if>
+            <if test="kzxs != null">#{kzxs},</if>
+            <if test="slfpxs != null">#{slfpxs},</if>
+            <if test="tydl != null">#{tydl},</if>
+            <if test="zhxs != null">#{zhxs},</if>
+            <if test="sxps != null">#{sxps},</if>
+            <if test="yymd != null">#{yymd},</if>
+            <if test="zxqdll != null">#{zxqdll},</if>
+            <if test="tdb != null">#{tdb},</if>
+            <if test="medicineAmount != null">#{medicineAmount},</if>
+            <if test="delFlag != null">#{delFlag},</if>
+            <if test="revision != null">#{revision},</if>
+            <if test="createBy != null">#{createBy},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="updateBy != null">#{updateBy},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+            <if test="remark != null">#{remark},</if>
+         </trim>
+    </insert>
+
+    <update id="updateTXinyiMedicineParam" parameterType="com.xlht.xlhtproject.domain.TXinyiMedicineParam">
+        update t_xinyi_medicine_param
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="numberBeng != null">number_beng = #{numberBeng},</if>
+            <if test="type != null">type = #{type},</if>
+            <if test="jsLlType != null">js_ll_type = #{jsLlType},</if>
+            <if test="jsLlOne != null">js_ll_one = #{jsLlOne},</if>
+            <if test="jsLlTwo != null">js_ll_two = #{jsLlTwo},</if>
+            <if test="jsCodType != null">js_cod_type = #{jsCodType},</if>
+            <if test="jsCodOne != null">js_cod_one = #{jsCodOne},</if>
+            <if test="jsCodTwo != null">js_cod_two = #{jsCodTwo},</if>
+            <if test="hycXsyType != null">hyc_xsy_type = #{hycXsyType},</if>
+            <if test="hycXsyOne != null">hyc_xsy_one = #{hycXsyOne},</if>
+            <if test="hycXsyTwo != null">hyc_xsy_two = #{hycXsyTwo},</if>
+            <if test="qycYxyType != null">qyc_yxy_type = #{qycYxyType},</if>
+            <if test="qycYxyOne != null">qyc_yxy_one = #{qycYxyOne},</if>
+            <if test="qycYxyTwo != null">qyc_yxy_two = #{qycYxyTwo},</if>
+            <if test="qycAdType != null">qyc_ad_type = #{qycAdType},</if>
+            <if test="qycAdOne != null">qyc_ad_one = #{qycAdOne},</if>
+            <if test="qycAdTwo != null">qyc_ad_two = #{qycAdTwo},</if>
+            <if test="jsTnType != null">js_tn_type = #{jsTnType},</if>
+            <if test="jsTnOne != null">js_tn_one = #{jsTnOne},</if>
+            <if test="jsTnTwo != null">js_tn_two = #{jsTnTwo},</if>
+            <if test="htfksd != null">htfksd = #{htfksd},</if>
+            <if test="jzxs != null">jzxs = #{jzxs},</if>
+            <if test="xzxs != null">xzxs = #{xzxs},</if>
+            <if test="kzxs != null">kzxs = #{kzxs},</if>
+            <if test="slfpxs != null">slfpxs = #{slfpxs},</if>
+            <if test="tydl != null">tydl = #{tydl},</if>
+            <if test="zhxs != null">zhxs = #{zhxs},</if>
+            <if test="sxps != null">sxps = #{sxps},</if>
+            <if test="yymd != null">yymd = #{yymd},</if>
+            <if test="zxqdll != null">zxqdll = #{zxqdll},</if>
+            <if test="tdb != null">tdb = #{tdb},</if>
+            <if test="medicineAmount != null">medicine_amount = #{medicineAmount},</if>
+            <if test="delFlag != null">del_flag = #{delFlag},</if>
+            <if test="revision != null">revision = #{revision},</if>
+            <if test="createBy != null">create_by = #{createBy},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="updateBy != null">update_by = #{updateBy},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+            <if test="remark != null">remark = #{remark},</if>
+        </trim>
+        ,revision = revision + 1
+        where id = #{id}
+    </update>
+
+    
+
+    <delete id="deleteTXinyiMedicineParamById" parameterType="Long">
+        update t_xinyi_medicine_param set del_flag = 2,revision = revision + 1 where del_flag = 0 and id = #{id}
+    </delete>
+
+    <delete id="deleteTXinyiMedicineParamByIds" parameterType="String">
+        update t_xinyi_medicine_param set del_flag = 2,revision = revision + 1 where del_flag = 0 and id in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+
+    <!-- 下面是新增的SQL,不要覆盖 -->
+    <select id="getLatestRecord" resultMap="TXinyiMedicineParamResult">
+        <include refid="selectTXinyiMedicineParamVo"/>
+        where del_flag = 0 order by id desc limit 1
+    </select>
+</mapper>

+ 20 - 0
src/main/resources/mybatis/mybatis-config.xml

@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE configuration
+PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-config.dtd">
+<configuration>
+    <!-- 全局参数 -->
+    <settings>
+        <!-- 使全局的映射器启用或禁用缓存 -->
+        <setting name="cacheEnabled"             value="true"   />
+        <!-- 允许JDBC 支持自动生成主键 -->
+        <setting name="useGeneratedKeys"         value="true"   />
+        <!-- 配置默认的执行器.SIMPLE就是普通执行器;REUSE执行器会重用预处理语句(prepared statements);BATCH执行器将重用语句并执行批量更新 -->
+        <setting name="defaultExecutorType"      value="SIMPLE" />
+		<!-- 指定 MyBatis 所用日志的具体实现 -->
+        <setting name="logImpl"                  value="SLF4J"  />
+        <!-- 使用驼峰命名法转换字段 -->
+		<!-- <setting name="mapUnderscoreToCamelCase" value="true"/> -->
+	</settings>
+	
+</configuration>

+ 19 - 0
src/test/java/com/xlht/xlhtproject/XlhtProjectApplicationTests.java

@@ -1,6 +1,12 @@
 package com.xlht.xlhtproject;
 
+import com.alibaba.fastjson2.JSON;
+import com.xlht.xlhtproject.domain.TXinyiMedicineParam;
+import com.xlht.xlhtproject.mapper.TXinyiMedicineParamMapper;
+import com.xlht.xlhtproject.service.ITXinyiMedicineParamService;
+import org.apache.tomcat.Jar;
 import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
 
 @SpringBootTest
@@ -10,4 +16,17 @@ class XlhtProjectApplicationTests {
     void contextLoads() {
     }
 
+    @Autowired
+    private ITXinyiMedicineParamService itXinyiMedicineParamService;
+
+    @Autowired
+    private TXinyiMedicineParamMapper xinyiMedicineParamMapper;
+
+
+    @Test
+    public void testMyBatis(){
+        TXinyiMedicineParam tXinyiMedicineParam = xinyiMedicineParamMapper.selectTXinyiMedicineParamById(1L);
+        System.out.println(JSON.toJSONString(tXinyiMedicineParam));
+    }
+
 }

+ 27 - 0
src/test/java/com/xlht/xlhtproject/test/Test.java

@@ -0,0 +1,27 @@
+package com.xlht.xlhtproject.test;
+
+
+import com.alibaba.fastjson2.JSON;
+import com.xlht.xlhtproject.domain.TXinyiMedicineParam;
+import com.xlht.xlhtproject.mapper.TXinyiMedicineParamMapper;
+import com.xlht.xlhtproject.service.ITXinyiMedicineParamService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+
+@SpringBootTest
+public class Test {
+
+
+    @Autowired
+    private ITXinyiMedicineParamService itXinyiMedicineParamService;
+
+    @Autowired
+    private TXinyiMedicineParamMapper xinyiMedicineParamMapper;
+
+
+    @org.junit.jupiter.api.Test
+    public void testMyBatis(){
+        TXinyiMedicineParam tXinyiMedicineParam = xinyiMedicineParamMapper.selectTXinyiMedicineParamById(1L);
+        System.out.println(JSON.toJSONString(tXinyiMedicineParam));
+    }
+}