THaveSalaryNosocialMapper.xml 11.1 KB
Newer Older
fangxinjiang's avatar
fangxinjiang committed
1 2 3 4 5 6 7 8 9 10 11 12 13
<?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.yifu.cloud.plus.v1.yifu.salary.mapper.THaveSalaryNosocialMapper">
    <resultMap id="tHaveSalaryNosocialMap" type="com.yifu.cloud.plus.v1.yifu.salary.entity.THaveSalaryNosocial">
        <id property="id" column="ID"/>
        <result property="employeeId" column="employee_id"/>
        <result property="employeeName" column="employee_name"/>
        <result property="employeeIdCard" column="employee_id_card"/>
        <result property="customerId" column="Customer_id"/>
        <result property="settleDomainId" column="settle_domain_id"/>
        <result property="customerName" column="CUSTOMER_NAME"/>
        <result property="settlementOrganName" column="SETTLEMENT_ORGAN_NAME"/>
        <result property="settlementOrganNo" column="SETTLEMENT_ORGAN_NO"/>
fangxinjiang's avatar
fangxinjiang committed
14
		<result property="feedBack" column="FEED_BACK"/>
fangxinjiang's avatar
fangxinjiang committed
15
		<result property="reasonType" column="REASON_TYPE"/>
fangxinjiang's avatar
fangxinjiang committed
16 17 18 19 20 21 22 23 24 25
        <result property="month" column="month"/>
    </resultMap>
	<resultMap id="haveSalaryNoSocialExportMap" type="com.yifu.cloud.plus.v1.yifu.salary.vo.THaveSalaryNoSocialExportVo">
		<result property="customerName" column="CUSTOMER_NAME"/>
		<result property="settlementOrganName" column="SETTLEMENT_ORGAN_NAME"/>
		<result property="employeeName" column="employee_name"/>
		<result property="employeeIdCard" column="employee_id_card"/>
		<result property="month" column="month"/>
		<result property="relaySalary" column="RELAY_SALARY"/>
		<result property="createName" column="CREATE_NAME"/>
fangxinjiang's avatar
fangxinjiang committed
26
		<result property="feedBack" column="FEED_BACK"/>
27

fangxinjiang's avatar
fangxinjiang committed
28 29 30 31 32 33 34 35 36 37 38 39
	</resultMap>
    <sql id="Base_Column_List">
             a.ID,
                  a.employee_id,
                  a.employee_name,
                  a.employee_id_card,
                  a.Customer_id,
                  a.settle_domain_id,
                  a.CUSTOMER_NAME,
                  a.SETTLEMENT_ORGAN_NAME,
                  a.SETTLEMENT_ORGAN_NO,
                  a.month,
40
                  a.CREATE_MONTH,
fangxinjiang's avatar
fangxinjiang committed
41
                  a.relay_salary,
fangxinjiang's avatar
fangxinjiang committed
42
                  a.FEED_BACK,
fangxinjiang's avatar
fangxinjiang committed
43 44
				  a.CREATE_NAME,
				 a.REASON_TYPE
fangxinjiang's avatar
fangxinjiang committed
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
         </sql>
    <sql id="tHaveSalaryNosocial_where">
        <if test="tHaveSalaryNosocial != null">
            <if test="tHaveSalaryNosocial.id != null and tHaveSalaryNosocial.id.trim() != ''">
                AND a.ID = #{tHaveSalaryNosocial.id}
            </if>
            <if test="tHaveSalaryNosocial.employeeId != null and tHaveSalaryNosocial.employeeId.trim() != ''">
                AND a.employee_id = #{tHaveSalaryNosocial.employeeId}
            </if>
            <if test="tHaveSalaryNosocial.employeeName != null and tHaveSalaryNosocial.employeeName.trim() != ''">
                AND a.employee_name = #{tHaveSalaryNosocial.employeeName}
            </if>
            <if test="tHaveSalaryNosocial.employeeIdCard != null and tHaveSalaryNosocial.employeeIdCard.trim() != ''">
                AND a.employee_id_card = #{tHaveSalaryNosocial.employeeIdCard}
            </if>
            <if test="tHaveSalaryNosocial.customerId != null and tHaveSalaryNosocial.customerId.trim() != ''">
                AND a.Customer_id = #{tHaveSalaryNosocial.customerId}
            </if>
            <if test="tHaveSalaryNosocial.settleDomainId != null and tHaveSalaryNosocial.settleDomainId.trim() != ''">
                AND a.settle_domain_id = #{tHaveSalaryNosocial.settleDomainId}
            </if>
            <if test="tHaveSalaryNosocial.customerName != null and tHaveSalaryNosocial.customerName.trim() != ''">
                AND a.CUSTOMER_NAME  LIKE CONCAT('%', #{tHaveSalaryNosocial.customerName},'%')
            </if>
            <if test="tHaveSalaryNosocial.settlementOrganName != null and tHaveSalaryNosocial.settlementOrganName.trim() != ''">
                AND a.SETTLEMENT_ORGAN_NAME LIKE CONCAT('%',  #{tHaveSalaryNosocial.settlementOrganName},'%')
            </if>
            <if test="tHaveSalaryNosocial.settlementOrganNo != null and tHaveSalaryNosocial.settlementOrganNo.trim() != ''">
                AND a.SETTLEMENT_ORGAN_NO LIKE CONCAT('%',  #{tHaveSalaryNosocial.settlementOrganNo},'%')
            </if>
            <if test="tHaveSalaryNosocial.month != null">
76
                AND a.month  like concat('%', #{tHaveSalaryNosocial.month}, '%')
fangxinjiang's avatar
fangxinjiang committed
77
            </if>
78 79
            <if test="tHaveSalaryNosocial.createMonth != null">
                AND a.CREATE_MONTH = #{tHaveSalaryNosocial.createMonth}
fangxinjiang's avatar
fangxinjiang committed
80 81 82 83 84 85 86 87 88 89
            </if>
			<if test="tHaveSalaryNosocial.createName != null">
				AND a.CREATE_NAME = #{tHaveSalaryNosocial.createName}
			</if>
        </if>
    </sql>

    <!--tHaveSalaryNosocial简单分页查询-->
    <select id="getTHaveSalaryNosocialPage" resultMap="tHaveSalaryNosocialMap">
        SELECT
fangxinjiang's avatar
fangxinjiang committed
90
        a.id,
fangxinjiang's avatar
fangxinjiang committed
91 92 93 94 95 96
		a.employee_name,
		a.employee_id_card,
		a.CUSTOMER_NAME,
		a.SETTLEMENT_ORGAN_NAME,
		a.month,
		a.relay_salary,
fangxinjiang's avatar
fangxinjiang committed
97
		a.CREATE_NAME,
98
               a.CREATE_BY,
fangxinjiang's avatar
fangxinjiang committed
99
               a.feed_back,a.reason_type
fangxinjiang's avatar
fangxinjiang committed
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158
        FROM t_have_salary_nosocial a
        <include refid="querPage"/>
    </select>
    <select id="getByIdExport" resultType="com.yifu.cloud.plus.v1.yifu.salary.entity.THaveSalaryNosocial">
        SELECT
        <include refid="Base_Column_List"/>
        ,b.*
        FROM t_have_salary_nosocial a   left join t_feed_back b  on  a.ID=b.RELATE_ID
        where 1=1 and ((b.IGNORE_FLAG=1 and b.TYPE=1) or (b.id is null))
        <if test="array.length > 0">
            and a.id in
            <foreach collection="array" item="id" index="index" open="(" close=")" separator=",">
                #{id}
            </foreach>
        </if>
        <if test="array.length == 0">
            and 1=2
        </if>

    </select>
    <select id="getExport" resultType="com.yifu.cloud.plus.v1.yifu.salary.entity.THaveSalaryNosocial">
        SELECT
        <include refid="Base_Column_List"/>
        ,b.*
        FROM t_have_salary_nosocial a
       <include refid="querPage"/>
    </select>



    <select id="getByIdHandleExport" resultType="com.yifu.cloud.plus.v1.yifu.salary.vo.THaveSalaryNosocialHandleExportVo">
        SELECT
        <include refid="Base_Column_List"/>
        ,b.*
        FROM t_have_salary_nosocial a   left join t_feed_back b  on  a.ID=b.RELATE_ID
        where 1=1 and ((b.IGNORE_FLAG=1 and b.TYPE=1) or (b.id is null))
        <if test="array.length > 0">
            and a.id in
            <foreach collection="array" item="id" index="index" open="(" close=")" separator=",">
                #{id}
            </foreach>
        </if>
        <if test="array.length == 0">
            and a.id in ('')
        </if>

    </select>
    <select id="getHandleExport" resultType="com.yifu.cloud.plus.v1.yifu.salary.vo.THaveSalaryNosocialHandleExportVo">
        SELECT
        <include refid="Base_Column_List"/>
        ,b.*
        FROM t_have_salary_nosocial a
        left join t_feed_back b  on  a.ID=b.RELATE_ID
        <where>
            1=1 and ((b.IGNORE_FLAG=1 and b.TYPE=1) or (b.id is null))
            <if test="tHaveSalaryNosocial.reasonType != null and tHaveSalaryNosocial.reasonType.trim() != ''">
                AND b.REASON_TYPE = #{tHaveSalaryNosocial.reasonType}
            </if>
            <include refid="tHaveSalaryNosocial_where"/>
159 160 161
			<if test="tHaveSalaryNosocial.authSql != null and tHaveSalaryNosocial.authSql.trim() != ''">
				${tHaveSalaryNosocial.authSql}
			</if>
fangxinjiang's avatar
fangxinjiang committed
162 163 164 165 166 167 168 169 170 171
        </where>
    </select>



    <sql id="querPage">
        left join t_feed_back b  on  a.ID=b.RELATE_ID
        <where>
            1=1 and ((b.IGNORE_FLAG=1 and b.TYPE=1) or (b.id is null))
            <include refid="tHaveSalaryNosocial_where"/>
172 173 174
			<if test="tHaveSalaryNosocial.authSql != null and tHaveSalaryNosocial.authSql.trim() != ''">
				${tHaveSalaryNosocial.authSql}
			</if>
fangxinjiang's avatar
fangxinjiang committed
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214
            <!--数据权限判断-->
            <if test="settleDomainVos != null">
                <if test="settleDomainVos.size() > 0">
                    and a.SETTLE_DOMAIN_ID in
                    <foreach collection="settleDomainVos" item="param" index="index" open="(" close=")" separator=",">
                        #{param.id}
                    </foreach>
                </if>
                <if test="settleDomainVos.size() == 0">
                    and 1=2
                </if>
            </if>
            <if test="settleDomainVos == null">
                and 1=1
            </if>
        </where>
    </sql>


    <select id="getTHaveSalaryNosocialHandelPage" resultMap="tHaveSalaryNosocialMap">
        SELECT
        <include refid="Base_Column_List"/>
        ,b.*
        FROM t_have_salary_nosocial a
        left join t_feed_back b  on  a.ID=b.RELATE_ID
        <where>
            1=1 and ((b.IGNORE_FLAG=1 and b.TYPE=1) or (b.id is null))
            <if test="tHaveSalaryNosocial.reasonType != null ">
                AND b.REASON_TYPE = #{tHaveSalaryNosocial.reasonType}
            </if>
            <include refid="tHaveSalaryNosocial_where"/>
        </where>
    </select>

    <select id="getLastTHaveSalaryNosocial" resultType="com.yifu.cloud.plus.v1.yifu.salary.entity.THaveSalaryNosocial">
        SELECT
        <include refid="Base_Column_List"/>
        ,b.*
        FROM t_have_salary_nosocial a
        left join t_feed_back b  on  a.ID=b.RELATE_ID
215
        where  a.CREATE_MONTH in(#{lastOneMonth},#{lastTwoMonth},#{lastThreeMonth}) and b.REASON_TYPE is not null
fangxinjiang's avatar
fangxinjiang committed
216 217 218 219 220 221 222

    </select>
	<select id="noPageDiy" resultMap="haveSalaryNoSocialExportMap">
		SELECT
		<include refid="Base_Column_List"/>
		,b.*
		FROM t_have_salary_nosocial a
fangxinjiang's avatar
fangxinjiang committed
223 224 225 226
		left join t_feed_back b  on  a.ID=b.RELATE_ID
		<where>
			1=1 and ((b.IGNORE_FLAG=1 and b.TYPE=1) or (b.id is null))
			<include refid="export_where"/>
227
			<if test="tHaveSalaryNosocial != null">
228 229 230
				<if test="tHaveSalaryNosocial.authSql != null and tHaveSalaryNosocial.authSql.trim() != ''">
					${tHaveSalaryNosocial.authSql}
				</if>
231 232 233 234
				<if test="tHaveSalaryNosocial.limitStart != null">
					limit #{tHaveSalaryNosocial.limitStart},#{tHaveSalaryNosocial.limitEnd}
				</if>
			</if>
fangxinjiang's avatar
fangxinjiang committed
235
		</where>
fangxinjiang's avatar
fangxinjiang committed
236 237 238 239 240 241 242 243
	</select>
	<select id="noPageCountDiy"  resultType="java.lang.Integer">
		SELECT
		count(1)
		FROM t_have_salary_nosocial a
		left join t_feed_back b  on  a.ID=b.RELATE_ID
		<where>
			1=1 and ((b.IGNORE_FLAG=1 and b.TYPE=1) or (b.id is null))
244
			<include refid="export_where"/>
245 246 247
			<if test="tHaveSalaryNosocial.authSql != null and tHaveSalaryNosocial.authSql.trim() != ''">
				${tHaveSalaryNosocial.authSql}
			</if>
248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263
		</where>
	</select>
	<sql id="export_where">
		<include refid="tHaveSalaryNosocial_where"/>
		<if test="idsStr != null and idsStr.size > 0">
			AND a.ID in
			<foreach item="items" index="index" collection="idsStr" open="(" separator="," close=")">
				#{items}
			</foreach>
		</if>
		<!--数据权限判断-->
		<if test="settleDomainIds != null">
			<if test="settleDomainIds.size() > 0">
				and a.SETTLE_DOMAIN_ID in
				<foreach collection="settleDomainIds" item="param" index="index" open="(" close=")" separator=",">
					#{param}
fangxinjiang's avatar
fangxinjiang committed
264 265
				</foreach>
			</if>
fangxinjiang's avatar
fangxinjiang committed
266
			<if test="settleDomainIds.size() == 0">
267
				and 1=2
fangxinjiang's avatar
fangxinjiang committed
268
			</if>
269
		</if>
fangxinjiang's avatar
fangxinjiang committed
270
		<if test="settleDomainIds == null">
271 272 273 274 275 276
			and 1=1
		</if>
		<if test='sql != null and sql != ""'>
			and <![CDATA[sql]]>
		</if>
	</sql>
fangxinjiang's avatar
fangxinjiang committed
277
</mapper>