mybatis逆向工程

这篇博客介绍了如何利用Mybatis的逆向工程(mbg.xml)来配置并生成Mapper.xml和Mapper.java文件,详细阐述了pom.xml的配置,并提到了通过执行MbgUtil.java来触发文件生成的过程。
摘要由CSDN通过智能技术生成

mbg.xml

此文件放在项目最外层,也就是和默认的pom.xml同路径。

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration
  PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
  "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<generatorConfiguration>
	<context id="DB2Tables" targetRuntime="MyBatis3">
		<!-- 去除生成注释 -->
		<commentGenerator>
			<property name="suppressAllComments" value="true" />
		</commentGenerator>

		<!-- 配置数据库连接 -->
		<jdbcConnection driverClass="oracle.jdbc.OracleDriver"
			connectionURL="jdbc:oracle:thin:@192.168.130.22:1521/orcl" userId="edhj"
			password="edhj">
		</jdbcConnection>

		<javaTypeResolver>
			<property name="forceBigDecimals" value="false" />
		</javaTypeResolver>

		<!-- 指定javabean生成的位置 -->
		<javaModelGenerator targetPackage="com.test.dao.entity"
			targetProject=".\src\main\java">
			<property name="enableSubPackages" value="true" />
			<property name="trimStrings" value="true" />
		</javaModelGenerator>

		<!-- 指定sql映射文件生成的位置 -->
		<sqlMapGenerator targetPackage="mapper" targetProject=".\src\main\resources">
			<property name="enableSubPackages" value="true" />
		</sqlMapGenerator>

		<!-- 指定dao接口生成的位置,mapper接口 -->
		<javaClientGenerator type="XMLMAPPER"
			targetPackage="com.test.dao.mapper" targetProject=".\src\main\java">
			<property name="enableSubPackages" value="true" />
		</javaClientGenerator>

		<!-- table指定每个表的生成策略 -->
		<table tableName="sys_user" domainObjectName="SysUserEntity"></table>
	</context>
</generatorConfiguration>

以下是我的pom.xml配置

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>testGenender</groupId>
  <artifactId>testGenender</artifactId>
  <version>0.0.1-SNAPSHOT</version>
<dependencies>
		<!--springmvc spring -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-webmvc</artifactId>
			<version>4.3.7.RELEASE</version>
		</dependency>
		<!--spring-jdbc -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-jdbc</artifactId>
			<version>4.3.7.RELEASE</version>
		</dependency>
		<!--spring-aop -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-aspects</artifactId>
			<version>4.3.7.RELEASE</version>
		</dependency>
		<!-- spring 测试 -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-test</artifactId>
			<version>4.3.7.RELEASE</version>
		</dependency>
		
		<!-- mybatis -->
		<dependency>
			<groupId>org.mybatis</groupId>
			<artifactId>mybatis</artifactId>
			<version>3.4.2</version>
		</dependency>
		<!-- mybatis 整合spring -->
		<dependency>
			<groupId>org.mybatis</groupId>
			<artifactId>mybatis-spring</artifactId>
			<version>1.3.1</version>
		</dependency>
		
		<!-- jstl,servlet-api,junit -->
		<dependency>
			<groupId>jstl</groupId>
			<artifactId>jstl</artifactId>
			<version>1.2</version>
		</dependency>
		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>javax.servlet-api</artifactId>
			<version>3.0.1</version>
			<scope>provided</scope>
		</dependency>

		<!--https://mvnrepository.com/artifact/log4j/log4j -->
		<dependency>
			<groupId>log4j</groupId>
			<artifactId>log4j</artifactId>
			<version>1.2.16</version>
		</dependency>

		<!-- 逆向工程 支持包 -->
		<dependency>
			<groupId>org.mybatis.generator</groupId>
			<artifactId>mybatis-generator-core</artifactId>
			<version>1.3.5</version>
		</dependency>
		
		<dependency>
			<groupId>com.oracle</groupId>
			<artifactId>ojdbc14</artifactId>
			<version>11.2.0</version>
		</dependency>
		
	</dependencies>

	<build>
		<finalName>testGenender</finalName>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>2.3.2</version>
				<configuration>
					<source>1.7</source>
					<target>1.7</target>
				</configuration>
			</plugin>
		</plugins>
	</build>
</project>

启动MbgUtil.java后,刷新工程,即可看到生成的文件。


/**
 * 逆向生成JavaBean
 * @author nyb
 */
public class MbgUtil {
	public static void main(String[] args) throws Exception {
		List<String> warnings = new ArrayList<String>();
		boolean overwrite = true;
		File configFile = new File("mbg.xml");
		ConfigurationParser cp = new ConfigurationParser(warnings);
		Configuration config = cp.parseConfiguration(configFile);
		DefaultShellCallback callback = new DefaultShellCallback(overwrite);
		MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config,
				callback, warnings);
		myBatisGenerator.generate(null);
	}
}

生成后的Mapper.xml

<?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="cc.ewell.pyzxyy.dao.mapper.ReportPhthisisRecMapper">
  <resultMap id="BaseResultMap" type="cc.ewell.pyzxyy.dao.entity.ReportPhthisisRec">
    <id column="TB_TRANSFER_ID" jdbcType="DECIMAL" property="tbTransferId" />
    <result column="REPORT_ID" jdbcType="DECIMAL" property="reportId" />
    <result column="PATIENT_ID" jdbcType="VARCHAR" property="patientId" />
    <result column="REPORT_NO" jdbcType="VARCHAR" property="reportNo" />
    <result column="INP_NO" jdbcType="VARCHAR" property="inpNo" />
    <result column="REPORT_STATUS" jdbcType="VARCHAR" property="reportStatus" />
    <result column="NAME" jdbcType="VARCHAR" property="name" />
    <result column="SEX_CODE" jdbcType="VARCHAR" property="sexCode" />
    <result column="UNIT_IN_CONTRACT" jdbcType="VARCHAR" property="unitInContract" />
    <result column="UNIT_PHONE" jdbcType="VARCHAR" property="unitPhone" />
    <result column="GRADE_CLASS" jdbcType="VARCHAR" property="gradeClass" />
    <result column="PAT_AREA_TYPE" jdbcType="VARCHAR" property="patAreaType" />
    <result column="DATE_OF_BIRTH" jdbcType="DATE" property="dateOfBirth" />
    <result column="DEATH_DATE_TIME" jdbcType="DATE" property="deathDateTime" />
    <result column="AGE" jdbcType="VARCHAR" property="age" />
    <result column="NEXT_OF_KIN" jdbcType="VARCHAR" property="nextOfKin" />
    <result column="NEXT_OF_KIN_PHONE" jdbcType="VARCHAR" property="nextOfKinPhone" />
    <result column="CURRENT_ADDR" jdbcType="VARCHAR" property="currentAddr" />
    <result column="CURRENT_ADDR_PROVINCE_CODE" jdbcType="VARCHAR" property="currentAddrProvinceCode" />
    <result column="CURRENT_ADDR_PROVINCE" jdbcType="VARCHAR" property="currentAddrProvince" />
    <result column="CURRENT_ADDR_CITY_CODE" jdbcType="VARCHAR" property="currentAddrCityCode" />
    <result column="CURRENT_ADDR_CITY" jdbcType="VARCHAR" property="currentAddrCity" />
    <result column="CURRENT_ADDR_COUNTY_CODE" jdbcType="VARCHAR" property="currentAddrCountyCode" />
    <result column="CURRENT_ADDR_COUNTY" jdbcType="VARCHAR" property="currentAddrCounty" />
    <result column="CURRENT_ADDR_TOWNSHIP_CODE" jdbcType="VARCHAR" property="currentAddrTownshipCode" />
    <result column="CURRENT_ADDR_TOWNSHIP" jdbcType="VARCHAR" property="currentAddrTownship" />
    <result column="CURRENT_ADDR_VILLAGE" jdbcType="VARCHAR" property="currentAddrVillage" />
    <result column="CURRENT_ADDR_HOUSE_NO" jdbcType="VARCHAR" property="currentAddrHouseNo" />
    <result column="TRANSFER_DESC" jdbcType="VARCHAR" property="transferDesc" />
    <result column="RECEIVE_UNIT" jdbcType="VARCHAR" property="receiveUnit" />
    <result column="RECEIVE_UNIT_PHONE" jdbcType="VARCHAR" property="receiveUnitPhone" />
    <result column="RECEIVE_UNIT_ADDR" jdbcType="VARCHAR" property="receiveUnitAddr" />
    <result column="RECEIVE_CLINIC_TIME" jdbcType="VARCHAR" property="receiveClinicTime" />
    <result column="RECEIVE_DEPT" jdbcType="VARCHAR" property="receiveDept" />
    <result column="REVIEW_STATUS" jdbcType="VARCHAR" property="reviewStatus" />
    <result column="UPLOAD_STATUS" jdbcType="VARCHAR" property="uploadStatus" />
    <result column="OPERATOR" jdbcType="VARCHAR" property="operator" />
    <result column="TRANSFER_TIME" jdbcType="DATE" property="transferTime" />
    <result column="DISTRICT_CODE" jdbcType="VARCHAR" property="districtCode" />
  </resultMap>
  <sql id="Example_Where_Clause">
    <where>
      <foreach collection="oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Update_By_Example_Where_Clause">
    <where>
      <foreach collection="example.oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Base_Column_List">
    TB_TRANSFER_ID, REPORT_ID, PATIENT_ID, REPORT_NO, INP_NO, REPORT_STATUS, NAME, SEX_CODE, 
    UNIT_IN_CONTRACT, UNIT_PHONE, GRADE_CLASS, PAT_AREA_TYPE, DATE_OF_BIRTH, DEATH_DATE_TIME, 
    AGE, NEXT_OF_KIN, NEXT_OF_KIN_PHONE, CURRENT_ADDR, CURRENT_ADDR_PROVINCE_CODE, CURRENT_ADDR_PROVINCE, 
    CURRENT_ADDR_CITY_CODE, CURRENT_ADDR_CITY, CURRENT_ADDR_COUNTY_CODE, CURRENT_ADDR_COUNTY, 
    CURRENT_ADDR_TOWNSHIP_CODE, CURRENT_ADDR_TOWNSHIP, CURRENT_ADDR_VILLAGE, CURRENT_ADDR_HOUSE_NO, 
    TRANSFER_DESC, RECEIVE_UNIT, RECEIVE_UNIT_PHONE, RECEIVE_UNIT_ADDR, RECEIVE_CLINIC_TIME, 
    RECEIVE_DEPT, REVIEW_STATUS, UPLOAD_STATUS, OPERATOR, TRANSFER_TIME, DISTRICT_CODE
  </sql>
  <select id="selectByExample" parameterType="cc.ewell.pyzxyy.dao.entity.ReportPhthisisRecExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from REPORT_PHTHISIS_REC
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from REPORT_PHTHISIS_REC
    where TB_TRANSFER_ID = #{tbTransferId,jdbcType=DECIMAL}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    delete from REPORT_PHTHISIS_REC
    where TB_TRANSFER_ID = #{tbTransferId,jdbcType=DECIMAL}
  </delete>
  <delete id="deleteByExample" parameterType="cc.ewell.pyzxyy.dao.entity.ReportPhthisisRecExample">
    delete from REPORT_PHTHISIS_REC
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="cc.ewell.pyzxyy.dao.entity.ReportPhthisisRec">
    insert into REPORT_PHTHISIS_REC (TB_TRANSFER_ID, REPORT_ID, PATIENT_ID, 
      REPORT_NO, INP_NO, REPORT_STATUS, 
      NAME, SEX_CODE, UNIT_IN_CONTRACT, 
      UNIT_PHONE, GRADE_CLASS, PAT_AREA_TYPE, 
      DATE_OF_BIRTH, DEATH_DATE_TIME, AGE, 
      NEXT_OF_KIN, NEXT_OF_KIN_PHONE, CURRENT_ADDR, 
      CURRENT_ADDR_PROVINCE_CODE, CURRENT_ADDR_PROVINCE, 
      CURRENT_ADDR_CITY_CODE, CURRENT_ADDR_CITY, CURRENT_ADDR_COUNTY_CODE, 
      CURRENT_ADDR_COUNTY, CURRENT_ADDR_TOWNSHIP_CODE, 
      CURRENT_ADDR_TOWNSHIP, CURRENT_ADDR_VILLAGE, 
      CURRENT_ADDR_HOUSE_NO, TRANSFER_DESC, RECEIVE_UNIT, 
      RECEIVE_UNIT_PHONE, RECEIVE_UNIT_ADDR, RECEIVE_CLINIC_TIME, 
      RECEIVE_DEPT, REVIEW_STATUS, UPLOAD_STATUS, 
      OPERATOR, TRANSFER_TIME, DISTRICT_CODE
      )
    values (#{tbTransferId,jdbcType=DECIMAL}, #{reportId,jdbcType=DECIMAL}, #{patientId,jdbcType=VARCHAR}, 
      #{reportNo,jdbcType=VARCHAR}, #{inpNo,jdbcType=VARCHAR}, #{reportStatus,jdbcType=VARCHAR}, 
      #{name,jdbcType=VARCHAR}, #{sexCode,jdbcType=VARCHAR}, #{unitInContract,jdbcType=VARCHAR}, 
      #{unitPhone,jdbcType=VARCHAR}, #{gradeClass,jdbcType=VARCHAR}, #{patAreaType,jdbcType=VARCHAR}, 
      #{dateOfBirth,jdbcType=DATE}, #{deathDateTime,jdbcType=DATE}, #{age,jdbcType=VARCHAR}, 
      #{nextOfKin,jdbcType=VARCHAR}, #{nextOfKinPhone,jdbcType=VARCHAR}, #{currentAddr,jdbcType=VARCHAR}, 
      #{currentAddrProvinceCode,jdbcType=VARCHAR}, #{currentAddrProvince,jdbcType=VARCHAR}, 
      #{currentAddrCityCode,jdbcType=VARCHAR}, #{currentAddrCity,jdbcType=VARCHAR}, #{currentAddrCountyCode,jdbcType=VARCHAR}, 
      #{currentAddrCounty,jdbcType=VARCHAR}, #{currentAddrTownshipCode,jdbcType=VARCHAR}, 
      #{currentAddrTownship,jdbcType=VARCHAR}, #{currentAddrVillage,jdbcType=VARCHAR}, 
      #{currentAddrHouseNo,jdbcType=VARCHAR}, #{transferDesc,jdbcType=VARCHAR}, #{receiveUnit,jdbcType=VARCHAR}, 
      #{receiveUnitPhone,jdbcType=VARCHAR}, #{receiveUnitAddr,jdbcType=VARCHAR}, #{receiveClinicTime,jdbcType=VARCHAR}, 
      #{receiveDept,jdbcType=VARCHAR}, #{reviewStatus,jdbcType=VARCHAR}, #{uploadStatus,jdbcType=VARCHAR}, 
      #{operator,jdbcType=VARCHAR}, #{transferTime,jdbcType=DATE}, #{districtCode,jdbcType=VARCHAR}
      )
  </insert>
  <insert id="insertSelective" parameterType="cc.ewell.pyzxyy.dao.entity.ReportPhthisisRec">
    insert into REPORT_PHTHISIS_REC
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="tbTransferId != null">
        TB_TRANSFER_ID,
      </if>
      <if test="reportId != null">
        REPORT_ID,
      </if>
      <if test="patientId != null">
        PATIENT_ID,
      </if>
      <if test="reportNo != null">
        REPORT_NO,
      </if>
      <if test="inpNo != null">
        INP_NO,
      </if>
      <if test="reportStatus != null">
        REPORT_STATUS,
      </if>
      <if test="name != null">
        NAME,
      </if>
      <if test="sexCode != null">
        SEX_CODE,
      </if>
      <if test="unitInContract != null">
        UNIT_IN_CONTRACT,
      </if>
      <if test="unitPhone != null">
        UNIT_PHONE,
      </if>
      <if test="gradeClass != null">
        GRADE_CLASS,
      </if>
      <if test="patAreaType != null">
        PAT_AREA_TYPE,
      </if>
      <if test="dateOfBirth != null">
        DATE_OF_BIRTH,
      </if>
      <if test="deathDateTime != null">
        DEATH_DATE_TIME,
      </if>
      <if test="age != null">
        AGE,
      </if>
      <if test="nextOfKin != null">
        NEXT_OF_KIN,
      </if>
      <if test="nextOfKinPhone != null">
        NEXT_OF_KIN_PHONE,
      </if>
      <if test="currentAddr != null">
        CURRENT_ADDR,
      </if>
      <if test="currentAddrProvinceCode != null">
        CURRENT_ADDR_PROVINCE_CODE,
      </if>
      <if test="currentAddrProvince != null">
        CURRENT_ADDR_PROVINCE,
      </if>
      <if test="currentAddrCityCode != null">
        CURRENT_ADDR_CITY_CODE,
      </if>
      <if test="currentAddrCity != null">
        CURRENT_ADDR_CITY,
      </if>
      <if test="currentAddrCountyCode != null">
        CURRENT_ADDR_COUNTY_CODE,
      </if>
      <if test="currentAddrCounty != null">
        CURRENT_ADDR_COUNTY,
      </if>
      <if test="currentAddrTownshipCode != null">
        CURRENT_ADDR_TOWNSHIP_CODE,
      </if>
      <if test="currentAddrTownship != null">
        CURRENT_ADDR_TOWNSHIP,
      </if>
      <if test="currentAddrVillage != null">
        CURRENT_ADDR_VILLAGE,
      </if>
      <if test="currentAddrHouseNo != null">
        CURRENT_ADDR_HOUSE_NO,
      </if>
      <if test="transferDesc != null">
        TRANSFER_DESC,
      </if>
      <if test="receiveUnit != null">
        RECEIVE_UNIT,
      </if>
      <if test="receiveUnitPhone != null">
        RECEIVE_UNIT_PHONE,
      </if>
      <if test="receiveUnitAddr != null">
        RECEIVE_UNIT_ADDR,
      </if>
      <if test="receiveClinicTime != null">
        RECEIVE_CLINIC_TIME,
      </if>
      <if test="receiveDept != null">
        RECEIVE_DEPT,
      </if>
      <if test="reviewStatus != null">
        REVIEW_STATUS,
      </if>
      <if test="uploadStatus != null">
        UPLOAD_STATUS,
      </if>
      <if test="operator != null">
        OPERATOR,
      </if>
      <if test="transferTime != null">
        TRANSFER_TIME,
      </if>
      <if test="districtCode != null">
        DISTRICT_CODE,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="tbTransferId != null">
        #{tbTransferId,jdbcType=DECIMAL},
      </if>
      <if test="reportId != null">
        #{reportId,jdbcType=DECIMAL},
      </if>
      <if test="patientId != null">
        #{patientId,jdbcType=VARCHAR},
      </if>
      <if test="reportNo != null">
        #{reportNo,jdbcType=VARCHAR},
      </if>
      <if test="inpNo != null">
        #{inpNo,jdbcType=VARCHAR},
      </if>
      <if test="reportStatus != null">
        #{reportStatus,jdbcType=VARCHAR},
      </if>
      <if test="name != null">
        #{name,jdbcType=VARCHAR},
      </if>
      <if test="sexCode != null">
        #{sexCode,jdbcType=VARCHAR},
      </if>
      <if test="unitInContract != null">
        #{unitInContract,jdbcType=VARCHAR},
      </if>
      <if test="unitPhone != null">
        #{unitPhone,jdbcType=VARCHAR},
      </if>
      <if test="gradeClass != null">
        #{gradeClass,jdbcType=VARCHAR},
      </if>
      <if test="patAreaType != null">
        #{patAreaType,jdbcType=VARCHAR},
      </if>
      <if test="dateOfBirth != null">
        #{dateOfBirth,jdbcType=DATE},
      </if>
      <if test="deathDateTime != null">
        #{deathDateTime,jdbcType=DATE},
      </if>
      <if test="age != null">
        #{age,jdbcType=VARCHAR},
      </if>
      <if test="nextOfKin != null">
        #{nextOfKin,jdbcType=VARCHAR},
      </if>
      <if test="nextOfKinPhone != null">
        #{nextOfKinPhone,jdbcType=VARCHAR},
      </if>
      <if test="currentAddr != null">
        #{currentAddr,jdbcType=VARCHAR},
      </if>
      <if test="currentAddrProvinceCode != null">
        #{currentAddrProvinceCode,jdbcType=VARCHAR},
      </if>
      <if test="currentAddrProvince != null">
        #{currentAddrProvince,jdbcType=VARCHAR},
      </if>
      <if test="currentAddrCityCode != null">
        #{currentAddrCityCode,jdbcType=VARCHAR},
      </if>
      <if test="currentAddrCity != null">
        #{currentAddrCity,jdbcType=VARCHAR},
      </if>
      <if test="currentAddrCountyCode != null">
        #{currentAddrCountyCode,jdbcType=VARCHAR},
      </if>
      <if test="currentAddrCounty != null">
        #{currentAddrCounty,jdbcType=VARCHAR},
      </if>
      <if test="currentAddrTownshipCode != null">
        #{currentAddrTownshipCode,jdbcType=VARCHAR},
      </if>
      <if test="currentAddrTownship != null">
        #{currentAddrTownship,jdbcType=VARCHAR},
      </if>
      <if test="currentAddrVillage != null">
        #{currentAddrVillage,jdbcType=VARCHAR},
      </if>
      <if test="currentAddrHouseNo != null">
        #{currentAddrHouseNo,jdbcType=VARCHAR},
      </if>
      <if test="transferDesc != null">
        #{transferDesc,jdbcType=VARCHAR},
      </if>
      <if test="receiveUnit != null">
        #{receiveUnit,jdbcType=VARCHAR},
      </if>
      <if test="receiveUnitPhone != null">
        #{receiveUnitPhone,jdbcType=VARCHAR},
      </if>
      <if test="receiveUnitAddr != null">
        #{receiveUnitAddr,jdbcType=VARCHAR},
      </if>
      <if test="receiveClinicTime != null">
        #{receiveClinicTime,jdbcType=VARCHAR},
      </if>
      <if test="receiveDept != null">
        #{receiveDept,jdbcType=VARCHAR},
      </if>
      <if test="reviewStatus != null">
        #{reviewStatus,jdbcType=VARCHAR},
      </if>
      <if test="uploadStatus != null">
        #{uploadStatus,jdbcType=VARCHAR},
      </if>
      <if test="operator != null">
        #{operator,jdbcType=VARCHAR},
      </if>
      <if test="transferTime != null">
        #{transferTime,jdbcType=DATE},
      </if>
      <if test="districtCode != null">
        #{districtCode,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="cc.ewell.pyzxyy.dao.entity.ReportPhthisisRecExample" resultType="java.lang.Long">
    select count(*) from REPORT_PHTHISIS_REC
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update REPORT_PHTHISIS_REC
    <set>
      <if test="record.tbTransferId != null">
        TB_TRANSFER_ID = #{record.tbTransferId,jdbcType=DECIMAL},
      </if>
      <if test="record.reportId != null">
        REPORT_ID = #{record.reportId,jdbcType=DECIMAL},
      </if>
      <if test="record.patientId != null">
        PATIENT_ID = #{record.patientId,jdbcType=VARCHAR},
      </if>
      <if test="record.reportNo != null">
        REPORT_NO = #{record.reportNo,jdbcType=VARCHAR},
      </if>
      <if test="record.inpNo != null">
        INP_NO = #{record.inpNo,jdbcType=VARCHAR},
      </if>
      <if test="record.reportStatus != null">
        REPORT_STATUS = #{record.reportStatus,jdbcType=VARCHAR},
      </if>
      <if test="record.name != null">
        NAME = #{record.name,jdbcType=VARCHAR},
      </if>
      <if test="record.sexCode != null">
        SEX_CODE = #{record.sexCode,jdbcType=VARCHAR},
      </if>
      <if test="record.unitInContract != null">
        UNIT_IN_CONTRACT = #{record.unitInContract,jdbcType=VARCHAR},
      </if>
      <if test="record.unitPhone != null">
        UNIT_PHONE = #{record.unitPhone,jdbcType=VARCHAR},
      </if>
      <if test="record.gradeClass != null">
        GRADE_CLASS = #{record.gradeClass,jdbcType=VARCHAR},
      </if>
      <if test="record.patAreaType != null">
        PAT_AREA_TYPE = #{record.patAreaType,jdbcType=VARCHAR},
      </if>
      <if test="record.dateOfBirth != null">
        DATE_OF_BIRTH = #{record.dateOfBirth,jdbcType=DATE},
      </if>
      <if test="record.deathDateTime != null">
        DEATH_DATE_TIME = #{record.deathDateTime,jdbcType=DATE},
      </if>
      <if test="record.age != null">
        AGE = #{record.age,jdbcType=VARCHAR},
      </if>
      <if test="record.nextOfKin != null">
        NEXT_OF_KIN = #{record.nextOfKin,jdbcType=VARCHAR},
      </if>
      <if test="record.nextOfKinPhone != null">
        NEXT_OF_KIN_PHONE = #{record.nextOfKinPhone,jdbcType=VARCHAR},
      </if>
      <if test="record.currentAddr != null">
        CURRENT_ADDR = #{record.currentAddr,jdbcType=VARCHAR},
      </if>
      <if test="record.currentAddrProvinceCode != null">
        CURRENT_ADDR_PROVINCE_CODE = #{record.currentAddrProvinceCode,jdbcType=VARCHAR},
      </if>
      <if test="record.currentAddrProvince != null">
        CURRENT_ADDR_PROVINCE = #{record.currentAddrProvince,jdbcType=VARCHAR},
      </if>
      <if test="record.currentAddrCityCode != null">
        CURRENT_ADDR_CITY_CODE = #{record.currentAddrCityCode,jdbcType=VARCHAR},
      </if>
      <if test="record.currentAddrCity != null">
        CURRENT_ADDR_CITY = #{record.currentAddrCity,jdbcType=VARCHAR},
      </if>
      <if test="record.currentAddrCountyCode != null">
        CURRENT_ADDR_COUNTY_CODE = #{record.currentAddrCountyCode,jdbcType=VARCHAR},
      </if>
      <if test="record.currentAddrCounty != null">
        CURRENT_ADDR_COUNTY = #{record.currentAddrCounty,jdbcType=VARCHAR},
      </if>
      <if test="record.currentAddrTownshipCode != null">
        CURRENT_ADDR_TOWNSHIP_CODE = #{record.currentAddrTownshipCode,jdbcType=VARCHAR},
      </if>
      <if test="record.currentAddrTownship != null">
        CURRENT_ADDR_TOWNSHIP = #{record.currentAddrTownship,jdbcType=VARCHAR},
      </if>
      <if test="record.currentAddrVillage != null">
        CURRENT_ADDR_VILLAGE = #{record.currentAddrVillage,jdbcType=VARCHAR},
      </if>
      <if test="record.currentAddrHouseNo != null">
        CURRENT_ADDR_HOUSE_NO = #{record.currentAddrHouseNo,jdbcType=VARCHAR},
      </if>
      <if test="record.transferDesc != null">
        TRANSFER_DESC = #{record.transferDesc,jdbcType=VARCHAR},
      </if>
      <if test="record.receiveUnit != null">
        RECEIVE_UNIT = #{record.receiveUnit,jdbcType=VARCHAR},
      </if>
      <if test="record.receiveUnitPhone != null">
        RECEIVE_UNIT_PHONE = #{record.receiveUnitPhone,jdbcType=VARCHAR},
      </if>
      <if test="record.receiveUnitAddr != null">
        RECEIVE_UNIT_ADDR = #{record.receiveUnitAddr,jdbcType=VARCHAR},
      </if>
      <if test="record.receiveClinicTime != null">
        RECEIVE_CLINIC_TIME = #{record.receiveClinicTime,jdbcType=VARCHAR},
      </if>
      <if test="record.receiveDept != null">
        RECEIVE_DEPT = #{record.receiveDept,jdbcType=VARCHAR},
      </if>
      <if test="record.reviewStatus != null">
        REVIEW_STATUS = #{record.reviewStatus,jdbcType=VARCHAR},
      </if>
      <if test="record.uploadStatus != null">
        UPLOAD_STATUS = #{record.uploadStatus,jdbcType=VARCHAR},
      </if>
      <if test="record.operator != null">
        OPERATOR = #{record.operator,jdbcType=VARCHAR},
      </if>
      <if test="record.transferTime != null">
        TRANSFER_TIME = #{record.transferTime,jdbcType=DATE},
      </if>
      <if test="record.districtCode != null">
        DISTRICT_CODE = #{record.districtCode,jdbcType=VARCHAR},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update REPORT_PHTHISIS_REC
    set TB_TRANSFER_ID = #{record.tbTransferId,jdbcType=DECIMAL},
      REPORT_ID = #{record.reportId,jdbcType=DECIMAL},
      PATIENT_ID = #{record.patientId,jdbcType=VARCHAR},
      REPORT_NO = #{record.reportNo,jdbcType=VARCHAR},
      INP_NO = #{record.inpNo,jdbcType=VARCHAR},
      REPORT_STATUS = #{record.reportStatus,jdbcType=VARCHAR},
      NAME = #{record.name,jdbcType=VARCHAR},
      SEX_CODE = #{record.sexCode,jdbcType=VARCHAR},
      UNIT_IN_CONTRACT = #{record.unitInContract,jdbcType=VARCHAR},
      UNIT_PHONE = #{record.unitPhone,jdbcType=VARCHAR},
      GRADE_CLASS = #{record.gradeClass,jdbcType=VARCHAR},
      PAT_AREA_TYPE = #{record.patAreaType,jdbcType=VARCHAR},
      DATE_OF_BIRTH = #{record.dateOfBirth,jdbcType=DATE},
      DEATH_DATE_TIME = #{record.deathDateTime,jdbcType=DATE},
      AGE = #{record.age,jdbcType=VARCHAR},
      NEXT_OF_KIN = #{record.nextOfKin,jdbcType=VARCHAR},
      NEXT_OF_KIN_PHONE = #{record.nextOfKinPhone,jdbcType=VARCHAR},
      CURRENT_ADDR = #{record.currentAddr,jdbcType=VARCHAR},
      CURRENT_ADDR_PROVINCE_CODE = #{record.currentAddrProvinceCode,jdbcType=VARCHAR},
      CURRENT_ADDR_PROVINCE = #{record.currentAddrProvince,jdbcType=VARCHAR},
      CURRENT_ADDR_CITY_CODE = #{record.currentAddrCityCode,jdbcType=VARCHAR},
      CURRENT_ADDR_CITY = #{record.currentAddrCity,jdbcType=VARCHAR},
      CURRENT_ADDR_COUNTY_CODE = #{record.currentAddrCountyCode,jdbcType=VARCHAR},
      CURRENT_ADDR_COUNTY = #{record.currentAddrCounty,jdbcType=VARCHAR},
      CURRENT_ADDR_TOWNSHIP_CODE = #{record.currentAddrTownshipCode,jdbcType=VARCHAR},
      CURRENT_ADDR_TOWNSHIP = #{record.currentAddrTownship,jdbcType=VARCHAR},
      CURRENT_ADDR_VILLAGE = #{record.currentAddrVillage,jdbcType=VARCHAR},
      CURRENT_ADDR_HOUSE_NO = #{record.currentAddrHouseNo,jdbcType=VARCHAR},
      TRANSFER_DESC = #{record.transferDesc,jdbcType=VARCHAR},
      RECEIVE_UNIT = #{record.receiveUnit,jdbcType=VARCHAR},
      RECEIVE_UNIT_PHONE = #{record.receiveUnitPhone,jdbcType=VARCHAR},
      RECEIVE_UNIT_ADDR = #{record.receiveUnitAddr,jdbcType=VARCHAR},
      RECEIVE_CLINIC_TIME = #{record.receiveClinicTime,jdbcType=VARCHAR},
      RECEIVE_DEPT = #{record.receiveDept,jdbcType=VARCHAR},
      REVIEW_STATUS = #{record.reviewStatus,jdbcType=VARCHAR},
      UPLOAD_STATUS = #{record.uploadStatus,jdbcType=VARCHAR},
      OPERATOR = #{record.operator,jdbcType=VARCHAR},
      TRANSFER_TIME = #{record.transferTime,jdbcType=DATE},
      DISTRICT_CODE = #{record.districtCode,jdbcType=VARCHAR}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="cc.ewell.pyzxyy.dao.entity.ReportPhthisisRec">
    update REPORT_PHTHISIS_REC
    <set>
      <if test="reportId != null">
        REPORT_ID = #{reportId,jdbcType=DECIMAL},
      </if>
      <if test="patientId != null">
        PATIENT_ID = #{patientId,jdbcType=VARCHAR},
      </if>
      <if test="reportNo != null">
        REPORT_NO = #{reportNo,jdbcType=VARCHAR},
      </if>
      <if test="inpNo != null">
        INP_NO = #{inpNo,jdbcType=VARCHAR},
      </if>
      <if test="reportStatus != null">
        REPORT_STATUS = #{reportStatus,jdbcType=VARCHAR},
      </if>
      <if test="name != null">
        NAME = #{name,jdbcType=VARCHAR},
      </if>
      <if test="sexCode != null">
        SEX_CODE = #{sexCode,jdbcType=VARCHAR},
      </if>
      <if test="unitInContract != null">
        UNIT_IN_CONTRACT = #{unitInContract,jdbcType=VARCHAR},
      </if>
      <if test="unitPhone != null">
        UNIT_PHONE = #{unitPhone,jdbcType=VARCHAR},
      </if>
      <if test="gradeClass != null">
        GRADE_CLASS = #{gradeClass,jdbcType=VARCHAR},
      </if>
      <if test="patAreaType != null">
        PAT_AREA_TYPE = #{patAreaType,jdbcType=VARCHAR},
      </if>
      <if test="dateOfBirth != null">
        DATE_OF_BIRTH = #{dateOfBirth,jdbcType=DATE},
      </if>
      <if test="deathDateTime != null">
        DEATH_DATE_TIME = #{deathDateTime,jdbcType=DATE},
      </if>
      <if test="age != null">
        AGE = #{age,jdbcType=VARCHAR},
      </if>
      <if test="nextOfKin != null">
        NEXT_OF_KIN = #{nextOfKin,jdbcType=VARCHAR},
      </if>
      <if test="nextOfKinPhone != null">
        NEXT_OF_KIN_PHONE = #{nextOfKinPhone,jdbcType=VARCHAR},
      </if>
      <if test="currentAddr != null">
        CURRENT_ADDR = #{currentAddr,jdbcType=VARCHAR},
      </if>
      <if test="currentAddrProvinceCode != null">
        CURRENT_ADDR_PROVINCE_CODE = #{currentAddrProvinceCode,jdbcType=VARCHAR},
      </if>
      <if test="currentAddrProvince != null">
        CURRENT_ADDR_PROVINCE = #{currentAddrProvince,jdbcType=VARCHAR},
      </if>
      <if test="currentAddrCityCode != null">
        CURRENT_ADDR_CITY_CODE = #{currentAddrCityCode,jdbcType=VARCHAR},
      </if>
      <if test="currentAddrCity != null">
        CURRENT_ADDR_CITY = #{currentAddrCity,jdbcType=VARCHAR},
      </if>
      <if test="currentAddrCountyCode != null">
        CURRENT_ADDR_COUNTY_CODE = #{currentAddrCountyCode,jdbcType=VARCHAR},
      </if>
      <if test="currentAddrCounty != null">
        CURRENT_ADDR_COUNTY = #{currentAddrCounty,jdbcType=VARCHAR},
      </if>
      <if test="currentAddrTownshipCode != null">
        CURRENT_ADDR_TOWNSHIP_CODE = #{currentAddrTownshipCode,jdbcType=VARCHAR},
      </if>
      <if test="currentAddrTownship != null">
        CURRENT_ADDR_TOWNSHIP = #{currentAddrTownship,jdbcType=VARCHAR},
      </if>
      <if test="currentAddrVillage != null">
        CURRENT_ADDR_VILLAGE = #{currentAddrVillage,jdbcType=VARCHAR},
      </if>
      <if test="currentAddrHouseNo != null">
        CURRENT_ADDR_HOUSE_NO = #{currentAddrHouseNo,jdbcType=VARCHAR},
      </if>
      <if test="transferDesc != null">
        TRANSFER_DESC = #{transferDesc,jdbcType=VARCHAR},
      </if>
      <if test="receiveUnit != null">
        RECEIVE_UNIT = #{receiveUnit,jdbcType=VARCHAR},
      </if>
      <if test="receiveUnitPhone != null">
        RECEIVE_UNIT_PHONE = #{receiveUnitPhone,jdbcType=VARCHAR},
      </if>
      <if test="receiveUnitAddr != null">
        RECEIVE_UNIT_ADDR = #{receiveUnitAddr,jdbcType=VARCHAR},
      </if>
      <if test="receiveClinicTime != null">
        RECEIVE_CLINIC_TIME = #{receiveClinicTime,jdbcType=VARCHAR},
      </if>
      <if test="receiveDept != null">
        RECEIVE_DEPT = #{receiveDept,jdbcType=VARCHAR},
      </if>
      <if test="reviewStatus != null">
        REVIEW_STATUS = #{reviewStatus,jdbcType=VARCHAR},
      </if>
      <if test="uploadStatus != null">
        UPLOAD_STATUS = #{uploadStatus,jdbcType=VARCHAR},
      </if>
      <if test="operator != null">
        OPERATOR = #{operator,jdbcType=VARCHAR},
      </if>
      <if test="transferTime != null">
        TRANSFER_TIME = #{transferTime,jdbcType=DATE},
      </if>
      <if test="districtCode != null">
        DISTRICT_CODE = #{districtCode,jdbcType=VARCHAR},
      </if>
    </set>
    where TB_TRANSFER_ID = #{tbTransferId,jdbcType=DECIMAL}
  </update>
  <update id="updateByPrimaryKey" parameterType="cc.ewell.pyzxyy.dao.entity.ReportPhthisisRec">
    update REPORT_PHTHISIS_REC
    set REPORT_ID = #{reportId,jdbcType=DECIMAL},
      PATIENT_ID = #{patientId,jdbcType=VARCHAR},
      REPORT_NO = #{reportNo,jdbcType=VARCHAR},
      INP_NO = #{inpNo,jdbcType=VARCHAR},
      REPORT_STATUS = #{reportStatus,jdbcType=VARCHAR},
      NAME = #{name,jdbcType=VARCHAR},
      SEX_CODE = #{sexCode,jdbcType=VARCHAR},
      UNIT_IN_CONTRACT = #{unitInContract,jdbcType=VARCHAR},
      UNIT_PHONE = #{unitPhone,jdbcType=VARCHAR},
      GRADE_CLASS = #{gradeClass,jdbcType=VARCHAR},
      PAT_AREA_TYPE = #{patAreaType,jdbcType=VARCHAR},
      DATE_OF_BIRTH = #{dateOfBirth,jdbcType=DATE},
      DEATH_DATE_TIME = #{deathDateTime,jdbcType=DATE},
      AGE = #{age,jdbcType=VARCHAR},
      NEXT_OF_KIN = #{nextOfKin,jdbcType=VARCHAR},
      NEXT_OF_KIN_PHONE = #{nextOfKinPhone,jdbcType=VARCHAR},
      CURRENT_ADDR = #{currentAddr,jdbcType=VARCHAR},
      CURRENT_ADDR_PROVINCE_CODE = #{currentAddrProvinceCode,jdbcType=VARCHAR},
      CURRENT_ADDR_PROVINCE = #{currentAddrProvince,jdbcType=VARCHAR},
      CURRENT_ADDR_CITY_CODE = #{currentAddrCityCode,jdbcType=VARCHAR},
      CURRENT_ADDR_CITY = #{currentAddrCity,jdbcType=VARCHAR},
      CURRENT_ADDR_COUNTY_CODE = #{currentAddrCountyCode,jdbcType=VARCHAR},
      CURRENT_ADDR_COUNTY = #{currentAddrCounty,jdbcType=VARCHAR},
      CURRENT_ADDR_TOWNSHIP_CODE = #{currentAddrTownshipCode,jdbcType=VARCHAR},
      CURRENT_ADDR_TOWNSHIP = #{currentAddrTownship,jdbcType=VARCHAR},
      CURRENT_ADDR_VILLAGE = #{currentAddrVillage,jdbcType=VARCHAR},
      CURRENT_ADDR_HOUSE_NO = #{currentAddrHouseNo,jdbcType=VARCHAR},
      TRANSFER_DESC = #{transferDesc,jdbcType=VARCHAR},
      RECEIVE_UNIT = #{receiveUnit,jdbcType=VARCHAR},
      RECEIVE_UNIT_PHONE = #{receiveUnitPhone,jdbcType=VARCHAR},
      RECEIVE_UNIT_ADDR = #{receiveUnitAddr,jdbcType=VARCHAR},
      RECEIVE_CLINIC_TIME = #{receiveClinicTime,jdbcType=VARCHAR},
      RECEIVE_DEPT = #{receiveDept,jdbcType=VARCHAR},
      REVIEW_STATUS = #{reviewStatus,jdbcType=VARCHAR},
      UPLOAD_STATUS = #{uploadStatus,jdbcType=VARCHAR},
      OPERATOR = #{operator,jdbcType=VARCHAR},
      TRANSFER_TIME = #{transferTime,jdbcType=DATE},
      DISTRICT_CODE = #{districtCode,jdbcType=VARCHAR}
    where TB_TRANSFER_ID = #{tbTransferId,jdbcType=DECIMAL}
  </update>
</mapper>

Mapper.java


public interface ReportPhthisisRecMapper {
    long countByExample(ReportPhthisisRecExample example);

    int deleteByExample(ReportPhthisisRecExample example);

    int deleteByPrimaryKey(Long tbTransferId);

    int insert(ReportPhthisisRec record);

    int insertSelective(ReportPhthisisRec record);

    List<ReportPhthisisRec> selectByExample(ReportPhthisisRecExample example);

    ReportPhthisisRec selectByPrimaryKey(Long tbTransferId);

    int updateByExampleSelective(@Param("record") ReportPhthisisRec record, @Param("example") ReportPhthisisRecExample example);

    int updateByExample(@Param("record") ReportPhthisisRec record, @Param("example") ReportPhthisisRecExample example);

    int updateByPrimaryKeySelective(ReportPhthisisRec record);

    int updateByPrimaryKey(ReportPhthisisRec record);
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值