郑永安
2023-06-19 59e91a4e9ddaf23cebb12993c774aa899ab22d16
src/main/java/com/gk/firework/Mapper/mybatis/LicenseInfoMapper.xml
对比新文件
@@ -0,0 +1,233 @@
<?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.gk.firework.Mapper.LicenseInfoMapper" >
  <resultMap id="BaseResultMap" type="com.gk.firework.Domain.LicenseInfo" >
    <!--          -->
    <id column="id" property="id" jdbcType="BIGINT" />
    <result column="sn" property="sn" jdbcType="INTEGER" />
    <result column="licensecode" property="licensecode" jdbcType="VARCHAR" />
    <result column="type" property="type" jdbcType="TINYINT" />
    <result column="name" property="name" jdbcType="VARCHAR" />
    <result column="code" property="code" jdbcType="VARCHAR" />
    <result column="mainpersonname" property="mainpersonname" jdbcType="VARCHAR" />
    <result column="mainpersonidcardnum" property="mainpersonidcardnum" jdbcType="VARCHAR" />
    <result column="mainpersontel" property="mainpersontel" jdbcType="VARCHAR" />
    <result column="safetypersonname" property="safetypersonname" jdbcType="VARCHAR" />
    <result column="safetypersonidcardnum" property="safetypersonidcardnum" jdbcType="VARCHAR" />
    <result column="safetypersontel" property="safetypersontel" jdbcType="VARCHAR" />
    <result column="province" property="province" jdbcType="VARCHAR" />
    <result column="city" property="city" jdbcType="VARCHAR" />
    <result column="district" property="district" jdbcType="VARCHAR" />
    <result column="address" property="address" jdbcType="VARCHAR" />
    <result column="licensetype" property="licensetype" jdbcType="TINYINT" />
    <result column="dealingtype" property="dealingtype" jdbcType="TINYINT" />
    <result column="dealingarea" property="dealingarea" jdbcType="DECIMAL" />
    <result column="savearea" property="savearea" jdbcType="DECIMAL" />
    <result column="reservebox" property="reservebox" jdbcType="DECIMAL" />
    <result column="reservekg" property="reservekg" jdbcType="DECIMAL" />
    <result column="effectdate" property="effectdate" jdbcType="DATE" />
    <result column="noeffectdate" property="noeffectdate" jdbcType="DATE" />
    <result column="delaydate" property="delaydate" jdbcType="DATE" />
    <result column="issuingunit" property="issuingunit" jdbcType="VARCHAR" />
    <result column="issuingdate" property="issuingdate" jdbcType="DATE" />
    <result column="remark" property="remark" jdbcType="VARCHAR" />
    <result column="dealingrange" property="dealingrange" jdbcType="VARCHAR" />
    <result column="flag" property="flag" jdbcType="TINYINT" />
    <result column="createdby" property="createdby" jdbcType="VARCHAR" />
    <result column="createdat" property="createdat" jdbcType="TIMESTAMP" />
    <result column="modifiedby" property="modifiedby" jdbcType="VARCHAR" />
    <result column="modifiedat" property="modifiedat" jdbcType="TIMESTAMP" />
    <result column="reviewer" property="reviewer" jdbcType="VARCHAR" />
    <result column="reviewat" property="reviewat" jdbcType="TIMESTAMP" />
    <result column="reviewstatus" property="reviewstatus" jdbcType="TINYINT" />
    <result column="reviewnote" property="reviewnote" jdbcType="VARCHAR" />
    <result column="granttype" property="granttype" jdbcType="TINYINT" />
    <result column="status" property="status" jdbcType="TINYINT" />
    <result column="printstatus" property="printstatus" jdbcType="TINYINT" />
    <result column="storageprovince" property="storageprovince" jdbcType="VARCHAR" />
    <result column="storagecity" property="storagecity" jdbcType="VARCHAR" />
    <result column="storagedistrict" property="storagedistrict" jdbcType="VARCHAR" />
    <result column="storageaddress" property="storageaddress" jdbcType="VARCHAR" />
    <result column="economictype" property="economictype" jdbcType="VARCHAR" />
  </resultMap>
  <sql id="Base_Column_List" >
    <!--          -->
    id, sn, licensecode, type, name, code, mainpersonname, mainpersonidcardnum, mainpersontel,
    safetypersonname, safetypersonidcardnum, safetypersontel, province, city, district,
    address, licensetype, dealingtype, dealingarea, savearea, reservebox, reservekg,
    effectdate, noeffectdate, delaydate, issuingunit, issuingdate, remark, dealingrange, flag, createdby,
    createdat, modifiedby, modifiedat, reviewer, reviewat, reviewstatus, reviewnote,
    granttype, status, printstatus, storageprovince, storagecity, storagedistrict, storageaddress, economictype
  </sql>
  <select id="selectLicenseDataGrid" resultType="com.gk.firework.Domain.Vo.LicenseVo">
    select
    license.*,
    enterprise.enterprisenumber
    from
    license
    LEFT JOIN enterprise on enterprise.enterprisename = license.`name`
    <where>
      1=1
      and license.flag = 0
      and enterprise.validflag = 1
      and enterprise.enterprisestatus = 'ON'
      <if test="condition.name != null and condition.name != ''">
        and license.`name` like concat('%',#{condition.name},'%')
      </if>
      <if test="condition.type != null and condition.type != ''">
        and license.`type` = #{condition.type}
      </if>
      <if test="condition.effectdate != null and condition.effectdate != ''">
        and license.effectdate &gt; #{condition.effectdate}
      </if>
      <if test="condition.noeffectdate != null and condition.noeffectdate != ''">
        and license.noeffectdate &lt; #{condition.noeffectdate}
      </if>
      <if test="condition.status != null and condition.status != ''">
        and license.`status` = #{condition.status}
      </if>
      <if test="condition.province != null and condition.province != ''">
        and license.province = #{condition.province}
      </if>
      <if test="condition.city != null and condition.city != ''">
        and license.city= #{condition.city}
      </if>
      <if test="condition.district != null and condition.district != ''">
        and license.district = #{condition.district}
      </if>
      <if test="condition.issuingunit != null and condition.issuingunit != ''">
        and license.issuingunit like concat('%',#{condition.issuingunit},'%')
      </if>
      <if test="condition.reviewer != null and condition.reviewer != ''">
        and license.reviewer like concat('%',#{condition.reviewer},'%')
      </if>
        <if test="condition.filterProvince != null and condition.filterProvince != ''">
            and license.province = #{condition.filterProvince}
        </if>
        <if test="condition.filterCity != null and condition.filterCity != ''">
            and license.city = #{condition.filterCity}
        </if>
        <if test="condition.filterDistrict != null and condition.filterDistrict != ''">
            and license.district = #{condition.filterDistrict}
        </if>
        <if test="condition.reviewstatus != null">
            and license.reviewstatus = #{condition.reviewstatus}
        </if>
        <if test="condition.starttime1 != null and condition.starttime1 != ''">
            and license.createdat &gt;=  #{condition.starttime1}
        </if>
        <if test="condition.endtime1 != null and condition.endtime1 != ''">
            and license.createdat &lt;=  #{condition.endtime1}
        </if>
        <if test="condition.starttime2 != null and condition.starttime2 != ''">
            and license.issuingdate &gt;=  #{condition.starttime2}
        </if>
        <if test="condition.endtime2 != null and condition.endtime2 != ''">
            and license.issuingdate &lt;=  #{condition.endtime2}
        </if>
        <if test="condition.validstatus != null and condition.validstatus != ''">
            and license.validstatus =  #{condition.validstatus}
        </if>
        <if test="condition.licensestatus != null ">
            and license.licensestatus =  #{condition.licensestatus}
        </if>
    </where>
  </select>
    <select id="selectLicenseStatisticPage" resultType="java.util.Map">
      select
      citys.name,
      IFNULL(reviewedData.reviewed,0) reviewed,
      IFNULL(expiredData.expired,0) expired,
      IFNULL(pendingData.pending,0)   pending
      from (
            select *
            from district
            where parentcode =(
            select district.code
            from district as  district
            where district.name = '新疆维吾尔自治区'
            and type = 1)
            and type =2
      )   as citys
      left join (
              select e.city ,count(0) reviewed from
              license as l ,enterprise as e
              where
              e.enterprisename = l.name
              and l.reviewstatus = 2
              and e.validflag = 1
              and e.province = '新疆维吾尔自治区'
              <if test="params.starttime != null and params.starttime != ''">
                and l.reviewat &gt;= #{params.starttime}
              </if>
              <if test="params.endtime != null and params.endtime != ''">
                and l.reviewat &lt;= #{params.endtime}
              </if>
              group by e.city
      ) as reviewedData
      on citys.name = reviewedData.city
      left join (
            select  e.city  , count(0) expired
            from
            enterprise as e
            where e.province = '新疆维吾尔自治区'
            and e.validendtime &lt; now()
            group by e.city
      ) as expiredData
      on citys.name = expiredData.city
      left join (
              select e.city ,count(0) pending from
              license as l ,enterprise as e
              where
              e.enterprisename = l.name
              and l.reviewstatus = 1
              and e.validflag = 1
              and e.province = '新疆维吾尔自治区'
              <if test="params.starttime != null and params.starttime != ''">
                and l.modifiedat &gt;= #{params.starttime}
              </if>
              <if test="params.endtime != null and params.endtime != ''">
                and l.modifiedat &lt;= #{params.endtime}
              </if>
              group by e.city
      ) as pendingData
      on citys.name  =  pendingData.city
      <where>
       <if test="params.city != null and params.city != ''">
            citys.name = #{params.city}
       </if>
       <if test="params.filterCity != null and params.filterCity != ''">
         citys.name like concat("%",#{params.filterCity},"%")
       </if>
     </where>
    </select>
</mapper>