1 spring整合Mybatis

1.1 spring配置文件整合Mybatis

image.png

1.2 spring注解方式整合mybatis

image.png

2 Mybatis中的sql语句语法

2.1 修改语句set

用于维护update 语句中的 set 子句,功能如下:
a) 满足条件时, 会自动添加 set 关键字
b) 会去除set 子句中多余的逗号
c) 不满足条件时, 不会生成 set 关键字

  1. <!--编辑-->
  2. <update id="edit" parameterType="com.itheima.pojo.CheckItem">
  3. update t_checkitem
  4. <set>
  5. <if test="name != null">
  6. name = #{name},
  7. </if>
  8. <if test="sex != null">
  9. sex = #{sex},
  10. </if>
  11. <if test="code != null">
  12. code = #{code},
  13. </if>
  14. <if test="age != null">
  15. age = #{age},
  16. </if>
  17. <if test="price != null">
  18. price = #{price},
  19. </if>
  20. <if test="type != null">
  21. type = #{type},
  22. </if>
  23. <if test="attention != null">
  24. attention = #{attention},
  25. </if>
  26. <if test="remark != null">
  27. remark = #{remark},
  28. </if>
  29. </set>
  30. where id = #{id}
  31. </update>

2.2 查询的关键字value

  1. <!--分页查询-->
  2. <select id="selectByCondition" parameterType="string" resultType="checkItem">
  3. select * from t_checkitem
  4. <if test="value !=null and value.length>0">
  5. where code=#{value} or name=#{value}
  6. </if>
  7. </select>

value可以任意取名吗?取名为queryString时,报错
image.png
百度发现以下方法(未验证是否正确):
image.png

2.3 resultType与resultMap的区别

image.png
resultType:
当往实体中封装查询数据时,如果能一次封装成功,实体类中没有其他的实体引用,使用resultType
resultMap:
当往实体中封装查询数据时,如果不能一次封装成功,实体类中有其他的实体引用,使用resultMap

2.4 注解@Param

在执行查询语句时,如果需要根据两个及以上的参数条件进行查询,记得配置@Param,否则无法识别
image.png
image.png

2.5 新增获取数据库中自增的ID

方法一:

//

  1. <!--新增套餐-->
  2. <insert id="add" parameterType="Setmeal">
  3. <selectKey resultType="int" order="AFTER" keyProperty="id">
  4. select LAST_INSERT_ID()
  5. </selectKey>
  6. insert into t_setmeal(code,name,sex,helpCode,remark,attention,age,price,img) values
  7. (#{code},#{name},#{sex},#{helpCode},#{remark},#{attention},#{age},#{price},#{img})
  8. </insert>

说明:在sql新增语句执行之后,去获取新增数据的自增ID,查到ID以后,将ID作为返回值,然后把这个返回值给到parameterType对象中一个叫做id的属性赋值。
image.png

方法二:
image.png

2.6 parameterType类型为map的应用场景

如何在多对多表关系下,将关联信息保存到第三张表(t_checkgroup_checkitem)
需要用到map集合 来存放每一条数据。
image.png
sevice实现层
image.png
Dao层
image.png
Dao.xml

  1. <!--设置检查组和检查项的关联关系-->
  2. <insert id="setCheckGroupAndCheckItem" parameterType="hashmap">
  3. insert into t_checkgroup_checkitem(checkgroup_id,checkitem_id)
  4. values (#{checkgroup_id},#{checkitem_id})
  5. </insert>

2.7 模糊查询

https://blog.csdn.net/zhenwei1994/article/details/81876278

2.8 大于号和小于号的使用

使用< >等符号时需要进行转义
image.png

3. Mybatis多表操作

image.png

3.1 MyBatis接口代理方式实现多表查询操作方式

  • 一对一
  • 一对多
  • 多对多

MyBatisConfig.xml

  1. <mappers>
  2. <mapper resource="QueryTable.xml"></mapper>
  3. </mappers>

QueryTable.xml

  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.itheima.mapper.ManyTable">
  6. <!--一对一关系的数据表操作-->
  7. <!--配置字段和实体对象属性的映射关系-->
  8. <resultMap id="OneToOne" type="card">
  9. <result column="cid" property="id"></result>
  10. <result column="number" property="number"></result>
  11. <!--与card实体类进行对应 private Person p;-->
  12. <association property="p" javaType="Person">
  13. <result column="pid" property="id"></result>
  14. <result column="name" property="name"></result>
  15. <result column="age" property="age"></result>
  16. </association>
  17. </resultMap>
  18. <select id="OnetoOne" resultMap="OneToOne">
  19. SELECT p.id pid,NAME,age,c.id cid,number FROM person p,card c WHERE p.id=c.pid;
  20. </select>
  21. <!--一对多关系的数据表操作-->
  22. <resultMap id="OneToMany" type="Classes">
  23. <result column="cid" property="id"></result>
  24. <result column="cname" property="name"></result>
  25. <!--与实体类Classes中的属性对应 private List<Student> students;-->
  26. <collection property="students" ofType="Student">
  27. <result column="sid" property="id"></result>
  28. <result column="sname" property="name"></result>
  29. <result column="age" property="age"></result>
  30. </collection>
  31. </resultMap>
  32. <select id="OneToMany" resultMap="OneToMany">
  33. SELECT cid,c.name cname,s.id sid,s.name sname,age FROM classes c,student s WHERE s.cid=c.id
  34. </select>
  35. <!--多对多关系的数据表操作-->
  36. <resultMap id="ManyToMany" type="Student">
  37. <result column="sid" property="id"></result>
  38. <result column="sname" property="name"></result>
  39. <result column="age" property="age"></result>
  40. <collection property="courses" ofType="Course">
  41. <result column="cid" property="id"></result>
  42. <result column="cname" property="name"></result>
  43. </collection>
  44. </resultMap>
  45. <select id="ManyToMany" resultMap="ManyToMany">
  46. SELECT s.id sid,s.name sname,age,c.id cid,c.name cname FROM student s,stu_cr sc,course c WHERE s.id=sc.sid AND c.id=sc.cid;
  47. </select>
  48. </mapper>

mapper.ManyTable

  1. public interface ManyTable {
  2. public abstract List<Card> OnetoOne();
  3. public abstract List<Classes> OneToMany();
  4. public abstract List<Student> ManyToMany();
  5. }

3.2 MyBatis注解方式实现多表操作

  • 注解只能一个一个数据表进行查询,不能直接通过内连接语句进行查询
  • 如果是多表查询时,给定的别名也要跟实体类中属性名一一对应
  1. @Select("SELECT c.id id,c.name name FROM course c,stu_cr sc WHERE c.id=sc.cid and sc.sid=#{id}")
  2. List<Course> selectCourseById(Integer id);

MyBatisConfig.xml

  1. <mappers>
  2. <!--<mapper resource="QueryTable.xml"></mapper>-->
  3. <package name="com.itheima.mapper"></package>
  4. </mappers>

mapper.``QueryMapper

  1. public interface QueryMapper {
  2. // 一对一写法
  3. @Select("select * from card")
  4. @Results({
  5. @Result(column = "id", property = "id"),
  6. @Result(column = "number", property = "number"),
  7. @Result(
  8. property = "p", // 被包含对象的变量名
  9. javaType = Person.class, // 被包含对象的实际数据类型
  10. column = "pid",// 根据查询出的card表中的pid字段来查询person表
  11. /*
  12. one、@One 一对一固定写法
  13. select属性:指定调用哪个接口中的哪个方法
  14. */
  15. one = @One(select = "com.itheima.mapper.QueryMapper.selectById")
  16. )
  17. })
  18. public abstract List<Card> selectAll();
  19. @Select("select * from person where id=#{id}")
  20. public abstract List<Person> selectById(Integer id);
  21. //一对多写法
  22. @Select("select * from classes")
  23. @Results({
  24. @Result(column = "id", property = "id"),
  25. @Result(column = "name", property = "name"),
  26. @Result(
  27. property = "students",
  28. javaType = List.class,
  29. column = "id",
  30. many = @Many(select = "com.itheima.mapper.QueryMapper.selectStudentById")
  31. )
  32. })
  33. public abstract List<Classes> selectAllClasses();
  34. @Select("select * from student where cid=#{id}")
  35. public abstract List<Student> selectStudentById(Integer id);
  36. //多对多查询
  37. //@Select("select * from student")
  38. @Select("SELECT DISTINCT s.id,s.name,s.age FROM stu_cr sc,student s WHERE sc.sid=s.id;")
  39. @Results({
  40. @Result(column = "id", property = "id"),
  41. @Result(column = "name", property = "name"),
  42. @Result(column = "age",property = "age"),
  43. @Result(
  44. property = "courses",
  45. javaType = List.class,
  46. column = "id",
  47. many=@Many(select = "com.itheima.mapper.QueryMapper.selectCourseById")
  48. )
  49. })
  50. List<Student> selectAllStudent();
  51. @Select("SELECT c.id id,c.name name FROM course c,stu_cr sc WHERE c.id=sc.cid and sc.sid=#{id}")
  52. List<Course> selectCourseById(Integer id);
  53. }

3.3 Mybatis多表查询在项目中的应用

封装套餐详情.png
整个实现过程:
在套餐详情页面需要展示当前套餐的信息(包括图片、套餐名称、套餐介绍、适用性别、适用年龄)、此套餐包含的检查组信息、检查组包含的检查项信息等。
image.png

3.3.1 Dao接口

在SetmealDao接口中提供findById方法

  1. public Setmeal findById(int id);

3.3.2 Mapper映射文件

此处会使用mybatis提供的关联查询,在根据id查询套餐时,同时将此套餐包含的检查组都查询出来,并且将检查组包含的检查项都查询出来。

SetmealDao.xml文件:

  1. <resultMap type="com.itheima.pojo.Setmeal" id="baseResultMap">
  2. <id column="id" property="id"/>
  3. <result column="name" property="name"/>
  4. <result column="code" property="code"/>
  5. <result column="helpCode" property="helpCode"/>
  6. <result column="sex" property="sex"/>
  7. <result column="age" property="age"/>
  8. <result column="price" property="price"/>
  9. <result column="remark" property="remark"/>
  10. <result column="attention" property="attention"/>
  11. <result column="img" property="img"/>
  12. </resultMap>
  13. <resultMap type="com.itheima.pojo.Setmeal"
  14. id="findByIdResultMap"
  15. extends="baseResultMap">
  16. <collection property="checkGroups"
  17. javaType="ArrayList"
  18. ofType="com.itheima.pojo.CheckGroup"
  19. column="id"
  20. select="com.itheima.dao.CheckGroupDao.findCheckGroupById">
  21. </collection>
  22. </resultMap>
  23. <select id="findById" resultMap="findByIdResultMap">
  24. select * from t_setmeal where id=#{id}
  25. </select>

CheckGroupDao.xml文件:

  1. <resultMap type="com.itheima.pojo.CheckGroup" id="baseResultMap">
  2. <id column="id" property="id"/>
  3. <result column="name" property="name"/>
  4. <result column="code" property="code"/>
  5. <result column="helpCode" property="helpCode"/>
  6. <result column="sex" property="sex"/>
  7. <result column="remark" property="remark"/>
  8. <result column="attention" property="attention"/>
  9. </resultMap>
  10. <resultMap type="com.itheima.pojo.CheckGroup"
  11. id="findByIdResultMap"
  12. extends="baseResultMap">
  13. <collection property="checkItems"
  14. javaType="ArrayList"
  15. ofType="com.itheima.pojo.CheckItem"
  16. column="id"
  17. select="com.itheima.dao.CheckItemDao.findCheckItemById">
  18. </collection>
  19. </resultMap>
  20. <!--根据套餐id查询检查项信息-->
  21. <select id="findCheckGroupById" resultMap="findByIdResultMap">
  22. select * from t_checkgroup
  23. where id
  24. in (select checkgroup_id from t_setmeal_checkgroup where setmeal_id=#{id})
  25. </select>

CheckItemDao.xml文件:

  1. <!--根据检查组id查询检查项信息-->
  2. <select id="findCheckItemById" resultType="com.itheima.pojo.CheckItem">
  3. select * from t_checkitem
  4. where id
  5. in (select checkitem_id from t_checkgroup_checkitem where checkgroup_id=#{id})
  6. </select>

4. Mybatis字段名下划线和实体类驼峰命名的属性名如何对应?

image.png
image.png
方法一:在mybatis-config.xml文件里配置

  1. <configuration>
  2. <!-- 全局配置 -->
  3. <settings>
  4. <!--是否开启自动驼峰命名规则(camel case)映射,即从经典数据库列名 A_COLUMN 到经典Java 属性名 aColumn 的类似映射。 -->
  5. <setting name="mapUnderscoreToCamelCase" value="true"/>
  6. </settings>
  7. </configuration>

方法二:
OrderDao.xml中对数据表和实体类进行映射

  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  3. "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
  4. <mapper namespace="com.itheima.dao.OrderDao" >
  5. <resultMap id="baseResultMap" type="com.itheima.pojo.Order">
  6. <id column="id" property="id"/>
  7. <result column="member_id" property="memberId"/>
  8. <result column="orderDate" property="orderDate"/>
  9. <result column="orderType" property="orderType"/>
  10. <result column="orderStatus" property="orderStatus"/>
  11. <result column="setmeal_id" property="setmealId"/>
  12. </resultMap>
  13. <!--动态条件查询-->
  14. <select id="findByCondition" parameterType="com.itheima.pojo.Order" resultMap="baseResultMap">
  15. select * from t_order
  16. <where>
  17. <if test="id != null">
  18. and id = #{id}
  19. </if>
  20. <if test="memberId != null">
  21. and member_id = #{memberId}
  22. </if>
  23. <if test="orderDate != null">
  24. and orderDate = #{orderDate}
  25. </if>
  26. <if test="orderType != null">
  27. and orderType = #{orderType}
  28. </if>
  29. <if test="orderStatus != null">
  30. and orderStatus = #{orderStatus}
  31. </if>
  32. <if test="setmealId != null">
  33. and setmeal_id = #{setmealId}
  34. </if>
  35. </where>
  36. </select>
  37. </mapper>

5.mybatis如何对某些重要字段,比如身份证号实现加解密?

参考链接:https://www.cnblogs.com/lenve/p/10661934.html(将date类型的java字段转换成秒数存到数据库)
https://blog.csdn.net/u012326462/article/details/82709753

实现步骤:

1、自定义 typeHandler 继承 org.apache.ibatis.type.BaseTypeHandler ,重写相关方法【可参考StringTypeHandler类】

  1. package cn.hsa.usc.handler.typehandler;
  2. import cn.hsa.usc.common.SymmetricEncoder;
  3. import cn.hsa.usc.handler.typealias.AESEncrypt;
  4. import org.apache.ibatis.type.BaseTypeHandler;
  5. import org.apache.ibatis.type.JdbcType;
  6. import org.apache.ibatis.type.MappedTypes;
  7. import java.sql.CallableStatement;
  8. import java.sql.PreparedStatement;
  9. import java.sql.ResultSet;
  10. import java.sql.SQLException;
  11. /**
  12. * @ClassName AESEncryptHandler
  13. * @Author weiml
  14. * @Date: 2019/10/2 19:22
  15. * @Version 1.0
  16. **/
  17. @MappedTypes(AESEncrypt.class)//注解用于指明该TypeHandler实现类能够处理的Java 类型的集合
  18. public class AESEncryptHandler extends BaseTypeHandler {
  19. @Override
  20. public void setNonNullParameter(PreparedStatement ps, int i, Object parameter, JdbcType jdbcType)
  21. throws SQLException {
  22. ps.setString(i, SymmetricEncoder.AESEncode((String) parameter));
  23. }
  24. @Override
  25. public String getNullableResult(ResultSet rs, String columnName) throws SQLException {
  26. String columnValue = rs.getString(columnName);
  27. return SymmetricEncoder.AESDncode(columnValue);
  28. }
  29. @Override
  30. public String getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
  31. String columnValue = rs.getString(columnIndex);
  32. return SymmetricEncoder.AESDncode(columnValue);
  33. }
  34. @Override
  35. public String getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
  36. String columnValue = cs.getString(columnIndex);
  37. return SymmetricEncoder.AESDncode(columnValue);
  38. }
  39. public static void main(String[] args) {
  40. System.out.println(SymmetricEncoder.AESEncode("350824199310090415"));
  41. }
  42. }

关于这个类我说如下几点:
1.@MappedJdbcTypes定义的是JdbcType类型,这里的类型不可自己随意定义,必须要是枚举类org.apache.ibatis.type.JdbcType所枚举的数据类型。
2.@MappedTypes定义的是JavaType的数据类型,描述了哪些Java类型可被拦截。
3.在我们启用了我们自定义的这个TypeHandler之后,数据的读写都会被这个类所过滤
4.在setNonNullParameter方法中,我们重新定义要写往数据库的数据。
5.在另外三个方法中我们将从数据库读出的数据类型进行转换。
说明:加密转换在 setNonNullParameter 中执行,解密在 getNullableResult中执行。
image.png
说明:一个setxxx方法,表示向PreparedStatement里面设置值。三个getxxx方法,一个是根据列名获取值,一个是根据列索引位置获取值,最后一个是存储过程。
2、CryptTypeHandler 使用一个 MappedTypes 注解,包含一个 CryptType 类,这个类使用 mybatis别名功能,可以极大简化 mapper sql 的编写

  1. @Alias("AESEncrypt") //主要用来表示该类对应的简写名称,需要配合Mybatis的配置文件来使用。
  2. public class AESEncrypt {
  3. }

3、mapper.xml 文件改造
<result column="CERTNO" property="certNo" jdbcType="VARCHAR" typeHandler="cn.hsa.usc.handler.typehandler.AESEncryptHandler"/>

  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
  3. <mapper namespace="cn.hsa.usc.dao.UserPersonDAO">
  4. <resultMap id="BaseResultMap" type="cn.hsa.usc.entity.UserPersonDO">
  5. <result column="RID" property="rid" jdbcType="VARCHAR"/>
  6. <result column="PSN_ID" property="psnId" jdbcType="VARCHAR"/>
  7. <result column="PSN_NAME" property="psnName" jdbcType="VARCHAR"/>
  8. <result column="TEL" property="tel" jdbcType="VARCHAR"/>
  9. <result column="CERT_TYPE" property="certType" jdbcType="VARCHAR"/>
  10. <result column="CERTNO" property="certNo" jdbcType="VARCHAR" typeHandler="cn.hsa.usc.handler.typehandler.AESEncryptHandler"/>
  11. <result column="GEND" property="gend" jdbcType="VARCHAR"/>
  12. <result column="EMAIL" property="email" jdbcType="VARCHAR"/>
  13. <result column="NATY" property="naty" jdbcType="VARCHAR"/>
  14. <result column="HSREG_ADDR" property="resdAddr" jdbcType="VARCHAR"/>
  15. <result column="BRDY" property="brdy" jdbcType="VARCHAR"/>
  16. <result column="CRTF_STAS" property="crtfStas" jdbcType="VARCHAR"/>
  17. <result column="CRTER_ID" property="crter" jdbcType="VARCHAR"/>
  18. <result column="CRTER_NAME" property="crterName" jdbcType="VARCHAR"/>
  19. <result column="CRTE_TIME" property="crteTime" jdbcType="TIMESTAMP"/>
  20. <result column="CRTE_OPTINS_NO" property="crteOptins" jdbcType="VARCHAR"/>
  21. <result column="OPTER_ID" property="opter" jdbcType="VARCHAR"/>
  22. <result column="OPTER_NAME" property="opterName" jdbcType="VARCHAR"/>
  23. <result column="OPT_TIME" property="optTime" jdbcType="TIMESTAMP"/>
  24. <result column="OPTINS_NO" property="optins" jdbcType="VARCHAR"/>
  25. <result column="POOLAREA_NO" property="poolarea" jdbcType="VARCHAR"/>
  26. <result column="UPDT_TIME" property="updateTime" jdbcType="TIMESTAMP"/>
  27. </resultMap>
  28. <sql id="Base_Column_List">
  29. RID, PSN_ID, PSN_NAME, TEL, CERT_TYPE, CERTNO, GEND, EMAIL, NATY, HSREG_ADDR,
  30. BRDY, CRTF_STAS, CRTER_ID, CRTER_NAME, CRTE_TIME, CRTE_OPTINS_NO, OPTER_ID, OPTER_NAME, OPT_TIME,
  31. OPTINS_NO, POOLAREA_NO,UPDT_TIME
  32. </sql>
  33. <select id="selectByPersonId" resultMap="BaseResultMap" parameterType="java.lang.String">
  34. select
  35. <include refid="Base_Column_List"/>
  36. from user_psn_b
  37. where PSN_ID = #{psnId,jdbcType=VARCHAR}
  38. </select>
  39. <insert id="insert" parameterType="cn.hsa.usc.entity.UserPersonDO">
  40. insert into user_psn_b ( RID, PSN_ID,
  41. PSN_NAME, TEL, CERT_TYPE,
  42. CERTNO, GEND, EMAIL,
  43. NATY, HSREG_ADDR, BRDY,
  44. CRTF_STAS, CRTER_ID, CRTER_NAME,
  45. CRTE_TIME, CRTE_OPTINS_NO, OPTER_ID,
  46. OPTER_NAME, OPT_TIME, OPTINS_NO,
  47. POOLAREA_NO, UPDT_TIME)
  48. values ( #{rid,jdbcType=VARCHAR}, #{psnId,jdbcType=BIGINT},
  49. #{psnName,jdbcType=VARCHAR}, #{tel,jdbcType=VARCHAR}, #{certType,jdbcType=VARCHAR},
  50. #{certNo,jdbcType=VARCHAR, typeHandler=cn.hsa.usc.handler.typehandler.AESEncryptHandler},
  51. #{gend,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR},
  52. #{naty,jdbcType=VARCHAR}, #{resdAddr,jdbcType=VARCHAR}, #{brdy,jdbcType=VARCHAR},
  53. #{crtfStas,jdbcType=VARCHAR}, #{crter,jdbcType=VARCHAR}, #{crterName,jdbcType=VARCHAR},
  54. #{crteTime,jdbcType=TIMESTAMP}, #{crteOptins,jdbcType=VARCHAR}, #{opter,jdbcType=VARCHAR},
  55. #{opterName,jdbcType=VARCHAR}, #{optTime,jdbcType=TIMESTAMP}, #{optins,jdbcType=VARCHAR},
  56. #{poolarea,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP} )
  57. </insert>
  58. <update id="updateByPsnId" parameterType="cn.hsa.usc.entity.UserPersonDO">
  59. update user_psn_b
  60. <set>
  61. <if test="psnName != null">
  62. PSN_NAME = #{psnName,jdbcType=VARCHAR},
  63. </if>
  64. <if test="certType != null and certType != ''">
  65. CERT_TYPE = #{certType,jdbcType=VARCHAR},
  66. </if>
  67. <if test="certNo != null and certNo != ''">
  68. CERTNO = #{certNo,jdbcType=VARCHAR,typeHandler=cn.hsa.usc.handler.typehandler.AESEncryptHandler},
  69. </if>
  70. <if test="tel != null">
  71. TEL = #{tel,jdbcType=VARCHAR},
  72. </if>
  73. <if test="gend != null">
  74. GEND = #{gend,jdbcType=VARCHAR},
  75. </if>
  76. <if test="email != null">
  77. EMAIL = #{email,jdbcType=VARCHAR},
  78. </if>
  79. <if test="naty != null and naty != ''">
  80. NATY = #{naty,jdbcType=VARCHAR},
  81. </if>
  82. <if test="resdAddr != null">
  83. HSREG_ADDR = #{resdAddr,jdbcType=VARCHAR},
  84. </if>
  85. <if test="brdy != null">
  86. BRDY = #{brdy,jdbcType=VARCHAR},
  87. </if>
  88. <if test="crtfStas != null">
  89. CRTF_STAS = #{crtfStas,jdbcType=VARCHAR},
  90. </if>
  91. <if test="crter != null">
  92. CRTER_ID = #{crter,jdbcType=VARCHAR},
  93. </if>
  94. <if test="crterName != null">
  95. CRTER_NAME = #{crterName,jdbcType=VARCHAR},
  96. </if>
  97. <if test="crteTime != null">
  98. CRTE_TIME = #{crteTime,jdbcType=TIMESTAMP},
  99. </if>
  100. <if test="crteOptins != null">
  101. CRTE_OPTINS_NO = #{crteOptins,jdbcType=VARCHAR},
  102. </if>
  103. <if test="opter != null">
  104. OPTER_ID = #{opter,jdbcType=VARCHAR},
  105. </if>
  106. <if test="opterName != null">
  107. OPTER_NAME = #{opterName,jdbcType=VARCHAR},
  108. </if>
  109. <if test="optTime != null">
  110. OPT_TIME = #{optTime,jdbcType=TIMESTAMP},
  111. </if>
  112. <if test="optins != null">
  113. OPTINS_NO = #{optins,jdbcType=VARCHAR},
  114. </if>
  115. <if test="poolarea != null">
  116. POOLAREA_NO = #{poolarea,jdbcType=VARCHAR},
  117. </if>
  118. <if test="updateTime != null">
  119. UPDT_TIME = #{updateTime,jdbcType=TIMESTAMP},
  120. </if>
  121. </set>
  122. WHERE PSN_ID = #{psnId,jdbcType=VARCHAR}
  123. </update>
  124. </mapper>