• java mybatis 动态sql


     
    
    //-------------------------------查询-------------------------------------//
    
    <sql id="cmsGuestbookColumns">
         
            
             a.id AS "id",
            a.GROUP_NUMBER AS "groupNumber",
            a.GROUP_NAME AS "groupName",
            a.GROUP_AMOUNT  as "groupAmount", 
            a.GROUP_STATUS AS "groupStatus",
               a.RULES AS "rules",
            a.DELETE_STATUS AS "deleteStatus",
            <!-- a.MODIFIEDBY AS "modifiedby", -->
            a.MODIFIEDBY AS "updateBy",
            <!-- DATE_FORMAT(a.MODIFIEDON,'%Y-%m-%d %H:%i:%s')     AS "modifiedon", -->
             DATE_FORMAT(a.MODIFIEDON,'%Y-%m-%d %H:%i:%s')     AS "updateDate", 
            a.CREATEDBY AS "createdby",  
                <!-- DATE_FORMAT(a.CREATEDON,'%Y-%m-%d %H:%i:%s') AS "createdon"   -->
             DATE_FORMAT(a.CREATEDON,'%Y-%m-%d %H:%i:%s') AS "createDate"     
        </sql>
        
         
      
        
        <select id="findList" resultType="com.thinkgem.jeesite.modules.rule.entity.RuleCombinationModel">
            SELECT 
                <include refid="cmsGuestbookColumns"/>
            FROM t_zg_rule_group  a
             
            <where>
                a.DELETE_STATUS = 0
                <if test="groupNumber!='' and groupNumber!=null ">
                and a.GROUP_NUMBER=#{groupNumber}
                </if>
                <if test="groupName!='' and groupName!=null ">
                and a.GROUP_NAME=#{groupName}
                </if>
                <if test="groupStatus!='' and groupStatus!=null ">
                and a.GROUP_STATUS=#{groupStatus}
                </if>
            </where>
            <choose>
                <when test="page !=null and page.orderBy != null and page.orderBy != ''">
                    ORDER BY ${page.orderBy}
                </when>
                <otherwise>
                    ORDER BY a.CREATEDON DESC
                </otherwise>
            </choose>
        </select>
    
     
    
     
    
    //-------------------------------修改-------------------------------------//
    
        <update id="update">
            UPDATE t_zg_rule_group
             <set>     
            <if test="groupNumber !='' and groupNumber !=null">
            GROUP_NUMBER=#{groupNumber},
            </if>
            <if test="groupName !='' and groupName !=null">
            GROUP_NAME=#{groupName},
            </if>
                <if test="groupStatus !='' and groupStatus !=null">
            GROUP_STATUS=#{groupStatus},
            </if>
                <if test="groupAmount !='' and groupAmount !=null">
            GROUP_AMOUNT=#{groupAmount},
            </if>
            <if test="deleteStatus !='' and deleteStatus !=null">
            DELETE_STATUS=#{deleteStatus},
            </if>
                <if test="modifiedby !='' and modifiedby !=null">
            MODIFIEDBY=#{modifiedby},
            </if>        
            </set>            
            WHERE id = #{id}
        </update>
  • 相关阅读:
    js 对象克隆的三种方式
    css超出行数隐藏
    express 中的登录-注册
    Git 常用命令
    mongodb 基本操作
    【服务器】阿里云
    【mongoDb进阶】mongoDb中的聚合管道
    express中操作数据库--Mongoose
    vuex常见问题
    ADC采样时间
  • 原文地址:https://www.cnblogs.com/yangjinwang/p/6028026.html
Copyright © 2020-2023  润新知