|
@@ -0,0 +1,170 @@
|
|
|
+<?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.jeeplus.test.reimbursementsys.mapper.ReimbursementBusinessTwoMapper">
|
|
|
+ <sql id="zsReimbursementBusinessInfoColumns">
|
|
|
+ a.id as 'id',
|
|
|
+ a.create_by as 'createBy',
|
|
|
+ a.create_date as 'createDate',
|
|
|
+ a.update_by as 'updateBy',
|
|
|
+ a.update_date as 'updateDate',
|
|
|
+ a.remarks as 'remarks',
|
|
|
+ a.del_flag as 'delFlag',
|
|
|
+ a.business_code_id as 'businessCodeId',
|
|
|
+ a.user_id as 'userId',
|
|
|
+ a.year as 'year',
|
|
|
+ a.reimbursement_day as 'reimbursementDay',
|
|
|
+ a.reimbursement_amount as 'reimbursementAmount',
|
|
|
+ a.reimbursement_type as 'reimbursementType'
|
|
|
+ </sql>
|
|
|
+ <sql id="joinZsReimbursementBusinessInfoColumns">
|
|
|
+ a.id as 'id',
|
|
|
+ a.create_by as 'createBy',
|
|
|
+ a.create_date as 'createDate',
|
|
|
+ a.update_by as 'updateBy',
|
|
|
+ a.update_date as 'updateDate',
|
|
|
+ a.remarks as 'remarks',
|
|
|
+ a.del_flag as 'delFlag',
|
|
|
+ a.business_code_id as 'businessCodeId',
|
|
|
+ a.user_id as 'userId',
|
|
|
+ a.year as 'year',
|
|
|
+ a.reimbursement_day as 'reimbursementDay',
|
|
|
+ a.reimbursement_amount as 'reimbursementAmount',
|
|
|
+ a.reimbursement_type as 'reimbursementType',
|
|
|
+ a.reimbursement_fsalary as 'reimbursementFsalary',
|
|
|
+ (case when a.reimbursement_type = '1' then '正常报销' when a.reimbursement_type = '2' then '补差' else '' end) as reimbursementTypeStr,
|
|
|
+ (case when a.reimbursement_fsalary = '1' then '报销不实发' when a.reimbursement_fsalary = '2' then '报销并实发' else '' end) as reimbursementFsalaryStr,
|
|
|
+ su.name as 'userName'
|
|
|
+ </sql>
|
|
|
+ <sql id="reimbursementUserJoinColumns">
|
|
|
+ left join sys_user su on su.id = a.user_id
|
|
|
+ </sql>
|
|
|
+ <insert id="insertReimbursementBusiness">
|
|
|
+ insert into zs_reimbursement_business_info
|
|
|
+ (
|
|
|
+ id,
|
|
|
+ create_by,
|
|
|
+ create_date,
|
|
|
+ update_by,
|
|
|
+ update_date,
|
|
|
+ remarks,
|
|
|
+ del_flag,
|
|
|
+ business_code_id,
|
|
|
+ user_id,
|
|
|
+ year,
|
|
|
+ <if test="reimbursementDay != null and reimbursementDay != ''">
|
|
|
+ reimbursement_day,
|
|
|
+ </if>
|
|
|
+ reimbursement_amount,
|
|
|
+ reimbursement_type,
|
|
|
+ reimbursement_fsalary,
|
|
|
+ office_type
|
|
|
+ )
|
|
|
+ values
|
|
|
+ (
|
|
|
+ #{id},
|
|
|
+ #{createBy},
|
|
|
+ #{createDate},
|
|
|
+ #{updateBy},
|
|
|
+ #{updateDate},
|
|
|
+ #{remarks},
|
|
|
+ #{delFlag},
|
|
|
+ #{businessCodeId},
|
|
|
+ #{userId},
|
|
|
+ #{year},
|
|
|
+ <if test="reimbursementDay != null and reimbursementDay != ''">
|
|
|
+ #{reimbursementDay},
|
|
|
+ </if>
|
|
|
+ #{reimbursementAmount},
|
|
|
+ #{reimbursementType},
|
|
|
+ #{reimbursementFsalary},
|
|
|
+ #{officeType}
|
|
|
+ )
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <select id="findListPage"
|
|
|
+ resultType="com.jeeplus.test.reimbursementsys.domain.dto.ReimbursementBusinessTwoDTO">
|
|
|
+ select
|
|
|
+ <include refid="joinZsReimbursementBusinessInfoColumns"/>
|
|
|
+ ,(SELECT NAME FROM sys_office WHERE id = ( (case when (SELECT substring_index( substring_index( parent_ids, ',', 3 ), ',', - 1 ) FROM sys_office WHERE id = su.office_id ) = '' then (select id FROM sys_office WHERE id = su.office_id ) else (SELECT substring_index( substring_index( parent_ids, ',', 3 ), ',', - 1 ) FROM sys_office WHERE id = su.office_id ) end) )) AS 'userOfficeName'
|
|
|
+ from zs_reimbursement_business_info a
|
|
|
+ <include refid="reimbursementUserJoinColumns"/>
|
|
|
+ left join sys_office so on so.id = su.office_id
|
|
|
+ <where>
|
|
|
+ a.del_flag = 0 and (a.business_code_id='' or a.business_code_id=null)
|
|
|
+ <if test="reimbursementBusiness.year != null and reimbursementBusiness.year != ''">
|
|
|
+ and a.year like concat('%',#{reimbursementBusiness.year},'%')
|
|
|
+ </if>
|
|
|
+ <if test="reimbursementBusiness.userId != null and reimbursementBusiness.userId != ''">
|
|
|
+ and a.user_id = #{reimbursementBusiness.userId}
|
|
|
+ </if>
|
|
|
+ and a.office_type = #{reimbursementBusiness.officeType}
|
|
|
+ </where>
|
|
|
+ order by a.update_date desc,a.year desc, a.user_id asc
|
|
|
+ </select>
|
|
|
+ <select id="findSelectList"
|
|
|
+ resultType="com.jeeplus.test.reimbursementsys.domain.dto.ReimbursementDTO">
|
|
|
+
|
|
|
+ select id,business_code as businessCode from zs_reimbursement_info where business_code is not null and business_code != '' group by business_code
|
|
|
+ </select>
|
|
|
+ <select id="findSelectYearList" resultType="java.lang.String">
|
|
|
+ select year from (
|
|
|
+ SELECT year FROM `zs_reimbursement_info`
|
|
|
+ UNION all
|
|
|
+ SELECT year FROM `zs_wuhan_reimbursement_info`
|
|
|
+ ) a
|
|
|
+ GROUP BY a.year order by a.year desc
|
|
|
+ </select>
|
|
|
+ <select id="findSelectCodeListByYear"
|
|
|
+ resultType="com.jeeplus.test.reimbursementsys.domain.dto.ReimbursementDTO">
|
|
|
+ select id,business_code as businessCode
|
|
|
+ from zs_reimbursement_info
|
|
|
+ where year = #{year} and del_flag = 0
|
|
|
+ and business_code is not null and business_code != '' and reimbursement_ratio is not null and reimbursement_ratio !=''
|
|
|
+ group by business_code
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="findSelectCodeListByYearOnWuHan"
|
|
|
+ resultType="com.jeeplus.test.reimbursementsys.domain.dto.ReimbursementDTO">
|
|
|
+ select id,business_code as businessCode
|
|
|
+ from zs_wuhan_reimbursement_info
|
|
|
+ where year = #{year} and del_flag = 0
|
|
|
+ and business_code is not null and business_code != '' and reimbursement_ratio is not null and reimbursement_ratio !=''
|
|
|
+ group by business_code
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="findDataById"
|
|
|
+ resultType="com.jeeplus.test.reimbursementsys.domain.dto.ReimbursementBusinessTwoDTO">
|
|
|
+ select
|
|
|
+ <include refid="zsReimbursementBusinessInfoColumns"/>
|
|
|
+ from zs_reimbursement_business_info a
|
|
|
+ where id=#{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+ <delete id="delPhysicsById">
|
|
|
+ delete from zs_reimbursement_business_info
|
|
|
+ where id = #{id}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <delete id="deleteByList">
|
|
|
+ delete from zs_reimbursement_business_info
|
|
|
+ <where>
|
|
|
+ <if test="idList != null and idList.size>0">
|
|
|
+ and id in
|
|
|
+ <foreach collection="idList" item="id" separator="," open="(" close=")">
|
|
|
+ #{id}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <update id="modifyBindCode">
|
|
|
+ update zs_reimbursement_business_info
|
|
|
+ set
|
|
|
+ business_code_id=#{businessCode},
|
|
|
+ reimbursement_address = #{reimbursementAddress}
|
|
|
+ where id=#{ids}
|
|
|
+ </update>
|
|
|
+
|
|
|
+
|
|
|
+</mapper>
|