zoukankan      html  css  js  c++  java
  • Mybatis

    Mybatis介绍:

    https://www.cnblogs.com/nickup/p/9726433.html

    Mybatis实现乐观锁version并实现回滚

    version增加数据库版本标识,version一般为数值或时间戳

    https://blog.csdn.net/qq_32923745/article/details/88800060

    https://blog.csdn.net/hedy17/article/details/79376611

    1、问题:There is no getter for property named 'param' in 'class java.lang.String'

    DaoImpl:

    @Override
        public List<Map<String, Object>> getSelectByDictCode(String param) {
            // TODO 自动生成的方法存根
            return session.selectList("getSelectByDictCode", param);
        }

    参数:parameterType="string"

    <select id="getSelectByDictCode" parameterType="string" resultType="map">
            select
                dict_lable    as   "key",
                dict_value  as   "value"
            from tb_dict
            where dict_status = '1'
            <if test=" param != null and param != ''">
              and dict_code = #{param}
            </if>
            order by dict_sort asc
        </select>

    在if test=验证的时候发生的 “There is no getter for property named in ‘class java.lang.String’”,需要使用

    _parameter
    <select id="getSelectByDictCode" parameterType="string" resultType="map">
            select
                dict_lable    as   "key",
                dict_value  as   "value"
            from tb_dict
            where dict_status = '1'
            <if test=" _parameter != null and _parameter != ''">
              and dict_code = #{param}
            </if>
            order by dict_sort asc
        </select>

     2、<choose >标签

    choose (when,otherwize) ,相当于java 语言中的 switch ,与 jstl 中 的 choose 很类似。

    test="conferenceSystemId != null and conferenceSystemId == '2'.toString()"

    <select id="getUserByCommitteeId" parameterType="map" resultType="user">
            <choose>
                 <when test="committee_id != null and committee_id != ''">
                          select tu.* from tb_committee_rule tcr ,tb_user tu 
                          where tcr.user_id = tu.id and tcr.committee_id = #{committee_id}
                 </when>
    <otherwise> select tu.* from tb_user tu,tb_user_role tur where tu.id = tur.user_id and tur.role_id = (select tr.id from tb_role tr where tr.name = '委员') </otherwise> </choose> </select>

     3、无法使用 <= 等符号

      解决方式:<![CDATA[ <= ]]>

  • 相关阅读:
    2013dgtcs 成绩排序
    JZOJ 1286. 太空电梯
    java单例模式Singleton
    设计模式的类型
    java工厂模式Factory
    Mysql SQL优化
    maven deploy命令打包到私服
    debian/linux 配置maven
    Java RC4加密解密工具
    JedisUtils
  • 原文地址:https://www.cnblogs.com/lijianda/p/8920205.html
Copyright © 2011-2022 走看看