<?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.chinaweal.aiccs.aiccs.punishment.mapper.PersonEntMapper">
    <resultMap id="BaseResultMap" type="com.chinaweal.aiccs.aiccs.punishment.entity.dto.PersonEntDto">
        <result column="ELID" property="elid" />
        <result column="PRIPID" property="pripid" />
        <result column="ENTNAME" property="entname" />
        <result column="REGNO" property="regno" />
        <result column="UNISCID" property="uniscid" />
        <result column="LOCKREASON" property="lockreason" />
        <result column="LOCKUSERNAME" property="lockusername" />
        <result column="LOCKUSERID" property="lockuserid" />
        <result column="LOCKUSERDEPTID" property="lockuserdeptid" />
        <result column="LOCKUSERUNITID" property="lockuserunitid" />
        <result column="LOCKSTARTDATE" property="lockstartdate" />
        <result column="LOCKTIME" property="lockTime" />
        <result column="UNLOCKTIME" property="unlockTime" />
        <result column="LOCKENDDATE" property="lockenddate" />
        <result column="UNLUSERNAME" property="unlusername" />
        <result column="UNLUSERID" property="unluserid" />
        <result column="ULDEPTID" property="uldeptid" />
        <result column="ULUNITID" property="ulunitid" />
        <result column="UNLDATE" property="unldate" />
        <result column="LOCKTYPE" property="locktype" />
        <result column="MEASURE" property="measure" />
        <result column="LOCKSTATE" property="lockstate" />
        <result column="INPUTDATE" property="inputdate" />
        <result column="ULOCKREASON" property="unlockreason" />
        <result column="LAUPTIME" property="laupTime" />
        <result column="state" property="state" />
        <result column="FILEPATH" property="filepath" />
        <result column="FILENAME" property="filename" />
        <result column="punishFrom" property="punishFrom" />
        <result column="tflockid" property="tflockid" />
        <result column="warningcontent" property="warningcontent" />

        <result column="PLID" property="plid" />
        <result column="IDCARDNO" property="idcardno" />
        <result column="PERNAME" property="pername" />
        <result column="ENTNAME" property="entname" />
        <result column="REGNO" property="regno" />
        <result column="DUTY" property="duty" />
        <result column="ILLEGALITEM" property="illegalitem" />
        <result column="INVOLVEDATE" property="involvedate" />
        <result column="INVOLVEDMONEY" property="involvedmoney" />
        <result column="LOCKREASON" property="lockreason" />
        <result column="LOCKSTARTDATE" property="lockstartdate" />
        <result column="LOCKENDDATE" property="lockenddate" />
        <result column="LOCKUSERNAME" property="lockusername" />
        <result column="LOCKUSERID" property="lockuserid" />
        <result column="LOCKUSERDEPTID" property="lockuserdeptid" />
        <result column="LOCKUSERUNITID" property="lockuserunitid" />
        <result column="UNLOCKUSERNAME" property="unlockusername" />
        <result column="UNLOCKUSERID" property="unlockuserid" />
        <result column="ULDEPTID" property="uldeptid" />
        <result column="ULUNITID" property="ulunitid" />
        <result column="UNLDATE" property="unldate" />
        <result column="LOCKLEVEL" property="locklevel" />
        <result column="LOCKSTATE" property="lockstate" />
        <result column="INPUTDATE" property="inputdate" />
        <result column="RLOCKUSERNAME" property="rlockusername" />
        <result column="RLOCKUSERID" property="rlockuserid" />
        <result column="RLOCKUSERUNITID" property="rlockuserunitid" />
        <result column="RLOCKUSERDEPID" property="rlockuserdepid" />
        <result column="RLOCKDATE" property="rlockdate" />
        <result column="ULOCKSEASON" property="ulockseason" />
        <result column="ENTTYPE" property="enttype" />
        <result column="REGNOID" property="regnoid" />
        <result column="LOCKDUTY" property="lockduty" />
        <result column="WHITELOCKTYPE" property="whitelocktype" />

    </resultMap>
    <select id="queryEnt" resultMap="BaseResultMap">
        SELECT
        e.ELID,
        e.PRIPID,
        e.UNISCID,
        e.ENTNAME,
        e.REGNO,
        e.LOCKREASON,
        e.LOCKUSERNAME,
        e.LOCKUSERID,
        e.LOCKUSERDEPTID,
        e.LOCKUSERUNITID,
        e.LOCKSTARTDATE,
        e.UNLUSERNAME,
        e.LOCKENDDATE,
        e.UNLUSERID,
        e.ULDEPTID,
        e.ULUNITID,
        e.UNLDATE,
        e.LOCKTIME,
        e.LOCKTYPE,
        e.LOCKSTATE,
        e.INPUTDATE,
        e.laupTime,
        e.FILEPATH,
        e.FILENAME,
        e.ULOCKREASON,
        e.punishFrom,
        e.state,
        e.MEASURE,
        e.UNLOCKTIME,
        e.ulockspecificreason,
        e.ulsrcode,
        e.representative,
        e.regorg,
        e.cerno,
        e.certype,
        e.isdelete,
        e.department,
        e.tflockid,
        e.warningcontent
        FROM entlock e
        where  e.state = '0'
        <if test="entname!=null">
            and ENTNAME like #{entname}
        </if>
        <if test="locktype!=null">
            and LOCKTYPE=#{locktype}
        </if>
        <if test="searchCode!=null ">
            and  REGNO = #{searchCode} or UNISCID = #{searchCode}
        </if>
        and regorg like #{regorg}
    </select>
    <select id="queryPerson" resultMap="BaseResultMap">
        SELECT
        p.PLID,
        p.IDCARDNO,
        p.PERNAME,
        p.tflockid,
        p.WHITELOCKTYPE,
        p.LOCKDUTY,
        p.REGNOID,
        p.ENTTYPE,
        p.ULOCKSEASON,
        p.RLOCKDATE,
        p.RLOCKUSERDEPID,
        p.RLOCKUSERUNITID,
        p.RLOCKUSERID,
        p.RLOCKUSERNAME,
        p.INPUTDATE,
        p.LOCKLEVEL,
        p.LOCKSTATE,
        p.UNLDATE,
        p.ULUNITID,
        p.ULDEPTID,
        p.UNLOCKUSERID,
        p.UNLOCKUSERNAME,
        p.LOCKUSERUNITID,
        p.LOCKUSERID,
        p.LOCKUSERDEPTID,
        p.LOCKUSERNAME,
        p.LOCKENDDATE,
        p.LOCKSTARTDATE,
        p.LOCKREASON,
        p.INVOLVEDMONEY,
        p.ILLEGALITEM,
        p.INVOLVEDATE,
        p.DUTY,
        p.REGNO,
        p.ENTNAME
        FROM personlock p
        left join e_baseinfo e on p.PERNAME=e.LEREP
        WHERE
        p.lockstate = '1'
        <if test="entname!=null">
            and p.ENTNAME like #{entname}
        </if>
        <if test="searchCode !=null">
            and p.REGNO = #{searchCode}
        </if>
        AND e.REGORG like #{regorg}
    </select>

    <select id="queryEntCjjsByPage" resultMap="BaseResultMap">
        SELECT
        e.ELID,
        e.PRIPID,
        e.UNISCID,
        e.ENTNAME,
        e.REGNO,
        e.LOCKREASON,
        e.LOCKUSERNAME,
        e.LOCKUSERID,
        e.LOCKUSERDEPTID,
        e.LOCKUSERUNITID,
        e.LOCKSTARTDATE,
        e.UNLUSERNAME,
        e.LOCKENDDATE,
        e.UNLUSERID,
        e.ULDEPTID,
        e.ULUNITID,
        e.UNLDATE,
        e.LOCKTIME,
        e.LOCKTYPE,
        e.LOCKSTATE,
        e.INPUTDATE,
        e.laupTime,
        e.FILEPATH,
        e.FILENAME,
        e.ULOCKREASON,
        e.punishFrom,
        e.state,
        e.MEASURE,
        e.UNLOCKTIME,
        e.ulockspecificreason,
        e.ulsrcode,
        e.representative,
        e.regorg,
        e.cerno,
        e.certype,
        e.isdelete,
        e.department,
        e.tflockid,
        e.warningcontent
        FROM entlock e
        where  e.state = '0'
        <if test="entname!=null">
            and ENTNAME like #{entname}
        </if>
        <if test="locktype!=null">
            and LOCKTYPE=#{locktype}
        </if>
        <if test="searchCode!=null ">
            and  REGNO = #{searchCode} or UNISCID = #{searchCode}
        </if>
        and regorg like #{regorg}
    </select>
</mapper>