MonitorCompanyNewMapper.xml 10.6 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.ruoyi.web.controller.monitorCompanyNew.mapper.MonitorCompanyNewMapper">
    
    <resultMap type="MonitorCompanyNew" id="MonitorCompanyNewResult">
        <result property="id"    column="id"    />
        <result property="userId"    column="userId"    />
        <result property="userType"    column="user_type"    />
        <result property="deptId"    column="dept_id"    />
        <result property="groupId"    column="group_id"    />
        <result property="companyId"    column="company_id"    />
        <result property="ename"    column="ename"    />
        <result property="lrName"    column="lr_name"    />
        <result property="regStatus"    column="reg_status"    />
        <result property="regCapital"    column="reg_capital"    />
        <result property="establishDate"    column="establish_date"    />
        <result property="creditCode"    column="credit_code"    />
        <result property="base"    column="base"    />
        <result property="monitorStatus"    column="monitor_status"    />
        <result property="status"    column="status"    />
        <result property="createTime"    column="createTime"    />
        <result property="updateTime"    column="updateTime"    />
    </resultMap>
	
	<sql id="selectMonitorCompanyNewVo">
        select id, userId, user_type, dept_id, group_id, company_id, ename, lr_name, reg_status, reg_capital, establish_date, credit_code, base, monitor_status, status, createTime, updateTime from monitor_company_new
    </sql>
	
    <select id="selectMonitorCompanyNewList" parameterType="MonitorCompanyNew" resultMap="MonitorCompanyNewResult">
        <include refid="selectMonitorCompanyNewVo"/>
        <where>  
            <if test="id != null "> and id = #{id}</if>
            <if test="userId != null  and userId != '' "> and userId = #{userId}</if>
            <if test="userType != null  and userType != '' "> and user_type = #{userType}</if>
            <if test="deptId != null  and deptId != '' "> and dept_id = #{deptId}</if>
            <if test="groupId != null "> and group_id = #{groupId}</if>
            <if test="companyId != null  and companyId != '' "> and company_id = #{companyId}</if>
            <if test="ename != null  and ename != '' "> and ename like concat('%', #{ename}, '%')</if>
            <if test="lrName != null  and lrName != '' "> and lr_name = #{lrName}</if>
            <if test="regStatus != null  and regStatus != '' "> and reg_status like concat('%', #{regStatus}, '%')</if>
            <if test="regCapital != null  and regCapital != '' "> and reg_capital = #{regCapital}</if>
            <if test="establishDate != null  and establishDate != '' "> and establish_date = #{establishDate}</if>
            <if test="creditCode != null  and creditCode != '' "> and credit_code = #{creditCode}</if>
            <if test="base != null  and base != '' "> and base = #{base}</if>
            <if test="monitorStatus != null  and monitorStatus != '' "> and monitor_status = #{monitorStatus}</if>
            <if test="status != null  and status != '' "> and status = #{status}</if>
            <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
                AND date_format(createTime,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
            </if>
            <if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
                AND date_format(createTime,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
            </if>
            <if test="updateTime != null "> and updateTime = #{updateTime}</if>
        </where>
    </select>
    
    <select id="selectMonitorCompanyNewById" parameterType="Integer" resultMap="MonitorCompanyNewResult">
        <include refid="selectMonitorCompanyNewVo"/>
        where id = #{id}
    </select>
    <select id="selectMonitorCompanyList"
            resultType="com.ruoyi.web.controller.monitorCompanyNew.domain.MonitorCompanyNew" resultMap="MonitorCompanyNewResult">
        <include refid="selectMonitorCompanyNewVo"/>
        <where>
            <if test="id != null "> and id = #{id}</if>
            <if test="userId != null  and userId != '' "> and userId = #{userId}</if>
            <if test="ename != null  and ename != '' ">
                <bind name="ename" value=" '%'+ename+'%'"/>
                and ename like #{ename}
            </if>
            <if test="groupId != null "> and group_id = #{groupId}</if>
            <if test="companyId != null and companyId !='' ">and company_id = #{companyId}</if>
            <if test="lrName != null  and lrName != '' "> and lr_name = #{lrName}</if>
            <if test="regStatus != null  and regStatus != '' "> and reg_status = #{regStatus}</if>
            <if test="regCapital != null  and regCapital != '' "> and reg_capital = #{regCapital}</if>
            <if test="establishDate != null  and establishDate != '' "> and establish_date = #{establishDate}</if>
            <if test="creditCode != null  and creditCode != '' "> and credit_code = #{creditCode}</if>
            <if test="monitorStatus != null  and monitorStatus != '' "> and monitor_status = #{monitorStatus}</if>
            <if test="status != null  and status != '' "> and status = #{status}</if>
            <if test="createTime != null "> and createTime = #{createTime}</if>
            <if test="updateTime != null "> and updateTime = #{updateTime}</if>
        </where>
    </select>
    <select id="selectMonitorByUserId"
            resultType="com.ruoyi.web.controller.monitorCompanyNew.domain.MonitorCompanyNew" resultMap="MonitorCompanyNewResult">
        SELECT
            *
        FROM
            monitor_company_new
        WHERE
            userId = #{userId} AND monitor_status = '0'
    </select>

    <insert id="insertMonitorCompanyNew" parameterType="MonitorCompanyNew" useGeneratedKeys="true" keyProperty="id">
        insert into monitor_company_new
		<trim prefix="(" suffix=")" suffixOverrides=",">
			<if test="userId != null  and userId != ''  ">userId,</if>
			<if test="userType != null  and userType != ''  ">user_type,</if>
			<if test="deptId != null  and deptId != ''  ">dept_id,</if>
			<if test="groupId != null  ">group_id,</if>
			<if test="companyId != null  and companyId != ''  ">company_id,</if>
			<if test="ename != null  and ename != ''  ">ename,</if>
			<if test="lrName != null  and lrName != ''  ">lr_name,</if>
			<if test="regStatus != null  and regStatus != ''  ">reg_status,</if>
			<if test="regCapital != null  and regCapital != ''  ">reg_capital,</if>
			<if test="establishDate != null  and establishDate != ''  ">establish_date,</if>
			<if test="creditCode != null  and creditCode != ''  ">credit_code,</if>
			<if test="base != null  and base != ''  ">base,</if>
			<if test="monitorStatus != null  and monitorStatus != ''  ">monitor_status,</if>
			<if test="status != null  and status != ''  ">status,</if>
			<if test="createTime != null  ">createTime,</if>
			<if test="updateTime != null  ">updateTime,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
			<if test="userId != null  and userId != ''  ">#{userId},</if>
			<if test="userType != null  and userType != ''  ">#{userType},</if>
			<if test="deptId != null  and deptId != ''  ">#{deptId},</if>
			<if test="groupId != null  ">#{groupId},</if>
			<if test="companyId != null  and companyId != ''  ">#{companyId},</if>
			<if test="ename != null  and ename != ''  ">#{ename},</if>
			<if test="lrName != null  and lrName != ''  ">#{lrName},</if>
			<if test="regStatus != null  and regStatus != ''  ">#{regStatus},</if>
			<if test="regCapital != null  and regCapital != ''  ">#{regCapital},</if>
			<if test="establishDate != null  and establishDate != ''  ">#{establishDate},</if>
			<if test="creditCode != null  and creditCode != ''  ">#{creditCode},</if>
			<if test="base != null  and base != ''  ">#{base},</if>
			<if test="monitorStatus != null  and monitorStatus != ''  ">#{monitorStatus},</if>
			<if test="status != null  and status != ''  ">#{status},</if>
			<if test="createTime != null  ">#{createTime},</if>
			<if test="updateTime != null  ">#{updateTime},</if>
         </trim>
    </insert>

    <update id="updateMonitorCompanyNew" parameterType="MonitorCompanyNew">
        update monitor_company_new
        <trim prefix="SET" suffixOverrides=",">
            <if test="userId != null  and userId != ''  ">userId = #{userId},</if>
            <if test="userType != null  and userType != ''  ">user_type = #{userType},</if>
            <if test="deptId != null  and deptId != ''  ">dept_id = #{deptId},</if>
            <if test="groupId != null  ">group_id = #{groupId},</if>
            <if test="companyId != null  and companyId != ''  ">company_id = #{companyId},</if>
            <if test="ename != null  and ename != ''  ">ename = #{ename},</if>
            <if test="lrName != null  and lrName != ''  ">lr_name = #{lrName},</if>
            <if test="regStatus != null  and regStatus != ''  ">reg_status = #{regStatus},</if>
            <if test="regCapital != null  and regCapital != ''  ">reg_capital = #{regCapital},</if>
            <if test="establishDate != null  and establishDate != ''  ">establish_date = #{establishDate},</if>
            <if test="creditCode != null  and creditCode != ''  ">credit_code = #{creditCode},</if>
            <if test="base != null  and base != ''  ">base = #{base},</if>
            <if test="monitorStatus != null  and monitorStatus != ''  ">monitor_status = #{monitorStatus},</if>
            <if test="status != null  and status != ''  ">status = #{status},</if>
            <if test="createTime != null  ">createTime = #{createTime},</if>
            <if test="updateTime != null  ">updateTime = #{updateTime},</if>
        </trim>
        where id = #{id}
    </update>
    <update id="updateMonitorCode">
        update monitor_company_new set monitor_status='0',updateTime=now() where userId=#{userId} and ename = #{ename}
    </update>
    <update id="updateMonitorStatusForCode" parameterType="String">
        update monitor_company_new set monitor_status='1',updateTime=now() where userId= #{userId} and credit_code = #{code}
    </update>

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