RegisterNoMapperDao.xml 7.12 KB
<?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.diligrp.mobsite.getway.dao.user.impl.RegisterNoMapperDaoImpl">
    <resultMap id="RegisterNoMapperRM" type="com.diligrp.mobsite.getway.domain.RegisterNoMapper">
            <id property="id" column="id"/>
            <result property="userid" column="userid"/>
            <result property="registerNo" column="register_no"/>
            <result property="sysFlag" column="sys_flag"/>
            <result property="deviceType" column="device_type"/>
            <result property="yn" column="yn"/>
            <result property="created" column="created"/>
            <result property="modified" column="modified"/>
    </resultMap>


	<select id="getById" parameterType="Long" resultMap="RegisterNoMapperRM">
		<![CDATA[
		SELECT
		    id
		    ,userid
		    ,register_no
		    ,sys_flag
		    ,yn
		    ,created
		    ,modified
		FROM T_REGISTER_NO_MAPPER

		WHERE id=#{pk}
		and (yn is null or yn = 1)
		]]>
	</select>
	
	<select id="getByUserId" parameterType="Long" resultMap="RegisterNoMapperRM">
		<![CDATA[
		SELECT
		    userid
		    ,register_no
		    ,sys_flag
		    ,device_type
		FROM T_REGISTER_NO_MAPPER

		WHERE userid=#{userid}
		and (yn is null or yn = 1)
		order by id desc
		]]>
	</select>

	<insert id="save" parameterType="com.diligrp.mobsite.getway.domain.RegisterNoMapper">
        <selectKey keyProperty="id" resultType="long" order="AFTER">
            SELECT LAST_INSERT_ID();
        </selectKey>
		<![CDATA[
		INSERT INTO T_REGISTER_NO_MAPPER(
                    userid
                    ,register_no
                    ,sys_flag
                    ,device_type
		) VALUES(
                    #{userid}
                    ,#{registerNo}
                    ,#{sysFlag}
                    ,#{deviceType}
		)
		]]>
	</insert>

    <update id="update" parameterType="com.diligrp.mobsite.getway.domain.RegisterNoMapper">
    <![CDATA[
            UPDATE T_REGISTER_NO_MAPPER set
                        userid=#{userid}
                        ,register_no=#{registerNo}
                        ,sys_flag=#{sysFlag}
                        ,device_type=#{deviceType}
                        ,yn = 1
            where 1=1
            and id = #{id}
            ]]>
    </update>

	<select id="countByCondition" parameterType="Query" resultType="Integer">
		<![CDATA[
		SELECT count(1) FROM T_REGISTER_NO_MAPPER where 1=1
		]]>
        <if test="param != null">
            <if test="param.id != null and param.id != ''">
            and id = #{param.id}
            </if>
            <if test="param.userid != null and param.userid != ''">
            and userid = #{param.userid}
            </if>
            <if test="param.registerNo != null and param.registerNo != ''">
            and register_no = #{param.registerNo}
            </if>
            <if test="param.sysFlag != null and param.sysFlag != ''">
            and sys_flag = #{param.sysFlag}
            </if>
            <![CDATA[
                    and (yn is null or yn = 1)
                    ]]>
            <if test="param.created != null and param.created != ''">
            and created = #{param.created}
            </if>
            <if test="param.modified != null and param.modified != ''">
            and modified = #{param.modified}
            </if>
        </if>
	</select>

	<select id="listByCondition" parameterType="Query" resultMap="RegisterNoMapperRM">
		<![CDATA[
		SELECT
		    id
		    ,userid
		    ,register_no
		    ,sys_flag
		    ,device_type
		    ,yn
		    ,created
		    ,modified
		FROM T_REGISTER_NO_MAPPER where 1=1
		]]>
        <if test="param != null">
                <if test="param.id != null and param.id != ''">
                    and id = #{param.id}
                </if>
                <if test="param.userid != null and param.userid != ''">
                    and userid = #{param.userid}
                </if>
                <if test="param.registerNo != null and param.registerNo != ''">
                    and register_no = #{param.registerNo}
                </if>
                <if test="param.sysFlag != null and param.sysFlag != ''">
                    and sys_flag = #{param.sysFlag}
                </if>
                <![CDATA[
                and (yn is null or yn = 1)
                ]]>
                <if test="param.created != null and param.created != ''">
                    and created = #{param.created}
                </if>
                <if test="param.modified != null and param.modified != ''">
                    and modified = #{param.modified}
                </if>
        </if>
        order by id desc
        <if test="startRow != null and startRow != '' and pageSize != null and pageSize != ''">
		<![CDATA[
		limit #{startRow},#{pageSize}
		]]>
        </if>
	</select>

    <select id="listByConditionNoYn" parameterType="Query" resultMap="RegisterNoMapperRM">
        <![CDATA[
		SELECT
		    id
		    ,userid
		    ,register_no
		    ,sys_flag
		    ,device_type
		    ,yn
		    ,created
		    ,modified
		FROM T_REGISTER_NO_MAPPER where 1=1
		]]>
        <if test="param != null">
            <if test="param.id != null and param.id != ''">
                and id = #{param.id}
            </if>
            <if test="param.userid != null and param.userid != ''">
                and userid = #{param.userid}
            </if>
            <if test="param.registerNo != null and param.registerNo != ''">
                and register_no = #{param.registerNo}
            </if>
            <if test="param.sysFlag != null and param.sysFlag != ''">
                and sys_flag = #{param.sysFlag}
            </if>

            <if test="param.created != null and param.created != ''">
                and created = #{param.created}
            </if>
            <if test="param.modified != null and param.modified != ''">
                and modified = #{param.modified}
            </if>
        </if>
        order by id desc
        <if test="startRow != null and startRow != '' and pageSize != null and pageSize != ''">
            <![CDATA[
		limit #{startRow},#{pageSize}
		]]>
        </if>
    </select>
	
	<select id="batchQuery" resultMap="RegisterNoMapperRM">
		<![CDATA[
		SELECT
		    id
		    ,userid
		    ,register_no
		    ,sys_flag
		    ,device_type
		    ,yn
		    ,created
		    ,modified
		FROM T_REGISTER_NO_MAPPER where 1=1
		]]>
		<if test="userids != null and userids != ''">
			and userid in
			<foreach collection="userids" item="userid" index="index"
			open="(" close=")" separator=",">
			#{userid}
			</foreach>
		</if>
		<if test="device_type != null and device_type != ''">
			and device_type = #{device_type}
		</if>
        <![CDATA[
          and (yn is null or yn = 1)
        ]]>

	order by id desc
	</select>

    <delete id="deleteById" parameterType="Long">
    <![CDATA[
        DELETE FROM T_REGISTER_NO_MAPPER 
        WHERE 1 = 1
        AND id = #{id}
    ]]>
    </delete>
    
   <update id="updateByuid" parameterType="Long">
   <![CDATA[
        UPDATE T_REGISTER_NO_MAPPER SET
        yn = 2
        WHERE 1 = 1
        AND id=#{id}
    ]]>
   
   </update>

</mapper>