StatisticsFinancePageselectMapper.xml 7.32 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.lhcredit.project.business.statisticsFinancePageselect.mapper.StatisticsFinancePageselectMapper">
    
    <resultMap type="StatisticsFinancePageselect" id="StatisticsFinancePageselectResult">
        <result property="id"    column="id"    />
        <result property="ename"    column="ename"    />
        <result property="orgId"    column="org_id"    />
        <result property="userId"    column="user_id"    />
        <result property="userName"    column="user_name"    />
        <result property="dataType"    column="data_type"    />
        <result property="creditTime"    column="credit_time"    />
        <result property="resultRemark"    column="result_remark"    />
        <result property="countStatus"    column="count_status"    />
        <result property="reconciliation"    column="reconciliation"    />
    </resultMap>
	
	<sql id="selectStatisticsFinancePageselectVo">
        select id, ename, org_id, user_id, user_name, data_type, credit_time, result_remark, count_status,reconciliation from statistics_finance_pageselect
    </sql>



    <select id="selectStatisticsFinancePageselectList" parameterType="StatisticsFinancePageselect" resultMap="StatisticsFinancePageselectResult">
        <include refid="selectStatisticsFinancePageselectVo"/>
        <where>  
            <if test="id != null "> and id = #{id}</if>
            <if test="ename != null  and ename != '' "> and ename like CONCAT('%',#{ename},'%')</if>
            <if test="orgId != null "> and org_id = #{orgId}</if>
            <if test="userId != null "> and user_id = #{userId}</if>
            <if test="userName != null  and userName != '' "> and user_id in
             (select id from front_user where userName like CONCAT('%',#{userName},'%'))</if>
            <if test="dataType != null  and dataType != '' "> and data_type = #{dataType}</if>
            <if test="creditTime != null "> and credit_time = #{creditTime}</if>
            <if test="resultRemark != null  and resultRemark != '' "> and result_remark = #{resultRemark}</if>
            <if test="countStatus != null "> and count_status = #{countStatus}</if>
            <if test="reconciliation != null "> and reconciliation = #{reconciliation}</if>
            <if test="null!=params and params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
                AND date_format(credit_time,'%Y-%m-%d %H:%i:%s') &gt;= date_format(#{params.beginTime},'%Y-%m-%d %H:%i:%s')
            </if>
            <if test="null!=params and  params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
                AND date_format(credit_time,'%Y-%m-%d %H:%i:%s') &lt;= date_format(#{params.endTime},'%Y-%m-%d %H:%i:%s')
            </if>
        </where>
    </select>
    
    <select id="selectStatisticsFinancePageselectById" parameterType="Integer" resultMap="StatisticsFinancePageselectResult">
        <include refid="selectStatisticsFinancePageselectVo"/>
        where id = #{id}
    </select>
    <select id="getList"
            resultType="com.lhcredit.project.business.statisticsFinancePageselect.domain.StatisticsFinancePageselect">
        select a.id, a.ename, a.org_id as orgId, a.user_id as  userId, a.user_name as userName,
               a.data_type as dataType, a.credit_time as creditTime,a.reconciliation as reconciliation, a.result_remark as resultRemark, a.count_status as countStatus
             ,b.dept_name as deptName
        from statistics_finance_pageselect a left join front_dept b on a.`org_id`=b.`id`
        <where>
            <if test="deptName != null and ''!=deptName  ">a.org_id in (SELECT id FROM `front_dept` WHERE dept_name LIKE concat('%',#{deptName},'%'))</if>
            <if test="ename != null and ''!=ename  ">and a.ename  LIKE concat('%',#{ename},'%')</if>
            <if test="userName != null and ''!=userName ">and a.user_id in (SELECT id FROM front_user WHERE userName LIKE concat('%',#{userName},'%'))</if>
            <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
                and date_format(credit_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
            </if>
            <if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
                and date_format(credit_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
            </if>
        </where>



    </select>

    <insert id="insertStatisticsFinancePageselect" parameterType="StatisticsFinancePageselect" useGeneratedKeys="true" keyProperty="id">
        insert into statistics_finance_pageselect
		<trim prefix="(" suffix=")" suffixOverrides=",">
			<if test="ename != null  and ename != ''  ">ename,</if>
			<if test="orgId != null  ">org_id,</if>
			<if test="userId != null  ">user_id,</if>
			<if test="userName != null  and userName != ''  ">user_name,</if>
			<if test="dataType != null  and dataType != ''  ">data_type,</if>
			<if test="creditTime != null  ">credit_time,</if>
			<if test="resultRemark != null  and resultRemark != ''  ">result_remark,</if>
			<if test="countStatus != null  ">count_status,</if>
			<if test="reconciliation != null  ">reconciliation,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
			<if test="ename != null  and ename != ''  ">#{ename},</if>
			<if test="orgId != null  ">#{orgId},</if>
			<if test="userId != null  ">#{userId},</if>
			<if test="userName != null  and userName != ''  ">#{userName},</if>
			<if test="dataType != null  and dataType != ''  ">#{dataType},</if>
			<if test="creditTime != null  ">#{creditTime},</if>
			<if test="resultRemark != null  and resultRemark != ''  ">#{resultRemark},</if>
			<if test="countStatus != null  ">#{countStatus},</if>
			<if test="reconciliation != null  ">#{reconciliation},</if>
         </trim>
    </insert>
	 
    <update id="updateStatisticsFinancePageselect" parameterType="StatisticsFinancePageselect">
        update statistics_finance_pageselect
        <trim prefix="SET" suffixOverrides=",">
            <if test="ename != null  and ename != ''  ">ename = #{ename},</if>
            <if test="orgId != null  ">org_id = #{orgId},</if>
            <if test="userId != null  ">user_id = #{userId},</if>
            <if test="userName != null  and userName != ''  ">user_name = #{userName},</if>
            <if test="dataType != null  and dataType != ''  ">data_type = #{dataType},</if>
            <if test="creditTime != null  ">credit_time = #{creditTime},</if>
            <if test="resultRemark != null  and resultRemark != ''  ">result_remark = #{resultRemark},</if>
            <if test="countStatus != null  ">count_status = #{countStatus},</if>
            <if test="reconciliation != null  ">reconciliation = #{reconciliation},</if>
        </trim>
        where id = #{id}
    </update>

	<delete id="deleteStatisticsFinancePageselectById" parameterType="Integer">
        delete from statistics_finance_pageselect where id = #{id}
    </delete>
	
    <delete id="deleteStatisticsFinancePageselectByIds" parameterType="String">
        delete from statistics_finance_pageselect where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
    
</mapper>