TIncomeMapper.xml 8.38 KB
Newer Older
hongguangwu's avatar
hongguangwu committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
<?xml version="1.0" encoding="UTF-8"?>

<!--
  ~
  ~      Copyright (c) 2018-2025, lengleng All rights reserved.
  ~
  ~  Redistribution and use in source and binary forms, with or without
  ~  modification, are permitted provided that the following conditions are met:
  ~
  ~ Redistributions of source code must retain the above copyright notice,
  ~  this list of conditions and the following disclaimer.
  ~  Redistributions in binary form must reproduce the above copyright
  ~  notice, this list of conditions and the following disclaimer in the
  ~  documentation and/or other materials provided with the distribution.
  ~  Neither the name of the yifu4cloud.com developer nor the names of its
  ~  contributors may be used to endorse or promote products derived from
  ~  this software without specific prior written permission.
  ~  Author: lengleng (wangiegie@gmail.com)
  ~
  -->

<!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.social.mapper.TIncomeMapper">

	<resultMap id="tIncomeMap" type="com.yifu.cloud.plus.v1.yifu.social.entity.TIncome">
		<id property="id" column="ID"/>
		<result property="empName" column="EMP_NAME"/>
		<result property="empIdcard" column="EMP_IDCARD"/>
		<result property="unitId" column="UNIT_ID"/>
		<result property="unitName" column="UNIT_NAME"/>
		<result property="unitNo" column="UNIT_NO"/>
		<result property="deptId" column="DEPT_ID"/>
		<result property="deptName" column="DEPT_NAME"/>
		<result property="deptNo" column="DEPT_NO"/>
		<result property="feeType" column="FEE_TYPE"/>
		<result property="feeMode" column="FEE_MODE"/>
		<result property="charges" column="CHARGES"/>
		<result property="sourceType" column="SOURCE_TYPE"/>
		<result property="money" column="MONEY"/>
		<result property="createMonth" column="CREATE_MONTH"/>
		<result property="payMonth" column="PAY_MONTH"/>
		<result property="createTime" column="CREATE_TIME"/>
		<result property="dataCreateMonth" column="DATA_CREATE_MONTH"/>
hongguangwu's avatar
hongguangwu committed
45
		<result property="sendStatus" column="SEND_STATUS"/>
hongguangwu's avatar
hongguangwu committed
46
		<result property="redData" column="RED_DATA"/>
hongguangwu's avatar
hongguangwu committed
47 48 49
		<result property="sendStatus" column="SEND_STATUS"/>
		<result property="sendTime" column="SEND_TIME"/>
		<result property="sendMonth" column="SEND_MONTH"/>
huyuchen's avatar
huyuchen committed
50
		<result property="ekpId" column="EKP_ID"/>
hongguangwu's avatar
hongguangwu committed
51
	</resultMap>
52 53 54 55 56 57 58 59 60 61 62 63 64 65
	<resultMap id="incomeExportMap" type="com.yifu.cloud.plus.v1.yifu.social.vo.IncomeExportVo">
		<result property="empName" column="EMP_NAME"/>
		<result property="empIdcard" column="EMP_IDCARD"/>
		<result property="unitName" column="UNIT_NAME"/>
		<result property="deptName" column="DEPT_NAME"/>
		<result property="deptNo" column="DEPT_NO"/>
		<result property="feeType" column="FEE_TYPE"/>
		<result property="feeMode" column="FEE_MODE"/>
		<result property="charges" column="CHARGES"/>
		<result property="sourceType" column="SOURCE_TYPE"/>
		<result property="money" column="MONEY"/>
		<result property="createMonth" column="CREATE_MONTH"/>
		<result property="payMonth" column="PAY_MONTH"/>
		<result property="createTime" column="CREATE_TIME"/>
hongguangwu's avatar
hongguangwu committed
66
		<result property="sendStatus" column="SEND_STATUS"/>
67
	</resultMap>
hongguangwu's avatar
hongguangwu committed
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
	<sql id="Base_Column_List">
		a.ID,
		a.EMP_NAME,
		a.EMP_IDCARD,
		a.UNIT_ID,
		a.UNIT_NAME,
		a.UNIT_NO,
		a.DEPT_ID,
		a.DEPT_NAME,
		a.DEPT_NO,
		a.FEE_TYPE,
		a.FEE_MODE,
		a.CHARGES,
		a.SOURCE_TYPE,
		a.MONEY,
		a.CREATE_MONTH,
		a.PAY_MONTH,
		a.CREATE_TIME,
		a.DATA_CREATE_MONTH,
hongguangwu's avatar
hongguangwu committed
87 88 89 90
		a.RED_DATA,
		a.SEND_STATUS,
		a.SEND_TIME,
		a.SEND_MONTH
hongguangwu's avatar
hongguangwu committed
91 92 93 94 95 96 97 98 99 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
	</sql>
	<sql id="tIncome_where">
		<if test="tIncome != null">
			<if test="tIncome.id != null and tIncome.id.trim() != ''">
				AND a.ID = #{tIncome.id}
			</if>
			<if test="tIncome.empName != null and tIncome.empName.trim() != ''">
				AND a.EMP_NAME = #{tIncome.empName}
			</if>
			<if test="tIncome.empIdcard != null and tIncome.empIdcard.trim() != ''">
				AND a.EMP_IDCARD = #{tIncome.empIdcard}
			</if>
			<if test="tIncome.unitId != null and tIncome.unitId.trim() != ''">
				AND a.UNIT_ID = #{tIncome.unitId}
			</if>
			<if test="tIncome.unitName != null and tIncome.unitName.trim() != ''">
				AND a.UNIT_NAME = #{tIncome.unitName}
			</if>
			<if test="tIncome.unitNo != null and tIncome.unitNo.trim() != ''">
				AND a.UNIT_NO = #{tIncome.unitNo}
			</if>
			<if test="tIncome.deptId != null and tIncome.deptId.trim() != ''">
				AND a.DEPT_ID = #{tIncome.deptId}
			</if>
			<if test="tIncome.deptName != null and tIncome.deptName.trim() != ''">
				AND a.DEPT_NAME = #{tIncome.deptName}
			</if>
			<if test="tIncome.deptNo != null and tIncome.deptNo.trim() != ''">
				AND a.DEPT_NO = #{tIncome.deptNo}
			</if>
			<if test="tIncome.feeType != null and tIncome.feeType.trim() != ''">
				AND a.FEE_TYPE = #{tIncome.feeType}
			</if>
			<if test="tIncome.feeMode != null and tIncome.feeMode.trim() != ''">
				AND a.FEE_MODE = #{tIncome.feeMode}
			</if>
			<if test="tIncome.charges != null and tIncome.charges.trim() != ''">
				AND a.CHARGES = #{tIncome.charges}
			</if>
			<if test="tIncome.sourceType != null and tIncome.sourceType.trim() != ''">
				AND a.SOURCE_TYPE = #{tIncome.sourceType}
			</if>
			<if test="tIncome.money != null">
				AND a.MONEY = #{tIncome.money}
			</if>
			<if test="tIncome.createMonth != null and tIncome.createMonth.trim() != ''">
				AND a.CREATE_MONTH = #{tIncome.createMonth}
			</if>
			<if test="tIncome.payMonth != null and tIncome.payMonth.trim() != ''">
				AND a.PAY_MONTH = #{tIncome.payMonth}
			</if>
			<if test="tIncome.dataCreateMonth != null and tIncome.dataCreateMonth.trim() != ''">
				AND a.DATA_CREATE_MONTH = #{tIncome.dataCreateMonth}
			</if>
hongguangwu's avatar
hongguangwu committed
145 146
			<if test="tIncome.sendStatus != null and tIncome.sendStatus.trim() != ''">
				AND a.SEND_STATUS = #{tIncome.sendStatus}
hongguangwu's avatar
hongguangwu committed
147
			</if>
hongguangwu's avatar
hongguangwu committed
148 149 150
			<if test="tIncome.redData != null and tIncome.redData.trim() != ''">
				AND a.RED_DATA = #{tIncome.redData}
			</if>
huyuchen's avatar
huyuchen committed
151 152 153
			<if test="tIncome.authSql != null and tIncome.authSql.trim() != ''">
				${tIncome.authSql}
			</if>
hongguangwu's avatar
hongguangwu committed
154 155 156 157 158 159 160 161 162 163
		</if>
	</sql>
	<!--tIncome简单分页查询-->
	<select id="getTIncomePage" resultMap="tIncomeMap">
		SELECT
		<include refid="Base_Column_List"/>
		FROM t_income a
		<where>
			1=1
			<include refid="tIncome_where"/>
huyuchen's avatar
huyuchen committed
164
			group by a.id
165
			order by a.CREATE_TIME DESC
hongguangwu's avatar
hongguangwu committed
166 167
		</where>
	</select>
168 169 170 171 172 173 174 175 176

	<!--noPageDiy查询-->
	<select id="noPageDiy" resultMap="incomeExportMap">
		SELECT
		<include refid="Base_Column_List"/>
		FROM t_income a
		<where>
			1=1
			<include refid="export_sql"/>
huyuchen's avatar
huyuchen committed
177
			group by a.id
fangxinjiang's avatar
fangxinjiang committed
178
			order by a.CREATE_TIME DESC
179 180 181 182 183 184 185 186 187 188 189
			<if test="tIncome != null">
				<if test="tIncome.limitStart != null">
					limit #{tIncome.limitStart},#{tIncome.limitEnd}
				</if>
			</if>
		</where>
	</select>

	<!--noPageCountDiy查询-->
	<select id="noPageCountDiy" resultType="java.lang.Integer">
		SELECT
huyuchen's avatar
huyuchen committed
190 191 192
		count(1) from(
		SELECT
		a.id
193 194 195 196
		FROM t_income a
		<where>
			1=1
			<include refid="export_sql"/>
huyuchen's avatar
huyuchen committed
197
			group by a.id
198
		</where>
huyuchen's avatar
huyuchen committed
199
		) b
200
	</select>
hongguangwu's avatar
hongguangwu committed
201 202 203 204 205 206 207 208 209 210 211

	<!-- 列表 -->
	<select id="getTIncomeList" resultMap="tIncomeMap">
		SELECT
		<include refid="Base_Column_List"/>
		FROM t_income a
		<where>
			1=1
			<include refid="tIncome_where"/>
		</where>
	</select>
212 213 214 215 216 217 218 219 220
	<sql id="export_sql">
		<include refid="tIncome_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>
	</sql>
huyuchen's avatar
huyuchen committed
221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258

	<update id="updateIncomeById" parameterType="java.util.List">
		update t_income
		<trim prefix="set" suffixOverrides=",">
			<trim prefix="SEND_STATUS =case" suffix="end,">
				<foreach collection="list" item="i" index="index">
					<if test="i.sendStatus!=null">
						when ID=#{i.id} then #{i.sendStatus}
					</if>
				</foreach>
			</trim>
			<trim prefix="SEND_TIME =case" suffix="end,">
				<foreach collection="list" item="i" index="index">
					<if test="i.sendTime!=null">
						when ID=#{i.id} then #{i.sendTime}
					</if>
				</foreach>
			</trim>
			<trim prefix="SEND_MONTH =case" suffix="end,">
				<foreach collection="list" item="i" index="index">
					<if test="i.sendMonth!=null">
						when ID=#{i.id} then #{i.sendMonth}
					</if>
				</foreach>
			</trim>
			<trim prefix="EKP_ID =case" suffix="end,">
				<foreach collection="list" item="i" index="index">
					<if test="i.ekpId!=null">
						when ID=#{i.id} then #{i.ekpId}
					</if>
				</foreach>
			</trim>
		</trim>
		where
		<foreach collection="list" separator="or" item="i" index="index" >
			ID=#{i.id}
		</foreach>
	</update>
hongguangwu's avatar
hongguangwu committed
259
</mapper>