|  | @@ -3,9 +3,14 @@
 | 
	
		
			
				|  |  |  <mapper namespace="org.jeecg.modules.geke.usercontract.mapper.UserContractMapper">
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      <select id="lists" resultType="org.jeecg.modules.geke.usercontract.entity.UserContract">
 | 
	
		
			
				|  |  | -        select a.*,b.realname as 'realname' from geke_user_contract a left join sys_user b on a.user_id=b.id
 | 
	
		
			
				|  |  | -        where b.del_flag='0'
 | 
	
		
			
				|  |  | -        <if test="userContract.realname!=null and ''!=userContract.realname">
 | 
	
		
			
				|  |  | +        <if test="userContract.state==null or userContract.state=='' ">
 | 
	
		
			
				|  |  | +        select a.*from (
 | 
	
		
			
				|  |  | +            <!-- 已过期-->select a.*,b.realname as 'realname','已到期'as 'state',b.work_no  from geke_user_contract
 | 
	
		
			
				|  |  | +            a left join sys_user b on a.user_id=b.id
 | 
	
		
			
				|  |  | +            where b.
 | 
	
		
			
				|  |  | +            del_flag='0'
 | 
	
		
			
				|  |  | +            <if
 | 
	
		
			
				|  |  | +                    test="userContract.realname!=null and ''!=userContract.realname">
 | 
	
		
			
				|  |  |              and b.realname like concat(concat('%',#{userContract.realname}),'%')
 | 
	
		
			
				|  |  |          </if>
 | 
	
		
			
				|  |  |          <if test="userContract.contractType!=null and ''!=userContract.contractType">
 | 
	
	
		
			
				|  | @@ -17,6 +22,210 @@
 | 
	
		
			
				|  |  |                  #{id}
 | 
	
		
			
				|  |  |              </foreach>
 | 
	
		
			
				|  |  |          </if>
 | 
	
		
			
				|  |  | +          <if test="startDate!=null and ''!=startDate">
 | 
	
		
			
				|  |  | +              and date_format(a.end_date,'%Y-%m-%d')>=date_format(#{startDate},'%Y-%m-%d')
 | 
	
		
			
				|  |  | +          </if>
 | 
	
		
			
				|  |  | +            <if test="endDate!=null and ''!=endDate">
 | 
	
		
			
				|  |  | +                and date_format(a.end_date,'%Y-%m-%d')<=date_format(#{endDate},'%Y-%m-%d')
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +        <if test="dateTime!=null and ''!=dateTime">
 | 
	
		
			
				|  |  | +            and date_format(a.end_date,'%Y-%m-%d')<date_format(#{dateTime},'%Y-%m-%d')
 | 
	
		
			
				|  |  | +        </if>
 | 
	
		
			
				|  |  | +        <!--即将过期 -->
 | 
	
		
			
				|  |  | +            UNION ALL
 | 
	
		
			
				|  |  | +            select a.*,b.realname as 'realname','即将到期'as 'state',b.work_no  from geke_user_contract a
 | 
	
		
			
				|  |  | +            left join sys_user b on a.user_id=b.id
 | 
	
		
			
				|  |  | +            where b.del_flag='0'
 | 
	
		
			
				|  |  | +            <if test="userContract.realname!=null and ''!=userContract.realname">
 | 
	
		
			
				|  |  | +                and b.realname like concat(concat('%',#{userContract.realname}),'%')
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="userContract.contractType!=null and ''!=userContract.contractType">
 | 
	
		
			
				|  |  | +                and a.contract_type=#{userContract.contractType}
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="deptids!=null and deptids.size()>0">
 | 
	
		
			
				|  |  | +                and a.dept_id in
 | 
	
		
			
				|  |  | +                <foreach collection="deptids" index="index" item="id" open="(" separator="," close=")">
 | 
	
		
			
				|  |  | +                    #{id}
 | 
	
		
			
				|  |  | +                </foreach>
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="startDate!=null and ''!=startDate">
 | 
	
		
			
				|  |  | +                and date_format(a.end_date,'%Y-%m-%d')>=date_format(#{startDate},'%Y-%m-%d')
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="endDate!=null and ''!=endDate">
 | 
	
		
			
				|  |  | +                and date_format(a.end_date,'%Y-%m-%d')<=date_format(#{endDate},'%Y-%m-%d')
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="dateTime!=null and ''!=dateTime">
 | 
	
		
			
				|  |  | +                and date_format(a.end_date,'%Y-%m-%d')>=date_format(#{dateTime},'%Y-%m-%d')
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="oneMonth!=null and ''!=oneMonth">
 | 
	
		
			
				|  |  | +                and date_format(a.end_date,'%Y-%m-%d')<=date_format(#{oneMonth},'%Y-%m-%d')
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <!--临近过期 -->
 | 
	
		
			
				|  |  | +            UNION ALL
 | 
	
		
			
				|  |  | +            select a.*,b.realname as 'realname','临近到期'as 'state',b.work_no  from geke_user_contract a
 | 
	
		
			
				|  |  | +            left join sys_user b on a.user_id=b.id
 | 
	
		
			
				|  |  | +            where b.del_flag='0'
 | 
	
		
			
				|  |  | +            <if test="userContract.realname!=null and ''!=userContract.realname">
 | 
	
		
			
				|  |  | +                and b.realname like concat(concat('%',#{userContract.realname}),'%')
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="userContract.contractType!=null and ''!=userContract.contractType">
 | 
	
		
			
				|  |  | +                and a.contract_type=#{userContract.contractType}
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="deptids!=null and deptids.size()>0">
 | 
	
		
			
				|  |  | +                and a.dept_id in
 | 
	
		
			
				|  |  | +                <foreach collection="deptids" index="index" item="id" open="(" separator="," close=")">
 | 
	
		
			
				|  |  | +                    #{id}
 | 
	
		
			
				|  |  | +                </foreach>
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="startDate!=null and ''!=startDate">
 | 
	
		
			
				|  |  | +                and date_format(a.end_date,'%Y-%m-%d')>=date_format(#{startDate},'%Y-%m-%d')
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="endDate!=null and ''!=endDate">
 | 
	
		
			
				|  |  | +                and date_format(a.end_date,'%Y-%m-%d')<=date_format(#{endDate},'%Y-%m-%d')
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="dateTime!=null and ''!=dateTime">
 | 
	
		
			
				|  |  | +                and date_format(a.end_date,'%Y-%m-%d')>date_format(#{dateTime},'%Y-%m-%d')
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="twoMonth!=null and ''!=twoMonth">
 | 
	
		
			
				|  |  | +                and date_format(a.end_date,'%Y-%m-%d')<=date_format(#{twoMonth},'%Y-%m-%d')
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <!--正常 -->
 | 
	
		
			
				|  |  | +            UNION ALL
 | 
	
		
			
				|  |  | +            select a.*,b.realname as 'realname','正常'as 'state',b.work_no  from geke_user_contract a left
 | 
	
		
			
				|  |  | +            join sys_user b on a.user_id=b.id
 | 
	
		
			
				|  |  | +            where b.del_flag='0'
 | 
	
		
			
				|  |  | +            <if test="userContract.realname!=null and ''!=userContract.realname">
 | 
	
		
			
				|  |  | +                and b.realname like concat(concat('%',#{userContract.realname}),'%')
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="userContract.contractType!=null and ''!=userContract.contractType">
 | 
	
		
			
				|  |  | +                and a.contract_type=#{userContract.contractType}
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="deptids!=null and deptids.size()>0">
 | 
	
		
			
				|  |  | +                and a.dept_id in
 | 
	
		
			
				|  |  | +                <foreach collection="deptids" index="index" item="id" open="(" separator="," close=")">
 | 
	
		
			
				|  |  | +                    #{id}
 | 
	
		
			
				|  |  | +                </foreach>
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="startDate!=null and ''!=startDate">
 | 
	
		
			
				|  |  | +                and date_format(a.end_date,'%Y-%m-%d')>=date_format(#{startDate},'%Y-%m-%d')
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="endDate!=null and ''!=endDate">
 | 
	
		
			
				|  |  | +                and date_format(a.end_date,'%Y-%m-%d')<=date_format(#{endDate},'%Y-%m-%d')
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="twoMonth!=null and ''!=twoMonth">
 | 
	
		
			
				|  |  | +                and date_format(a.end_date,'%Y-%m-%d')>date_format(#{twoMonth},'%Y-%m-%d')
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            ) a
 | 
	
		
			
				|  |  | +        </if>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        <if test="userContract.state==0 or userContract.state=='0' ">
 | 
	
		
			
				|  |  | +            select a.*,b.realname as 'realname','正常'as 'state',b.work_no  from geke_user_contract a left join sys_user b on a.user_id=b.id
 | 
	
		
			
				|  |  | +            where b.del_flag='0'
 | 
	
		
			
				|  |  | +            <if test="userContract.realname!=null and ''!=userContract.realname">
 | 
	
		
			
				|  |  | +                and b.realname like concat(concat('%',#{userContract.realname}),'%')
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="userContract.contractType!=null and ''!=userContract.contractType">
 | 
	
		
			
				|  |  | +                and a.contract_type=#{userContract.contractType}
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="deptids!=null and deptids.size()>0">
 | 
	
		
			
				|  |  | +                and a.dept_id in
 | 
	
		
			
				|  |  | +                <foreach collection="deptids" index="index" item="id" open="(" separator="," close=")">
 | 
	
		
			
				|  |  | +                    #{id}
 | 
	
		
			
				|  |  | +                </foreach>
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="startDate!=null and ''!=startDate">
 | 
	
		
			
				|  |  | +                and date_format(a.end_date,'%Y-%m-%d')>=date_format(#{startDate},'%Y-%m-%d')
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="endDate!=null and ''!=endDate">
 | 
	
		
			
				|  |  | +                and date_format(a.end_date,'%Y-%m-%d')<=date_format(#{endDate},'%Y-%m-%d')
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="twoMonth!=null and ''!=twoMonth">
 | 
	
		
			
				|  |  | +                and date_format(a.end_date,'%Y-%m-%d')>date_format(#{twoMonth},'%Y-%m-%d')
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +        </if>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        <if test="userContract.state==1 or userContract.state=='1' ">
 | 
	
		
			
				|  |  | +            select a.*,b.realname as 'realname','已到期'as 'state',b.work_no  from geke_user_contract a left join sys_user b on a.user_id=b.id
 | 
	
		
			
				|  |  | +            where b.del_flag='0'
 | 
	
		
			
				|  |  | +            <if test="userContract.realname!=null and ''!=userContract.realname">
 | 
	
		
			
				|  |  | +                and b.realname like concat(concat('%',#{userContract.realname}),'%')
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="userContract.contractType!=null and ''!=userContract.contractType">
 | 
	
		
			
				|  |  | +                and a.contract_type=#{userContract.contractType}
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="deptids!=null and deptids.size()>0">
 | 
	
		
			
				|  |  | +                and a.dept_id in
 | 
	
		
			
				|  |  | +                <foreach collection="deptids" index="index" item="id" open="(" separator="," close=")">
 | 
	
		
			
				|  |  | +                    #{id}
 | 
	
		
			
				|  |  | +                </foreach>
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="startDate!=null and ''!=startDate">
 | 
	
		
			
				|  |  | +                and date_format(a.end_date,'%Y-%m-%d')>=date_format(#{startDate},'%Y-%m-%d')
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="endDate!=null and ''!=endDate">
 | 
	
		
			
				|  |  | +                and date_format(a.end_date,'%Y-%m-%d')<=date_format(#{endDate},'%Y-%m-%d')
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="dateTime!=null and ''!=dateTime">
 | 
	
		
			
				|  |  | +                and date_format(a.end_date,'%Y-%m-%d')<date_format(#{dateTime},'%Y-%m-%d')
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +        </if>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        <if test="userContract.state==2 or userContract.state=='2' ">
 | 
	
		
			
				|  |  | +            select a.*,b.realname as 'realname','临近到期'as 'state',b.work_no  from geke_user_contract a left join sys_user b on a.user_id=b.id
 | 
	
		
			
				|  |  | +            where b.del_flag='0'
 | 
	
		
			
				|  |  | +            <if test="userContract.realname!=null and ''!=userContract.realname">
 | 
	
		
			
				|  |  | +                and b.realname like concat(concat('%',#{userContract.realname}),'%')
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="userContract.contractType!=null and ''!=userContract.contractType">
 | 
	
		
			
				|  |  | +                and a.contract_type=#{userContract.contractType}
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="deptids!=null and deptids.size()>0">
 | 
	
		
			
				|  |  | +                and a.dept_id in
 | 
	
		
			
				|  |  | +                <foreach collection="deptids" index="index" item="id" open="(" separator="," close=")">
 | 
	
		
			
				|  |  | +                    #{id}
 | 
	
		
			
				|  |  | +                </foreach>
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="startDate!=null and ''!=startDate">
 | 
	
		
			
				|  |  | +                and date_format(a.end_date,'%Y-%m-%d')>=date_format(#{startDate},'%Y-%m-%d')
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="endDate!=null and ''!=endDate">
 | 
	
		
			
				|  |  | +                and date_format(a.end_date,'%Y-%m-%d')<=date_format(#{endDate},'%Y-%m-%d')
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="dateTime!=null and ''!=dateTime">
 | 
	
		
			
				|  |  | +                and date_format(a.end_date,'%Y-%m-%d')>date_format(#{dateTime},'%Y-%m-%d')
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="twoMonth!=null and ''!=twoMonth">
 | 
	
		
			
				|  |  | +                and date_format(a.end_date,'%Y-%m-%d')<=date_format(#{twoMonth},'%Y-%m-%d')
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +        </if>
 | 
	
		
			
				|  |  | +        <if test="userContract.state==3 or userContract.state=='3' ">
 | 
	
		
			
				|  |  | +            select a.*,b.realname as 'realname','即将到期'as 'state',b.work_no  from geke_user_contract a left join sys_user b on a.user_id=b.id
 | 
	
		
			
				|  |  | +            where b.del_flag='0'
 | 
	
		
			
				|  |  | +            <if test="userContract.realname!=null and ''!=userContract.realname">
 | 
	
		
			
				|  |  | +                and b.realname like concat(concat('%',#{userContract.realname}),'%')
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="userContract.contractType!=null and ''!=userContract.contractType">
 | 
	
		
			
				|  |  | +                and a.contract_type=#{userContract.contractType}
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="deptids!=null and deptids.size()>0">
 | 
	
		
			
				|  |  | +                and a.dept_id in
 | 
	
		
			
				|  |  | +                <foreach collection="deptids" index="index" item="id" open="(" separator="," close=")">
 | 
	
		
			
				|  |  | +                    #{id}
 | 
	
		
			
				|  |  | +                </foreach>
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="startDate!=null and ''!=startDate">
 | 
	
		
			
				|  |  | +                and date_format(a.end_date,'%Y-%m-%d')>=date_format(#{startDate},'%Y-%m-%d')
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="endDate!=null and ''!=endDate">
 | 
	
		
			
				|  |  | +                and date_format(a.end_date,'%Y-%m-%d')<=date_format(#{endDate},'%Y-%m-%d')
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="dateTime!=null and ''!=dateTime">
 | 
	
		
			
				|  |  | +                and date_format(a.end_date,'%Y-%m-%d')>=date_format(#{dateTime},'%Y-%m-%d')
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="oneMonth!=null and ''!=oneMonth">
 | 
	
		
			
				|  |  | +                and date_format(a.end_date,'%Y-%m-%d')<=date_format(#{oneMonth},'%Y-%m-%d')
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +        </if>
 | 
	
		
			
				|  |  |      </select>
 | 
	
		
			
				|  |  |      <select id="list" resultType="org.jeecg.modules.geke.usercontract.entity.UserContract">
 | 
	
		
			
				|  |  |          select *from geke_user_contract where 1=1
 |