FeedbackDao.xml 7.99 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.man.dao.impl.FeedbackDaoImpl">
    <resultMap id="FeedbackRM" type="com.diligrp.mobsite.man.domain.Feedback">
            <id property="id" column="id"/>
            <result property="marketId" column="market_id"/>
            <result property="username" column="username"/>
            <result property="userId" column="user_id"/>
            <result property="deviceType" column="device_type"/>
            <result property="deviceVersion" column="device_version"/>
            <result property="appVersion" column="app_version"/>
            <result property="status" column="status"/>
            <result property="content" column="content"/>
            <result property="systemType" column="system_type" />
            <result property="yn" column="yn"/>
            <result property="created" column="created"/>
            <result property="modified" column="modified"/>
    </resultMap>


	<select id="getById" parameterType="Long" resultMap="FeedbackRM">
		<![CDATA[
		SELECT
		    id
		    ,market_id
		    ,username
		    ,user_id
		    ,device_type
		    ,device_version
		    ,app_version
		    ,status
		    ,content
		    ,yn
		    ,created
		    ,modified
		FROM T_FEEDBACK

		WHERE id=#{pk}
		and (yn is null or yn = 1)
		]]>
	</select>

	<insert id="save" parameterType="com.diligrp.mobsite.man.domain.Feedback">
        <selectKey keyProperty="id" resultType="long" order="AFTER">
            SELECT LAST_INSERT_ID();
        </selectKey>
		<![CDATA[
		INSERT INTO T_FEEDBACK(
                    market_id
                    ,username
                    ,user_id
                    ,device_type
                    ,device_version
                    ,app_version
                    ,system_type
                    ,status
                    ,content
		) VALUES(
                    #{marketId}
                    ,#{username}
                    ,#{userId}
                    ,#{deviceType}
                    ,#{deviceVersion}
                    ,#{appVersion}
                    ,#{systemType}
                    ,#{status}
                    ,#{content}
		)
		]]>
	</insert>

    <update id="update" parameterType="com.diligrp.mobsite.man.domain.Feedback">
    <![CDATA[
            UPDATE T_FEEDBACK set
                        market_id=#{marketId}
                        ,username=#{username}
                        ,user_id=#{userId}
                        ,device_type=#{deviceType}
                        ,device_version=#{deviceVersion}
                        ,app_version=#{appVersion}
                        ,status=#{status}
                        ,content=#{content}

            where 1=1
            and id = #{id}
            ]]>
    </update>

	<select id="countByCondition" parameterType="Query" resultType="Integer">
		<![CDATA[
		SELECT count(1) FROM T_FEEDBACK where 1=1
		]]>
        <if test="param != null">
            <if test="param.id != null and param.id != ''">
            and id = #{param.id}
            </if>
            <if test="param.marketId != null and param.marketId != ''">
            and market_id = #{param.marketId}
            </if>
            <if test="param.username != null and param.username != ''">
            and username = #{param.username}
            </if>
            <if test="param.userId != null and param.userId != ''">
            and user_id = #{param.userId}
            </if>
            <if test="param.deviceType != null and param.deviceType != ''">
            and device_type = #{param.deviceType}
            </if>
            <if test="param.deviceVersion != null and param.deviceVersion != ''">
            and device_version = #{param.deviceVersion}
            </if>
            <if test="param.appVersion != null and param.appVersion != ''">
            and app_version = #{param.appVersion}
            </if>
            <if test="param.status != null and param.status != ''">
            and status = #{param.status}
            </if>
            <if test="param.content != null and param.content != ''">
            and content = #{param.content}
            </if>
            <if test="param.systemType != null and param.systemType != ''">
            and system_type = #{param.systemType}
            </if>
            <![CDATA[
                    and (yn is null or yn = 1)
                    ]]>
            <if test="param.created_begin != null and param.created_begin != ''">
            and created >= #{param.created_begin}
            </if>
            <if test="param.created_end != null and param.created_end != ''">
                and created &lt; #{param.created_end}
            </if>
            <if test="param.modified != null and param.modified != ''">
            and modified = #{param.modified}
            </if>
        </if>
        <if test="args != null">
            <if test="args.marketIds != null and args.marketIds != ''">
                <foreach collection="args.marketIds" item="marketId" open="and (" close=")" separator="or">
                    market_id = #{marketId}
                </foreach>
            </if>
        </if>
	</select>

	<select id="listByCondition" parameterType="Query" resultMap="FeedbackRM">
		<![CDATA[
		SELECT
		    id
		    ,market_id
		    ,username
		    ,user_id
		    ,device_type
		    ,device_version
		    ,app_version
		    ,status
		    ,content
		    ,yn
		    ,created
		    ,modified
		FROM T_FEEDBACK where 1=1
		]]>
        <if test="param != null">
            <if test="param.id != null and param.id != ''">
                and id = #{param.id}
            </if>
            <if test="param.marketId != null and param.marketId != ''">
                and market_id = #{param.marketId}
            </if>
            <if test="param.username != null and param.username != ''">
                and username = #{param.username}
            </if>
            <if test="param.userId != null and param.userId != ''">
                and user_id = #{param.userId}
            </if>
            <if test="param.deviceType != null and param.deviceType != ''">
                and device_type = #{param.deviceType}
            </if>
            <if test="param.deviceVersion != null and param.deviceVersion != ''">
                and device_version = #{param.deviceVersion}
            </if>
            <if test="param.appVersion != null and param.appVersion != ''">
                and app_version = #{param.appVersion}
            </if>
            <if test="param.status != null and param.status != ''">
                and status = #{param.status}
            </if>
            <if test="param.content != null and param.content != ''">
                and content = #{param.content}
            </if>
            <if test="param.systemType != null and param.systemType != ''">
            and system_type = #{param.systemType}
            </if>
            <![CDATA[
            and (yn is null or yn = 1)
            ]]>
            <if test="param.created_begin != null and param.created_begin != ''">
                and created >= #{param.created_begin}
            </if>
            <if test="param.created_end != null and param.created_end != ''">
                and created &lt; #{param.created_end}
            </if>
            <if test="param.modified != null and param.modified != ''">
                and modified = #{param.modified}
            </if>
        </if>
        <!-- 
        <if test="args != null">
            <if test="args.marketIds != null and args.marketIds != ''">
                <foreach collection="args.marketIds" item="marketId" open="and (" close=")" separator="or">
                    market_id = #{marketId}
                </foreach>
            </if>
        </if>
         -->
        order by id desc
		<![CDATA[
		limit #{startRow},#{pageSize}
		]]>
	</select>


    <update id="deleteById" parameterType="Long">
    <![CDATA[
        update T_FEEDBACK set
        yn = 2
        where 1 = 1
        and id = #{id}
    ]]>
    </update>

</mapper>