2022-09-16 15:07:17 +08:00
<?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.rzyc.mapper.ent.SysEnterpriseMapper" >
<resultMap id= "BaseResultMap" type= "com.rzyc.model.ent.SysEnterprise" >
<id column= "SysEnterpriseId" jdbcType= "VARCHAR" property= "sysenterpriseid" />
<result column= "OrgCode" jdbcType= "VARCHAR" property= "orgcode" />
<result column= "street_code" jdbcType= "VARCHAR" property= "streetCode" />
<result column= "community_code" jdbcType= "VARCHAR" property= "communityCode" />
<result column= "SuperiorEnterpriseId" jdbcType= "VARCHAR" property= "superiorenterpriseid" />
<result column= "LowOrgCode" jdbcType= "VARCHAR" property= "loworgcode" />
<result column= "EntName" jdbcType= "VARCHAR" property= "entname" />
<result column= "IsHide" jdbcType= "VARCHAR" property= "isHide" />
<result column= "State" jdbcType= "VARCHAR" property= "state" />
<result column= "complite" jdbcType= "VARCHAR" property= "complite" />
<result column= "sysUnitId" jdbcType= "VARCHAR" property= "sysUnitId" />
<result column= "ManagerDept" jdbcType= "VARCHAR" property= "managerDept" />
<result column= "dynamicRiskLevel" jdbcType= "VARCHAR" property= "dynamicRiskLevel" />
<result column= "inherentRisk" jdbcType= "VARCHAR" property= "inherentRisk" />
<result column= "manageType" jdbcType= "VARCHAR" property= "manageType" />
<result column= "EntType" jdbcType= "VARCHAR" property= "enttype" />
<result column= "EntSection" jdbcType= "VARCHAR" property= "entsection" />
<result column= "BaseSafeClassId" jdbcType= "VARCHAR" property= "basesafeclassid" />
<result column= "BaseInClassId" jdbcType= "VARCHAR" property= "baseinclassid" />
<result column= "work_class_id" jdbcType= "VARCHAR" property= "workClassId" />
<result column= "PinYin" jdbcType= "VARCHAR" property= "pinyin" />
<result column= "Principal" jdbcType= "VARCHAR" property= "principal" />
<result column= "SysAddress" jdbcType= "VARCHAR" property= "sysaddress" />
<result column= "safeManager" jdbcType= "VARCHAR" property= "safeManager" />
<result column= "safeTelephone" jdbcType= "VARCHAR" property= "safeTelephone" />
<result column= "PostCode" jdbcType= "VARCHAR" property= "postcode" />
<result column= "EcoType" jdbcType= "VARCHAR" property= "ecotype" />
<result column= "PersonCount" jdbcType= "INTEGER" property= "personcount" />
<result column= "EntLogoPic" jdbcType= "VARCHAR" property= "entlogopic" />
<result column= "MaleCode" jdbcType= "VARCHAR" property= "malecode" />
<result column= "OrgPassNo" jdbcType= "VARCHAR" property= "orgpassno" />
<result column= "LegalRepre" jdbcType= "VARCHAR" property= "legalrepre" />
<result column= "LRIDCard" jdbcType= "VARCHAR" property= "lridcard" />
<result column= "LRLinkTel" jdbcType= "VARCHAR" property= "lrlinktel" />
<result column= "EstablishDate" jdbcType= "TIMESTAMP" property= "establishdate" />
<result column= "RiskLevel" jdbcType= "VARCHAR" property= "risklevel" />
<result column= "Latitude" jdbcType= "VARCHAR" property= "latitude" />
<result column= "Longitude" jdbcType= "VARCHAR" property= "longitude" />
<result column= "IsBlackList" jdbcType= "VARCHAR" property= "isblacklist" />
<result column= "Comments" jdbcType= "VARCHAR" property= "comments" />
<result column= "ISMaleCode" jdbcType= "VARCHAR" property= "ismalecode" />
<result column= "EntScore" jdbcType= "VARCHAR" property= "entscore" />
<result column= "EntHouseNum" jdbcType= "VARCHAR" property= "enthousenum" />
<result column= "CreatedOn" jdbcType= "TIMESTAMP" property= "createdon" />
<result column= "CreatedBy" jdbcType= "VARCHAR" property= "createdby" />
<result column= "ModifiedOn" jdbcType= "TIMESTAMP" property= "modifiedon" />
<result column= "ModifiedBy" jdbcType= "VARCHAR" property= "modifiedby" />
<result column= "IndustryClassName" jdbcType= "VARCHAR" property= "industryClassName" />
<result column= "superClassName" jdbcType= "VARCHAR" property= "superClassName" />
<result column= "OrgName" jdbcType= "VARCHAR" property= "orgName" />
<result column= "streetName" jdbcType= "VARCHAR" property= "streetName" />
<result column= "communityName" jdbcType= "VARCHAR" property= "communityName" />
<result column= "qr_code" jdbcType= "VARCHAR" property= "qrCode" />
<result column= "street_code" jdbcType= "VARCHAR" property= "streetCode" />
2022-12-08 13:49:00 +08:00
<result column= "area_name" jdbcType= "VARCHAR" property= "areaName" />
<result column= "area_code" jdbcType= "VARCHAR" property= "areaCode" />
<result column= "area_path" jdbcType= "VARCHAR" property= "areaPath" />
2022-09-16 15:07:17 +08:00
</resultMap>
2022-10-28 15:05:50 +08:00
2022-09-16 15:07:17 +08:00
<sql id= "Base_Column_List" >
2023-03-24 17:02:29 +08:00
SysEnterpriseId, OrgCode, street_code,
community_code,SuperiorEnterpriseId,
LowOrgCode,
area_code,
area_path,
area_name,
2022-09-16 15:07:17 +08:00
EntName,
isHide,
state,
complite,
sysUnitId,
ManagerDept,
dynamicRiskLevel,
inherentRisk,
manageType,
EntType, EntSection,
BaseSafeClassId, BaseInClassId, work_class_id,PinYin, Principal,
SysAddress,
safeTelephone,
safeManager,
PostCode, EcoType,
PersonCount, EntLogoPic, MaleCode, OrgPassNo, LegalRepre, LRIDCard, LRLinkTel, EstablishDate,
RiskLevel, Latitude, Longitude, IsBlackList, Comments, ISMaleCode, EntScore, EntHouseNum,
CreatedOn, CreatedBy, ModifiedOn, ModifiedBy,qr_code
</sql>
2022-10-28 15:05:50 +08:00
2022-09-16 15:07:17 +08:00
<select id= "selectByPrimaryKey" parameterType= "java.lang.String" resultMap= "BaseResultMap" >
select
<include refid= "Base_Column_List" />
from SysEnterprise
where SysEnterpriseId = #{sysenterpriseid,jdbcType=VARCHAR}
and State = '启用';
</select>
<delete id= "deleteByPrimaryKey" parameterType= "java.lang.String" >
delete from SysEnterprise
where SysEnterpriseId = #{sysenterpriseid,jdbcType=VARCHAR}
</delete>
2022-10-28 15:05:50 +08:00
2022-11-07 17:47:41 +08:00
<insert id= "insert" parameterType= "com.rzyc.model.ent.SysEnterprise" >
insert into SysEnterprise (SysEnterpriseId,
OrgCode,
street_code,
community_code,
net_code,
2022-12-20 16:16:50 +08:00
area_code,
area_path,
area_name,
2022-11-07 17:47:41 +08:00
SuperiorEnterpriseId,
2022-12-20 16:16:50 +08:00
LowOrgCode, EntName,isHide, State,complite,sysUnitId,ManagerDept,
dynamicRiskLevel,inherentRisk,manageType,EntType,
2022-11-07 17:47:41 +08:00
EntSection, BaseSafeClassId, BaseInClassId,work_class_id,
PinYin, Principal,
SysAddress,
safeTelephone,
safeManager,
PostCode, EcoType, PersonCount,
EntLogoPic, MaleCode, OrgPassNo,
LegalRepre, LRIDCard, LRLinkTel,
EstablishDate, RiskLevel, Latitude,
Longitude, IsBlackList, Comments,
ISMaleCode, EntScore, EntHouseNum,
CreatedOn, CreatedBy, ModifiedOn,
ModifiedBy,qr_code)
values (
#{sysenterpriseid,jdbcType=VARCHAR},
#{orgcode,jdbcType=VARCHAR},
#{streetCode,jdbcType=VARCHAR},
#{communityCode,jdbcType=VARCHAR},
#{netCode,jdbcType=VARCHAR},
2022-12-20 16:16:50 +08:00
#{areaCode,jdbcType=VARCHAR},
#{areaPath,jdbcType=VARCHAR},
#{areaName,jdbcType=VARCHAR},
2022-11-07 17:47:41 +08:00
#{superiorenterpriseid,jdbcType=VARCHAR},
#{loworgcode,jdbcType=VARCHAR},
#{entname,jdbcType=VARCHAR},
#{isHide,jdbcType=VARCHAR},
#{state,jdbcType=VARCHAR},
#{complite,jdbcType=VARCHAR},
#{sysUnitId,jdbcType=VARCHAR},
#{managerDept,jdbcType=VARCHAR},
#{dynamicRiskLevel,jdbcType=VARCHAR},
#{inherentRisk,jdbcType=VARCHAR},
#{manageType,jdbcType=VARCHAR},
#{enttype,jdbcType=VARCHAR},
#{entsection,jdbcType=VARCHAR}, #{basesafeclassid,jdbcType=VARCHAR},
#{baseinclassid,jdbcType=VARCHAR},
#{workClassId,jdbcType=VARCHAR},
#{pinyin,jdbcType=VARCHAR}, #{principal,jdbcType=VARCHAR},
#{sysaddress,jdbcType=VARCHAR},
#{safeTelephone,jdbcType=VARCHAR},
#{safeManager,jdbcType=VARCHAR},
#{postcode,jdbcType=VARCHAR}, #{ecotype,jdbcType=VARCHAR}, #{personcount,jdbcType=INTEGER},
#{entlogopic,jdbcType=VARCHAR}, #{malecode,jdbcType=VARCHAR}, #{orgpassno,jdbcType=VARCHAR},
#{legalrepre,jdbcType=VARCHAR}, #{lridcard,jdbcType=VARCHAR}, #{lrlinktel,jdbcType=VARCHAR},
#{establishdate,jdbcType=TIMESTAMP}, #{risklevel,jdbcType=VARCHAR}, #{latitude,jdbcType=VARCHAR},
#{longitude,jdbcType=VARCHAR}, #{isblacklist,jdbcType=VARCHAR}, #{comments,jdbcType=VARCHAR},
#{ismalecode,jdbcType=VARCHAR}, #{entscore,jdbcType=VARCHAR}, #{enthousenum,jdbcType=VARCHAR},
#{createdon,jdbcType=TIMESTAMP}, #{createdby,jdbcType=VARCHAR}, #{modifiedon,jdbcType=TIMESTAMP},
#{modifiedby,jdbcType=VARCHAR},#{qrCode})
</insert>
2022-09-16 15:07:17 +08:00
<insert id= "insertSelective" parameterType= "com.rzyc.model.ent.SysEnterprise" >
insert into SysEnterprise
<trim prefix= "(" suffix= ")" suffixOverrides= "," >
<if test= "sysenterpriseid != null" >
SysEnterpriseId,
</if>
<if test= "orgcode != null" >
OrgCode,
</if>
<if test= "superiorenterpriseid != null" >
SuperiorEnterpriseId,
</if>
<if test= "loworgcode != null" >
LowOrgCode,
</if>
<if test= "entname != null" >
EntName,
</if>
<if test= "isHide != null" >
IsHide,
</if>
<if test= "complite != null" >
complite,
</if>
<if test= "sysUnitId != null" >
SysUnitId,
</if>
<if test= "managerDept != null" >
ManagerDept,
</if>
<if test= "dynamicRiskLevel != null" >
dynamicRiskLevel,
</if>
<if test= "inherentRisk != null" >
inherentRisk,
</if>
<if test= "manageType != null" >
manageType,
</if>
<if test= "enttype != null" >
EntType,
</if>
<if test= "entsection != null" >
EntSection,
</if>
<if test= "basesafeclassid != null" >
BaseSafeClassId,
</if>
<if test= "baseinclassid != null" >
BaseInClassId,
</if>
<if test= "workClassId != null" >
work_class_id,
</if>
<if test= "pinyin != null" >
PinYin,
</if>
<if test= "principal != null" >
Principal,
</if>
<if test= "sysaddress != null" >
SysAddress,
</if>
<if test= "safeTelephone != null" >
safeTelephone,
</if>
<if test= "safeManager != null" >
safeManager,
</if>
<if test= "postcode != null" >
PostCode,
</if>
<if test= "ecotype != null" >
EcoType,
</if>
<if test= "personcount != null" >
PersonCount,
</if>
<if test= "entlogopic != null" >
EntLogoPic,
</if>
<if test= "malecode != null" >
MaleCode,
</if>
<if test= "state != null" >
State,
</if>
<if test= "orgpassno != null" >
OrgPassNo,
</if>
<if test= "legalrepre != null" >
LegalRepre,
</if>
<if test= "lridcard != null" >
LRIDCard,
</if>
<if test= "lrlinktel != null" >
LRLinkTel,
</if>
<if test= "establishdate != null" >
EstablishDate,
</if>
<if test= "risklevel != null" >
RiskLevel,
</if>
<if test= "latitude != null" >
Latitude,
</if>
<if test= "longitude != null" >
Longitude,
</if>
<if test= "isblacklist != null" >
IsBlackList,
</if>
<if test= "comments != null" >
Comments,
</if>
<if test= "ismalecode != null" >
ISMaleCode,
</if>
<if test= "entscore != null" >
EntScore,
</if>
<if test= "enthousenum != null" >
EntHouseNum,
</if>
<if test= "createdon != null" >
CreatedOn,
</if>
<if test= "createdby != null" >
CreatedBy,
</if>
<if test= "modifiedon != null" >
ModifiedOn,
</if>
<if test= "modifiedby != null" >
ModifiedBy,
</if>
</trim>
<trim prefix= "values (" suffix= ")" suffixOverrides= "," >
<if test= "sysenterpriseid != null" >
#{sysenterpriseid,jdbcType=VARCHAR},
</if>
<if test= "orgcode != null" >
#{orgcode,jdbcType=VARCHAR},
</if>
<if test= "superiorenterpriseid != null" >
#{superiorenterpriseid,jdbcType=VARCHAR},
</if>
<if test= "loworgcode != null" >
#{loworgcode,jdbcType=VARCHAR},
</if>
<if test= "entname != null" >
#{entname,jdbcType=VARCHAR},
</if>
<if test= "isHide != null" >
#{isHide,jdbcType=VARCHAR},
</if>
<if test= "complite != null" >
#{complite,jdbcType=VARCHAR},
</if>
<if test= "sysUnitId != null" >
#{sysUnitId,jdbcType=VARCHAR},
</if>
<if test= "managerDept != null" >
#{managerDept,jdbcType=VARCHAR},
</if>
<if test= "dynamicRiskLevel != null" >
#{dynamicRiskLevel,jdbcType=VARCHAR},
</if>
<if test= "inherentRisk != null" >
#{inherentRisk,jdbcType=VARCHAR},
</if>
<if test= "manageType != null" >
#{manageType,jdbcType=VARCHAR},
</if>
<if test= "enttype != null" >
#{enttype,jdbcType=VARCHAR},
</if>
<if test= "entsection != null" >
#{entsection,jdbcType=VARCHAR},
</if>
<if test= "basesafeclassid != null" >
#{basesafeclassid,jdbcType=VARCHAR},
</if>
<if test= "baseinclassid != null" >
#{baseinclassid,jdbcType=VARCHAR},
</if>
<if test= "workClassId != null" >
#{workClassId,jdbcType=VARCHAR},
</if>
<if test= "pinyin != null" >
#{pinyin,jdbcType=VARCHAR},
</if>
<if test= "principal != null" >
#{principal,jdbcType=VARCHAR},
</if>
<if test= "sysaddress != null" >
#{sysaddress,jdbcType=VARCHAR},
</if>
<if test= "safeTelephone != null" >
#{safeTelephone,jdbcType=VARCHAR},
</if>
<if test= "safeManager != null" >
#{safeManager,jdbcType=VARCHAR},
</if>
<if test= "postcode != null" >
#{postcode,jdbcType=VARCHAR},
</if>
<if test= "ecotype != null" >
#{ecotype,jdbcType=VARCHAR},
</if>
<if test= "personcount != null" >
#{personcount,jdbcType=INTEGER},
</if>
<if test= "entlogopic != null" >
#{entlogopic,jdbcType=VARCHAR},
</if>
<if test= "malecode != null" >
#{malecode,jdbcType=VARCHAR},
</if>
<if test= "state != null" >
#{state,jdbcType=VARCHAR},
</if>
<if test= "orgpassno != null" >
#{orgpassno,jdbcType=VARCHAR},
</if>
<if test= "legalrepre != null" >
#{legalrepre,jdbcType=VARCHAR},
</if>
<if test= "lridcard != null" >
#{lridcard,jdbcType=VARCHAR},
</if>
<if test= "lrlinktel != null" >
#{lrlinktel,jdbcType=VARCHAR},
</if>
<if test= "establishdate != null" >
#{establishdate,jdbcType=TIMESTAMP},
</if>
<if test= "risklevel != null" >
#{risklevel,jdbcType=VARCHAR},
</if>
<if test= "latitude != null" >
#{latitude,jdbcType=VARCHAR},
</if>
<if test= "longitude != null" >
#{longitude,jdbcType=VARCHAR},
</if>
<if test= "isblacklist != null" >
#{isblacklist,jdbcType=VARCHAR},
</if>
<if test= "comments != null" >
#{comments,jdbcType=VARCHAR},
</if>
<if test= "ismalecode != null" >
#{ismalecode,jdbcType=VARCHAR},
</if>
<if test= "entscore != null" >
#{entscore,jdbcType=VARCHAR},
</if>
<if test= "enthousenum != null" >
#{enthousenum,jdbcType=VARCHAR},
</if>
<if test= "createdon != null" >
#{createdon,jdbcType=TIMESTAMP},
</if>
<if test= "createdby != null" >
#{createdby,jdbcType=VARCHAR},
</if>
<if test= "modifiedon != null" >
#{modifiedon,jdbcType=TIMESTAMP},
</if>
<if test= "modifiedby != null" >
#{modifiedby,jdbcType=VARCHAR},
</if>
</trim>
</insert>
2022-10-28 15:05:50 +08:00
2022-12-29 18:02:27 +08:00
<update id= "updateByPrimaryKeySelective" parameterType= "com.rzyc.model.ent.SysEnterprise" >
2022-09-16 15:07:17 +08:00
update SysEnterprise
<set >
<if test= "orgcode != null" >
OrgCode = #{orgcode,jdbcType=VARCHAR},
</if>
<if test= "streetCode != null" >
street_code = #{streetCode,jdbcType=VARCHAR},
</if>
<if test= "communityCode != null" >
community_code = #{communityCode,jdbcType=VARCHAR},
</if>
<if test= "netCode != null" >
net_code = #{netCode,jdbcType=VARCHAR},
</if>
<if test= "superiorenterpriseid != null" >
SuperiorEnterpriseId = #{superiorenterpriseid,jdbcType=VARCHAR},
</if>
<if test= "loworgcode != null" >
LowOrgCode = #{loworgcode,jdbcType=VARCHAR},
</if>
<if test= "entname != null" >
EntName = #{entname,jdbcType=VARCHAR},
</if>
<if test= "isHide != null" >
IsHide = #{isHide,jdbcType=VARCHAR},
</if>
<if test= "state != null" >
State = #{state,jdbcType=VARCHAR},
</if>
<if test= "complite != null" >
complite = #{complite,jdbcType=VARCHAR},
</if>
<if test= "sysUnitId != null" >
sysUnitId = #{sysUnitId,jdbcType=VARCHAR},
</if>
<if test= "managerDept != null" >
ManagerDept = #{managerDept,jdbcType=VARCHAR},
</if>
<if test= "dynamicRiskLevel != null" >
dynamicRiskLevel = #{dynamicRiskLevel,jdbcType=VARCHAR},
</if>
<if test= "inherentRisk != null" >
inherentRisk = #{inherentRisk,jdbcType=VARCHAR},
</if>
<if test= "manageType != null" >
manageType = #{manageType,jdbcType=VARCHAR},
</if>
<if test= "enttype != null" >
EntType = #{enttype,jdbcType=VARCHAR},
</if>
<if test= "entsection != null" >
EntSection = #{entsection,jdbcType=VARCHAR},
</if>
<if test= "basesafeclassid != null" >
BaseSafeClassId = #{basesafeclassid,jdbcType=VARCHAR},
</if>
<if test= "baseinclassid != null" >
BaseInClassId = #{baseinclassid,jdbcType=VARCHAR},
</if>
<if test= "workClassId != null" >
work_class_id = #{workClassId,jdbcType=VARCHAR},
</if>
<if test= "pinyin != null" >
PinYin = #{pinyin,jdbcType=VARCHAR},
</if>
<if test= "principal != null" >
Principal = #{principal,jdbcType=VARCHAR},
</if>
<if test= "sysaddress != null" >
SysAddress = #{sysaddress,jdbcType=VARCHAR},
</if>
<if test= "safeTelephone != null" >
safeTelephone = #{safeTelephone,jdbcType=VARCHAR},
</if>
<if test= "safeManager != null" >
safeManager = #{safeManager,jdbcType=VARCHAR},
</if>
<if test= "postcode != null" >
PostCode = #{postcode,jdbcType=VARCHAR},
</if>
<if test= "ecotype != null" >
EcoType = #{ecotype,jdbcType=VARCHAR},
</if>
<if test= "personcount != null" >
PersonCount = #{personcount,jdbcType=INTEGER},
</if>
<if test= "entlogopic != null" >
EntLogoPic = #{entlogopic,jdbcType=VARCHAR},
</if>
<if test= "malecode != null" >
MaleCode = #{malecode,jdbcType=VARCHAR},
</if>
<if test= "orgpassno != null" >
OrgPassNo = #{orgpassno,jdbcType=VARCHAR},
</if>
<if test= "legalrepre != null" >
LegalRepre = #{legalrepre,jdbcType=VARCHAR},
</if>
<if test= "lridcard != null" >
LRIDCard = #{lridcard,jdbcType=VARCHAR},
</if>
<if test= "lrlinktel != null" >
LRLinkTel = #{lrlinktel,jdbcType=VARCHAR},
</if>
<if test= "establishdate != null" >
EstablishDate = #{establishdate,jdbcType=TIMESTAMP},
</if>
<if test= "risklevel != null" >
RiskLevel = #{risklevel,jdbcType=VARCHAR},
</if>
<if test= "latitude != null" >
Latitude = #{latitude,jdbcType=VARCHAR},
</if>
<if test= "longitude != null" >
Longitude = #{longitude,jdbcType=VARCHAR},
</if>
<if test= "isblacklist != null" >
IsBlackList = #{isblacklist,jdbcType=VARCHAR},
</if>
<if test= "comments != null" >
Comments = #{comments,jdbcType=VARCHAR},
</if>
<if test= "ismalecode != null" >
ISMaleCode = #{ismalecode,jdbcType=VARCHAR},
</if>
<if test= "entscore != null" >
EntScore = #{entscore,jdbcType=VARCHAR},
</if>
<if test= "enthousenum != null" >
EntHouseNum = #{enthousenum,jdbcType=VARCHAR},
</if>
<if test= "createdon != null" >
CreatedOn = #{createdon,jdbcType=TIMESTAMP},
</if>
<if test= "createdby != null" >
CreatedBy = #{createdby,jdbcType=VARCHAR},
</if>
<if test= "modifiedon != null" >
ModifiedOn = #{modifiedon,jdbcType=TIMESTAMP},
</if>
<if test= "modifiedby != null" >
ModifiedBy = #{modifiedby,jdbcType=VARCHAR},
</if>
<if test= "qrCode != null" >
qr_code = #{qrCode}
</if>
</set>
where SysEnterpriseId = #{sysenterpriseid,jdbcType=VARCHAR}
</update>
<update id= "updateByPrimaryKey" parameterType= "com.rzyc.model.ent.SysEnterprise" >
update SysEnterprise
set
OrgCode = #{orgcode,jdbcType=VARCHAR},
street_code = #{streetCode,jdbcType=VARCHAR},
community_code = #{communityCode,jdbcType=VARCHAR},
OrgCode = #{orgcode,jdbcType=VARCHAR},
2022-11-01 17:30:53 +08:00
area_code = #{areaCode,jdbcType=VARCHAR},
area_path = #{areaPath,jdbcType=VARCHAR},
area_name = #{areaName,jdbcType=VARCHAR},
2022-09-16 15:07:17 +08:00
SuperiorEnterpriseId = #{superiorenterpriseid,jdbcType=VARCHAR},
LowOrgCode = #{loworgcode,jdbcType=VARCHAR},
EntName = #{entname,jdbcType=VARCHAR},
IsHide = #{isHide,jdbcType=VARCHAR},
State = #{state,jdbcType=VARCHAR},
complite = #{complite,jdbcType=VARCHAR},
sysUnitId = #{sysUnitId,jdbcType=VARCHAR},
ManagerDept = #{managerDept,jdbcType=VARCHAR},
dynamicRiskLevel = #{dynamicRiskLevel,jdbcType=VARCHAR},
inherentRisk = #{inherentRisk,jdbcType=VARCHAR},
manageType = #{manageType,jdbcType=VARCHAR},
EntType = #{enttype,jdbcType=VARCHAR},
EntSection = #{entsection,jdbcType=VARCHAR},
BaseSafeClassId = #{basesafeclassid,jdbcType=VARCHAR},
BaseInClassId = #{baseinclassid,jdbcType=VARCHAR},
work_class_id = #{workClassId,jdbcType=VARCHAR},
PinYin = #{pinyin,jdbcType=VARCHAR},
Principal = #{principal,jdbcType=VARCHAR},
SysAddress = #{sysaddress,jdbcType=VARCHAR},
safeTelephone = #{safeTelephone,jdbcType=VARCHAR},
safeManager = #{safeManager,jdbcType=VARCHAR},
PostCode = #{postcode,jdbcType=VARCHAR},
qr_code = #{qrCode,jdbcType=VARCHAR},
EcoType = #{ecotype,jdbcType=VARCHAR},
PersonCount = #{personcount,jdbcType=INTEGER},
EntLogoPic = #{entlogopic,jdbcType=VARCHAR},
MaleCode = #{malecode,jdbcType=VARCHAR},
OrgPassNo = #{orgpassno,jdbcType=VARCHAR},
LegalRepre = #{legalrepre,jdbcType=VARCHAR},
LRIDCard = #{lridcard,jdbcType=VARCHAR},
LRLinkTel = #{lrlinktel,jdbcType=VARCHAR},
2023-03-24 17:11:55 +08:00
EstablishDate = #{establishdate},
2022-09-16 15:07:17 +08:00
RiskLevel = #{risklevel,jdbcType=VARCHAR},
Latitude = #{latitude,jdbcType=VARCHAR},
Longitude = #{longitude,jdbcType=VARCHAR},
IsBlackList = #{isblacklist,jdbcType=VARCHAR},
Comments = #{comments,jdbcType=VARCHAR},
ISMaleCode = #{ismalecode,jdbcType=VARCHAR},
EntScore = #{entscore,jdbcType=VARCHAR},
EntHouseNum = #{enthousenum,jdbcType=VARCHAR},
CreatedOn = #{createdon,jdbcType=TIMESTAMP},
CreatedBy = #{createdby,jdbcType=VARCHAR},
ModifiedOn = #{modifiedon,jdbcType=TIMESTAMP},
ModifiedBy = #{modifiedby,jdbcType=VARCHAR}
where SysEnterpriseId = #{sysenterpriseid,jdbcType=VARCHAR}
</update>
<!-- 企业列表分页 -->
<select id= "enterprisePage" resultMap= "BaseResultMap" >
SELECT spc.IndustryClassName superClassName,bc.`IndustryClassName`, se.* FROM `SysEnterprise` se
LEFT JOIN BaseInClass bc ON bc.`BaseInClassId` = se.`BaseInClassId`
LEFT JOIN BaseInClass spc ON spc.`BaseInClassId` = bc.`SuperInId`
WHERE se.EntName LIKE #{entName}
and se.RiskLevel LIKE #{riskLevel}
AND se.State = '启用'
<if test= "null != orgCode and '' != orgCode" >
AND (se.`OrgCode` = #{orgCode}
OR se.`street_code` = #{orgCode}
OR se.`community_code` = #{orgCode})
</if>
<if test= "null != baseinclassid and '' != baseinclassid" >
AND se.BaseInClassId = #{baseinclassid}
</if>
<if test= "null != safeClassIds and safeClassIds.size() > 0 " >
AND
<foreach collection = "safeClassIds" item= "safeClassId" index= "index" open= "(" separator = "or" close= ")" >
se.BaseSafeClassId like #{safeClassId}
</foreach>
</if>
<if test= "null != entType and '' != entType" >
AND se.EntType = #{entType}
</if>
ORDER BY se.`EntName` ASC
LIMIT #{start},#{end}
</select>
<!-- 企业总数 -->
<select id= "countEnterprise" resultType= "java.lang.Long" >
SELECT count(1) FROM `SysEnterprise` se
WHERE se.EntName LIKE #{entName}
and se.RiskLevel LIKE #{riskLevel}
AND se.State = '启用'
<if test= "null != orgCode and '' != orgCode" >
AND (se.`OrgCode` = #{orgCode}
OR se.`street_code` = #{orgCode}
OR se.`community_code` = #{orgCode})
</if>
<if test= "null != baseinclassid and '' != baseinclassid" >
AND se.BaseInClassId = #{baseinclassid}
</if>
<if test= "null != safeClassIds and safeClassIds.size() > 0 " >
AND
<foreach collection = "safeClassIds" item= "safeClassId" index= "index" open= "(" separator = "or" close= ")" >
se.BaseSafeClassId like #{safeClassId}
</foreach>
</if>
<if test= "null != entType and '' != entType" >
AND se.EntType = #{entType}
</if>
</select>
<!-- 未创建企业用户的企业 -->
<select id= "notUserEnt" resultMap= "BaseResultMap" >
SELECT se.* FROM SysEnterprise se
LEFT JOIN SysUser su ON se.`SysEnterpriseId` = su.`SysUnitOrEntId`
WHERE su.`SysUnitOrEntId` IS NULL;
</select>
<!-- 通过企业名 查询企业信息 -->
<select id= "findByEntName" resultMap= "BaseResultMap" >
SELECT * FROM SysEnterprise se WHERE se.`EntName` = #{entName}
<if test= "null != enterpriseId and '' != enterpriseId" >
AND se.SysEnterpriseId != #{enterpriseId}
</if>
</select>
<!-- 修改企业信息 -->
<update id= "changeEnt" parameterType= "com.rzyc.model.ent.SysEnterprise" >
update SysEnterprise
set OrgCode = #{orgcode,jdbcType=VARCHAR},
EntName = #{entname,jdbcType=VARCHAR},
sysUnitId = #{sysUnitId,jdbcType=VARCHAR},
ManagerDept = #{managerDept,jdbcType=VARCHAR},
BaseSafeClassId = #{basesafeclassid,jdbcType=VARCHAR},
BaseInClassId = #{baseinclassid,jdbcType=VARCHAR},
complite = #{complite,jdbcType=VARCHAR},
SysAddress = #{sysaddress,jdbcType=VARCHAR},
Latitude = #{latitude,jdbcType=VARCHAR},
Legalrepre = #{legalrepre,jdbcType=VARCHAR},
Longitude = #{longitude,jdbcType=VARCHAR},
LRLinkTel = #{lrlinktel,jdbcType=VARCHAR},
LRIDCard = #{lridcard,jdbcType=VARCHAR},
safeManager = #{safeManager,jdbcType=VARCHAR},
safeTelephone = #{safeTelephone,jdbcType=VARCHAR},
ModifiedOn = #{modifiedon,jdbcType=TIMESTAMP},
ModifiedBy = #{modifiedby,jdbcType=VARCHAR}
where SysEnterpriseId = #{sysenterpriseid,jdbcType=VARCHAR}
</update>
2022-12-29 15:17:14 +08:00
<!-- 修改企业信息 -->
<update id= "changeLonLat" parameterType= "com.rzyc.model.ent.SysEnterprise" >
update SysEnterprise
set Latitude = #{latitude,jdbcType=VARCHAR},
SysAddress = #{sysaddress,jdbcType=VARCHAR},
Longitude = #{longitude,jdbcType=VARCHAR}
where SysEnterpriseId = #{sysenterpriseid,jdbcType=VARCHAR}
</update>
2022-09-16 15:07:17 +08:00
<!-- 通过检查id查询企业信息 -->
<select id= "findByCheckId" resultMap= "BaseResultMap" >
SELECT se.* FROM `SysEnterprise` se
LEFT JOIN BookEntCheck bc ON se.SysEnterpriseId = bc.BaseEntId
WHERE bc.BookEntCheckId = #{checkId};
</select>
<!-- 企业端修改企业信息 -->
<update id= "entChangeEnt" parameterType= "com.rzyc.model.ent.SysEnterprise" >
update SysEnterprise
set OrgCode = #{orgcode,jdbcType=VARCHAR},
EntName = #{entname,jdbcType=VARCHAR},
PersonCount = #{personcount,jdbcType=INTEGER},
SysAddress = #{sysaddress,jdbcType=VARCHAR},
Latitude = #{latitude,jdbcType=VARCHAR},
Longitude = #{longitude,jdbcType=VARCHAR},
Legalrepre = #{legalrepre,jdbcType=VARCHAR},
LRLinkTel = #{lrlinktel,jdbcType=VARCHAR},
LRIDCard = #{lridcard,jdbcType=VARCHAR},
manageType = #{manageType,jdbcType=VARCHAR},
OrgPassNo = #{orgpassno,jdbcType=VARCHAR},
complite = #{complite,jdbcType=VARCHAR},
PostCode = #{postcode,jdbcType=VARCHAR},
safeManager = #{safeManager,jdbcType=VARCHAR},
safeTelephone = #{safeTelephone,jdbcType=VARCHAR},
EstablishDate = #{establishdate,jdbcType=TIMESTAMP},
ModifiedOn = #{modifiedon,jdbcType=TIMESTAMP},
ModifiedBy = #{modifiedby,jdbcType=VARCHAR}
where SysEnterpriseId = #{sysenterpriseid,jdbcType=VARCHAR}
</update>
<!-- 所有企业 -->
<select id= "findAll" resultMap= "BaseResultMap" >
2022-12-29 15:17:14 +08:00
SELECT se.* FROM SysEnterprise se WHERE se.State = '启用'
</select>
<!-- 所有企业 -->
<select id= "findLon" resultMap= "BaseResultMap" >
SELECT se.* FROM SysEnterprise se WHERE se.State = '启用' and se.Longitude is null
2022-09-16 15:07:17 +08:00
</select>
<select id= "findAllNoState" resultMap= "BaseResultMap" >
SELECT se.*,org.OrgName FROM SysEnterprise se
left join SysOrg org on se.OrgCode = org.OrgCode WHERE se.State = '启用'
</select>
<select id= "findByAreaCode" resultMap= "BaseResultMap" >
SELECT se.*,org.OrgName,st.OrgName streetName,cm.OrgName communityName
FROM SysEnterprise se
left join SysOrg org on se.OrgCode = org.OrgCode
left join SysOrg st on se.street_code = st.OrgCode
left join SysOrg cm on se.community_code = cm.OrgCode
WHERE se.State = '启用'
<if test= "null != areaCode and '' != areaCode" >
and (se.OrgCode = #{areaCode} or se.street_code = #{areaCode} or se.community_code = #{areaCode} )
</if>
</select>
<select id= "selectPCList" resultMap= "BaseResultMap" >
2022-12-08 13:49:00 +08:00
select sys.*
2022-09-16 15:07:17 +08:00
from SysEnterprise sys
where 1=1
<if test= "2 == isAdmin" >
AND sys.State='启用'
</if>
<if test= "null != inherentRisks and inherentRisks.size() > 0" >
and sys.InherentRisk in
<foreach collection= "inherentRisks" item= "inherentRisk" open= "(" close= ")" separator= "," >
#{inherentRisk}
</foreach>
</if>
2022-11-01 17:30:53 +08:00
AND FIND_IN_SET(#{areaCode},sys.area_path)
2022-09-16 15:07:17 +08:00
<if test= "null != entName and '' != entName" >
and sys.EntName like concat('%',#{entName},'%')
</if>
<if test= "null != riskLevel and '' != riskLevel" >
And sys.RiskLevel like concat('',#{riskLevel},'%')
</if>
<if test= "null != baseinclassid and '' != baseinclassid" >
and sys.work_class_id = #{baseinclassid}
</if>
order by sys.ModifiedOn desc , sys.SysEnterpriseId desc
</select>
2022-12-30 15:58:14 +08:00
<select id= "countCompany" resultType= "java.lang.Integer" >
select count(sys.`SysEnterpriseId`)
from SysEnterprise sys
where 1=1
<if test= "2 == isAdmin" >
AND sys.State='启用'
</if>
<if test= "null != inherentRisks and inherentRisks.size() > 0" >
and sys.InherentRisk in
<foreach collection= "inherentRisks" item= "inherentRisk" open= "(" close= ")" separator= "," >
#{inherentRisk}
</foreach>
</if>
AND FIND_IN_SET(#{areaCode},sys.area_path)
<if test= "null != entName and '' != entName" >
and sys.EntName like concat('%',#{entName},'%')
</if>
<if test= "null != riskLevel and '' != riskLevel" >
And sys.RiskLevel like concat('',#{riskLevel},'%')
</if>
<if test= "null != baseinclassid and '' != baseinclassid" >
and sys.work_class_id = #{baseinclassid}
</if>
</select>
2022-09-16 15:07:17 +08:00
<!-- 小程序企业 -->
<select id= "wechatEnt" resultMap= "BaseResultMap" >
select sys.*,org.OrgName
from ent_user eu
LEFT JOIN SysEnterprise sys ON eu.`ent_id` = sys.`SysEnterpriseId`
left join SysOrg org on sys.OrgCode = org.OrgCode
where sys.state = '启用'
<if test= "null != orgCode and '' != orgCode" >
And org.OrgCode like concat('',#{orgCode},'%')
</if>
<if test= "null != entName and '' != entName" >
and sys.EntName like concat('%',#{entName},'%')
</if>
<if test= "null != riskLevel and '' != riskLevel" >
And sys.RiskLevel like concat('',#{riskLevel},'%')
</if>
order by sys.ModifiedOn desc
</select>
<select id= "companyDetail" resultMap= "BaseResultMap" >
select se.*,so.OrgName,st.OrgName streetName,cm.OrgName communityName
from SysEnterprise se
left join SysOrg so on se.OrgCode = so.OrgCode
left join SysOrg st on se.street_code = st.OrgCode
left join SysOrg cm on se.community_code = cm.OrgCode
where SysEnterpriseId=#{id}
</select>
<update id= "updateState" >
update SysEnterprise set State = #{state} where SysEnterpriseId = #{enterpriseId}
</update>
<select id= "selectByName" resultMap= "BaseResultMap" >
select * from SysEnterprise where EntName = #{entName}
<if test= "null != CompanyId and '' != CompanyId" >
and SysEnterpriseId != #{CompanyId}
</if>
</select>
<!-- 修改企业风险等级 -->
<update id= "chnageScore" >
update SysEnterprise
set RiskLevel = #{riskLevel},
DynamicRiskLevel = #{score},
EntScore = #{score}
where SysEnterpriseId = #{enterpriseId}
</update>
<!-- 企业清单录入详情 -->
<resultMap id= "CompanyListResultMap" type= "com.rzyc.bean.ent.CompanyList" >
<id column= "SysEnterpriseId" jdbcType= "CHAR" property= "sysEnterpriseId" />
<result column= "EntName" jdbcType= "VARCHAR" property= "entName" />
<result column= "UnitName" jdbcType= "VARCHAR" property= "unitName" />
<result column= "entUserNum" jdbcType= "INTEGER" property= "entUserNum" />
<result column= "subjectNum" jdbcType= "INTEGER" property= "subjectNum" />
<result column= "postNum" jdbcType= "INTEGER" property= "postNum" />
<result column= "checkNum" jdbcType= "INTEGER" property= "checkNum" />
<result column= "emergencyNum" jdbcType= "INTEGER" property= "emergencyNum" />
</resultMap>
<!-- 企业清单录入详情 -->
<select id= "companyList" resultMap= "CompanyListResultMap" >
SELECT se.`SysEnterpriseId`,se.`EntName` ,st.UnitName,
(
SELECT COUNT(*) FROM SysEntUser su WHERE su.SysEnterpriseId = se.SysEnterpriseId AND su.forbiddenStatus = 1
) entUserNum,
(
SELECT COUNT(*) FROM SysEntList sl
WHERE sl.`SysEnterpriseId` = se.`SysEnterpriseId`
AND sl.ListType = '主体清单'
) subjectNum,
(
SELECT COUNT(*) FROM SysEntList sl
WHERE sl.`SysEnterpriseId` = se.`SysEnterpriseId`
AND sl.ListType = '岗位清单'
) postNum,
(
SELECT COUNT(*) FROM SysEntList sl
WHERE sl.`SysEnterpriseId` = se.`SysEnterpriseId`
AND sl.ListType = '检查清单'
) checkNum,
(
SELECT COUNT(*) FROM SysEntList sl
WHERE sl.`SysEnterpriseId` = se.`SysEnterpriseId`
AND sl.ListType = '应急清单'
) emergencyNum
FROM SysEnterprise se
LEFT JOIN SysUnit st ON se.`ManagerDept` = st.`SysUnitId`
WHERE se.`State` = '启用'
AND se.`EntName` LIKE #{condition}
</select>
<!-- 企业清单录入详情 -->
<resultMap id= "LegalPromiseListResultMap" type= "com.rzyc.bean.ent.LegalPromise" >
<id column= "SysEnterpriseId" jdbcType= "CHAR" property= "sysEnterpriseId" />
<result column= "EntName" jdbcType= "VARCHAR" property= "entName" />
<result column= "promiseNum" jdbcType= "INTEGER" property= "promiseNum" />
</resultMap>
<!-- 法人承诺 -->
<select id= "legalPromise" resultMap= "LegalPromiseListResultMap" >
SELECT se.`SysEnterpriseId`,se.`EntName` ,
(
SELECT COUNT(*) FROM EntPromise ep
WHERE ep.`StayUserId` = ep.`InitiatorId`
AND ep.`SysEnterpriseId` = se.`SysEnterpriseId`
) promiseNum
FROM SysEnterprise se
WHERE se.`State` = '启用'
AND se.`EntName` LIKE #{condition}
</select>
<!-- 岗位承诺 -->
<resultMap id= "PostPromiseListResultMap" type= "com.rzyc.bean.ent.PostPromise" >
<id column= "SysEnterpriseId" jdbcType= "CHAR" property= "sysEnterpriseId" />
<result column= "EntName" jdbcType= "VARCHAR" property= "entName" />
<result column= "entUserNum" jdbcType= "INTEGER" property= "entUserNum" />
<result column= "notPromiseNum" jdbcType= "INTEGER" property= "notPromiseNum" />
</resultMap>
<!-- 岗位承诺 -->
<select id= "postPromise" resultMap= "PostPromiseListResultMap" >
SELECT se.`SysEnterpriseId`,se.`EntName`,
(
SELECT COUNT(*) FROM SysEntUser su WHERE su.SysEnterpriseId = se.SysEnterpriseId AND su.forbiddenStatus = 1
) entUserNum,
(
SELECT COUNT(*) FROM SysEntUser su
LEFT JOIN EntPromise ep ON ep.InitiatorId = su.SysEntUserId
WHERE su.SysEnterpriseId = se.SysEnterpriseId AND su.forbiddenStatus = 1
AND ep.EntPromiseId IS NULL
) notPromiseNum
FROM SysEnterprise se
WHERE se.`State` = '启用'
AND se.`EntName` LIKE #{condition}
</select>
<!-- 风险排名 -->
<resultMap id= "TopfiveResultMap" type= "com.rzyc.bean.bigdata.FiveEntScore" >
2022-10-28 15:05:50 +08:00
<result column= "EntName" jdbcType= "VARCHAR" property= "entName" />
<result column= "DynamicRiskLevel" jdbcType= "VARCHAR" property= "dynamicRiskLevel" />
<result column= "RiskLevel" jdbcType= "VARCHAR" property= "riskLevel" />
2022-09-16 15:07:17 +08:00
</resultMap>
<!-- 风险排名 -->
<select id= "getTopfiveEntScore" resultMap= "TopfiveResultMap" >
SELECT EntName,DynamicRiskLevel,RiskLevel FROM SysEnterprise
WHERE IsHide='否' AND State='启用'
and DynamicRiskLevel is not null
ORDER BY CONVERT(DynamicRiskLevel,UNSIGNED) DESC LIMIT 10
</select>
<!-- 风险排名 -->
<select id= "getlastfiveEntScore" resultMap= "TopfiveResultMap" >
SELECT EntName,DynamicRiskLevel,RiskLevel FROM SysEnterprise
WHERE IsHide='否' AND State='启用'
and DynamicRiskLevel is not null
ORDER BY CONVERT(DynamicRiskLevel,UNSIGNED) ASC LIMIT 10
</select>
<!-- 风险排名 -->
<resultMap id= "EntRsikNumResultMap" type= "com.rzyc.bean.bigdata.EntRsikNum" >
<result column= "m" jdbcType= "VARCHAR" property= "m" />
<result column= "num" jdbcType= "INTEGER" property= "num" />
<result column= "sortId" jdbcType= "INTEGER" property= "sortId" />
</resultMap>
<select id= "entRiskNum" resultMap= "EntRsikNumResultMap" >
select B.m,sum(case when A.RiskLevel=B.m then count else 0 end) as num
from (select RiskLevel ,OrgCode as Codes,1 as count from SysEnterprise
where OrgCode =#{areaCode}) A,
(select '低风险' m union all select '一般风险' union all select '较大风险'
union all select '重大风险') B GROUP BY B.m
</select>
<!-- 风险排名 -->
<resultMap id= "GetSysEnterpriseNumResultMap" type= "com.rzyc.bean.bigdata.GetSysEnterpriseNum" >
<result column= "type" jdbcType= "VARCHAR" property= "type" />
<result column= "num" jdbcType= "INTEGER" property= "num" />
</resultMap>
<select id= "enterpriseNum" resultMap= "GetSysEnterpriseNumResultMap" >
SELECT '总数' AS TYPE ,COUNT(*) AS num FROM SysEnterprise WHERE IsHide='否' AND State='启用'
UNION SELECT B.type,SUM(CASE WHEN A.RiskLevel=B.type THEN COUNT ELSE 0 END) AS num
FROM (SELECT RiskLevel ,OrgCode AS Codes,1 AS COUNT
FROM SysEnterprise WHERE IsHide='否' AND State='启用' ) A,
(SELECT '低风险' TYPE UNION ALL SELECT '一般风险' UNION ALL SELECT '较大风险' UNION ALL SELECT '重大风险') B GROUP BY B.type
</select>
<!-- 按风险等级筛选 -->
<select id= "countByRiskLevel" resultType= "java.lang.Integer" >
SELECT count(*) FROM SysEnterprise se
where se.IsHide='否' AND se.State='启用' and se.RiskLevel is not null
<if test= "null != riskLevel and '' != riskLevel " >
and se.RiskLevel = #{riskLevel}
</if>
</select>
<!-- 修改企业二维码 -->
<update id= "changeQrCode" >
UPDATE SysEnterprise SET qr_code = #{qrCode}
WHERE SysEnterpriseId = #{enterpriseId}
</update>
<!-- 所有企业 -->
<select id= "findByQrCode" resultMap= "BaseResultMap" >
SELECT se.* FROM SysEnterprise se
</select>
<!-- 通过名字查询前10条企业数据 -->
<select id= "findByNameTen" resultMap= "BaseResultMap" >
SELECT se.* FROM SysEnterprise se where se.EntName = #{entName} limit 10
</select>
<select id= "selectPCListMinProgram" resultMap= "BaseResultMap" >
select sys.*,org.OrgName,bc.IndustryClassName
from SysEnterprise sys
2022-12-29 16:49:37 +08:00
left join SysOrg org on sys.area_code = org.OrgCode
2022-09-16 15:07:17 +08:00
left join BaseInClass bc on sys.work_class_id = bc.BaseInClassId
where sys.State='启用'
<if test= "null != areaCode and '' != areaCode" >
2022-12-29 16:49:37 +08:00
AND FIND_IN_SET(#{areaCode},sys.area_path)
2022-09-16 15:07:17 +08:00
</if>
<if test= "null != entName and '' != entName" >
and sys.EntName like concat('%',#{entName},'%')
</if>
<if test= "null != riskLevel and '' != riskLevel" >
And sys.RiskLevel like concat('',#{riskLevel},'%')
</if>
<if test= "null != baseinclassid and '' != baseinclassid" >
And sys.work_class_id like concat('',#{baseinclassid},'%')
</if>
order by sys.ModifiedOn desc
</select>
<select id= "selectCreateOnIsNull" resultMap= "BaseResultMap" >
select * from SysEnterprise where CreatedOn is null and CreatedBy is null
</select>
<resultMap id= "AreaResultMap" type= "com.rzyc.model.ent.SysEnterprise" >
<id column= "SysEnterpriseId" jdbcType= "VARCHAR" property= "sysenterpriseid" />
<result column= "OrgCode" jdbcType= "VARCHAR" property= "orgcode" />
<result column= "communityName" jdbcType= "VARCHAR" property= "communityName" />
<result column= "SuperiorEnterpriseId" jdbcType= "VARCHAR" property= "superiorenterpriseid" />
<result column= "LowOrgCode" jdbcType= "VARCHAR" property= "loworgcode" />
<result column= "EntName" jdbcType= "VARCHAR" property= "entname" />
<result column= "IsHide" jdbcType= "VARCHAR" property= "isHide" />
<result column= "State" jdbcType= "VARCHAR" property= "state" />
<result column= "complite" jdbcType= "VARCHAR" property= "complite" />
<result column= "sysUnitId" jdbcType= "VARCHAR" property= "sysUnitId" />
<result column= "ManagerDept" jdbcType= "VARCHAR" property= "managerDept" />
<result column= "dynamicRiskLevel" jdbcType= "VARCHAR" property= "dynamicRiskLevel" />
<result column= "inherentRisk" jdbcType= "VARCHAR" property= "inherentRisk" />
<result column= "manageType" jdbcType= "VARCHAR" property= "manageType" />
<result column= "EntType" jdbcType= "VARCHAR" property= "enttype" />
<result column= "EntSection" jdbcType= "VARCHAR" property= "entsection" />
<result column= "BaseSafeClassId" jdbcType= "VARCHAR" property= "basesafeclassid" />
<result column= "BaseInClassId" jdbcType= "VARCHAR" property= "baseinclassid" />
<result column= "PinYin" jdbcType= "VARCHAR" property= "pinyin" />
<result column= "Principal" jdbcType= "VARCHAR" property= "principal" />
<result column= "SysAddress" jdbcType= "VARCHAR" property= "sysaddress" />
<result column= "safeManager" jdbcType= "VARCHAR" property= "safeManager" />
<result column= "safeTelephone" jdbcType= "VARCHAR" property= "safeTelephone" />
<result column= "PostCode" jdbcType= "VARCHAR" property= "postcode" />
<result column= "EcoType" jdbcType= "VARCHAR" property= "ecotype" />
<result column= "PersonCount" jdbcType= "INTEGER" property= "personcount" />
<result column= "EntLogoPic" jdbcType= "VARCHAR" property= "entlogopic" />
<result column= "MaleCode" jdbcType= "VARCHAR" property= "malecode" />
<result column= "OrgPassNo" jdbcType= "VARCHAR" property= "orgpassno" />
<result column= "LegalRepre" jdbcType= "VARCHAR" property= "legalrepre" />
<result column= "LRIDCard" jdbcType= "VARCHAR" property= "lridcard" />
<result column= "LRLinkTel" jdbcType= "VARCHAR" property= "lrlinktel" />
<result column= "EstablishDate" jdbcType= "TIMESTAMP" property= "establishdate" />
<result column= "RiskLevel" jdbcType= "VARCHAR" property= "risklevel" />
<result column= "Latitude" jdbcType= "VARCHAR" property= "latitude" />
<result column= "Longitude" jdbcType= "VARCHAR" property= "longitude" />
<result column= "IsBlackList" jdbcType= "VARCHAR" property= "isblacklist" />
<result column= "Comments" jdbcType= "VARCHAR" property= "comments" />
<result column= "treeNum" jdbcType= "INTEGER" property= "treeNum" />
<result column= "ISMaleCode" jdbcType= "VARCHAR" property= "ismalecode" />
<result column= "EntScore" jdbcType= "VARCHAR" property= "entscore" />
<result column= "EntHouseNum" jdbcType= "VARCHAR" property= "enthousenum" />
<result column= "CreatedOn" jdbcType= "TIMESTAMP" property= "createdon" />
<result column= "CreatedBy" jdbcType= "VARCHAR" property= "createdby" />
<result column= "ModifiedOn" jdbcType= "TIMESTAMP" property= "modifiedon" />
<result column= "ModifiedBy" jdbcType= "VARCHAR" property= "modifiedby" />
<result column= "IndustryClassName" jdbcType= "VARCHAR" property= "industryClassName" />
<result column= "superClassName" jdbcType= "VARCHAR" property= "superClassName" />
<result column= "OrgName" jdbcType= "VARCHAR" property= "orgName" />
<result column= "qr_code" jdbcType= "VARCHAR" property= "qrCode" />
<result column= "street_code" jdbcType= "VARCHAR" property= "streetCode" />
<result column= "choice_num" jdbcType= "INTEGER" property= "choiceNum" />
</resultMap>
<!-- 通过地区查询企业 -->
<select id= "findByArea" resultMap= "AreaResultMap" >
SELECT
se.*
FROM SysEnterprise se
WHERE se.`EntName` LIKE #{condition} and se.IsHide='否' AND se.State='启用'
AND se.`EntName` != '' AND se.EntName IS NOT NULL
2023-04-14 18:06:37 +08:00
AND FIND_IN_SET(#{areaCode},se.area_path)
2022-09-16 15:07:17 +08:00
<if test= "null != baseinclassid and '' != baseinclassid" >
AND se.work_class_id = #{baseinclassid}
</if>
order by se.choice_num asc,se.EntName ASC
limit 100
</select>
<resultMap id= "TreeResultMap" type= "com.rzyc.model.ent.SysEnterprise" >
<id column= "SysEnterpriseId" jdbcType= "VARCHAR" property= "sysenterpriseid" />
<result column= "OrgCode" jdbcType= "VARCHAR" property= "orgcode" />
<result column= "street_code" jdbcType= "VARCHAR" property= "streetCode" />
<result column= "community_code" jdbcType= "VARCHAR" property= "communityCode" />
<result column= "SuperiorEnterpriseId" jdbcType= "VARCHAR" property= "superiorenterpriseid" />
<result column= "LowOrgCode" jdbcType= "VARCHAR" property= "loworgcode" />
<result column= "EntName" jdbcType= "VARCHAR" property= "entname" />
<result column= "IsHide" jdbcType= "VARCHAR" property= "isHide" />
<result column= "State" jdbcType= "VARCHAR" property= "state" />
<result column= "complite" jdbcType= "VARCHAR" property= "complite" />
<result column= "sysUnitId" jdbcType= "VARCHAR" property= "sysUnitId" />
<result column= "ManagerDept" jdbcType= "VARCHAR" property= "managerDept" />
<result column= "dynamicRiskLevel" jdbcType= "VARCHAR" property= "dynamicRiskLevel" />
<result column= "inherentRisk" jdbcType= "VARCHAR" property= "inherentRisk" />
<result column= "manageType" jdbcType= "VARCHAR" property= "manageType" />
<result column= "EntType" jdbcType= "VARCHAR" property= "enttype" />
<result column= "EntSection" jdbcType= "VARCHAR" property= "entsection" />
<result column= "BaseSafeClassId" jdbcType= "VARCHAR" property= "basesafeclassid" />
<result column= "BaseInClassId" jdbcType= "VARCHAR" property= "baseinclassid" />
<result column= "PinYin" jdbcType= "VARCHAR" property= "pinyin" />
<result column= "Principal" jdbcType= "VARCHAR" property= "principal" />
<result column= "SysAddress" jdbcType= "VARCHAR" property= "sysaddress" />
<result column= "safeManager" jdbcType= "VARCHAR" property= "safeManager" />
<result column= "safeTelephone" jdbcType= "VARCHAR" property= "safeTelephone" />
<result column= "PostCode" jdbcType= "VARCHAR" property= "postcode" />
<result column= "EcoType" jdbcType= "VARCHAR" property= "ecotype" />
<result column= "PersonCount" jdbcType= "INTEGER" property= "personcount" />
<result column= "EntLogoPic" jdbcType= "VARCHAR" property= "entlogopic" />
<result column= "MaleCode" jdbcType= "VARCHAR" property= "malecode" />
<result column= "OrgPassNo" jdbcType= "VARCHAR" property= "orgpassno" />
<result column= "LegalRepre" jdbcType= "VARCHAR" property= "legalrepre" />
<result column= "LRIDCard" jdbcType= "VARCHAR" property= "lridcard" />
<result column= "LRLinkTel" jdbcType= "VARCHAR" property= "lrlinktel" />
<result column= "EstablishDate" jdbcType= "TIMESTAMP" property= "establishdate" />
<result column= "RiskLevel" jdbcType= "VARCHAR" property= "risklevel" />
<result column= "Latitude" jdbcType= "VARCHAR" property= "latitude" />
<result column= "Longitude" jdbcType= "VARCHAR" property= "longitude" />
<result column= "IsBlackList" jdbcType= "VARCHAR" property= "isblacklist" />
<result column= "Comments" jdbcType= "VARCHAR" property= "comments" />
<result column= "ISMaleCode" jdbcType= "VARCHAR" property= "ismalecode" />
<result column= "EntScore" jdbcType= "VARCHAR" property= "entscore" />
<result column= "EntHouseNum" jdbcType= "VARCHAR" property= "enthousenum" />
<result column= "CreatedOn" jdbcType= "TIMESTAMP" property= "createdon" />
<result column= "CreatedBy" jdbcType= "VARCHAR" property= "createdby" />
<result column= "ModifiedOn" jdbcType= "TIMESTAMP" property= "modifiedon" />
<result column= "ModifiedBy" jdbcType= "VARCHAR" property= "modifiedby" />
<result column= "IndustryClassName" jdbcType= "VARCHAR" property= "industryClassName" />
<result column= "superClassName" jdbcType= "VARCHAR" property= "superClassName" />
<result column= "OrgName" jdbcType= "VARCHAR" property= "orgName" />
<result column= "streetName" jdbcType= "VARCHAR" property= "streetName" />
<result column= "checkNum" jdbcType= "INTEGER" property= "checkNum" />
<result column= "communityName" jdbcType= "VARCHAR" property= "communityName" />
<result column= "qr_code" jdbcType= "VARCHAR" property= "qrCode" />
<result column= "street_code" jdbcType= "VARCHAR" property= "streetCode" />
</resultMap>
<!-- 责任树企业 -->
<select id= "dutyTreeEnt" resultMap= "TreeResultMap" >
SELECT se.*,
(
SELECT count(*) FROM `ChkPerson` cp
LEFT JOIN `BookEntCheck` bc
ON cp.`BookEntCheckId` = bc.`BookEntCheckId`
WHERE cp.`SysUserId` = #{userId}
AND bc.`BaseEntId` = dt.target_id
AND DATE_FORMAT(cp.CreatedOn,'%Y-%m')=DATE_FORMAT(NOW(),'%Y-%m')
)checkNum
FROM duty_tree dt
left join SysEnterprise se on dt.target_id = se.SysEnterpriseId
WHERE dt.user_id = #{userId} and dt.target_type = 2 and se.IsHide='否' AND se.State='启用'
</select>
<!-- 通过企业名 查询企业信息 -->
<select id= "findByName" resultMap= "BaseResultMap" >
SELECT * FROM SysEnterprise se WHERE se.`EntName` = #{entName}
</select>
<!-- 修改导入企业 -->
<update id= "changeImportEnt" >
update SysEnterprise
set OrgCode = #{orgcode,jdbcType=VARCHAR},
street_code = #{streetCode,jdbcType=VARCHAR},
community_code = #{communityCode,jdbcType=VARCHAR},
inherentRisk = #{inherentRisk,jdbcType=VARCHAR},
work_class_id = #{workClassId,jdbcType=VARCHAR},
BaseInClassId = #{baseinclassid,jdbcType=VARCHAR},
EntType = #{enttype,jdbcType=VARCHAR},
SysAddress = #{sysaddress,jdbcType=VARCHAR},
safeTelephone = #{safeTelephone,jdbcType=VARCHAR},
safeManager = #{safeManager,jdbcType=VARCHAR},
LegalRepre = #{legalrepre,jdbcType=VARCHAR},
LRLinkTel = #{lrlinktel,jdbcType=VARCHAR},
ModifiedOn = #{modifiedon,jdbcType=TIMESTAMP},
ModifiedBy = #{modifiedby,jdbcType=VARCHAR}
where SysEnterpriseId = #{sysenterpriseid,jdbcType=VARCHAR}
</update>
<!-- 修改企业信息 -->
<update id= "changeInclass" parameterType= "com.rzyc.model.ent.SysEnterprise" >
update SysEnterprise
set BaseInClassId = #{baseinclassid,jdbcType=VARCHAR},
ModifiedOn = #{modifiedon,jdbcType=TIMESTAMP},
ModifiedBy = #{modifiedby,jdbcType=VARCHAR}
where SysEnterpriseId = #{sysenterpriseid,jdbcType=VARCHAR}
</update>
<!-- 通过地区查询企业 -->
<select id= "findByAreaAll" resultMap= "AreaResultMap" >
SELECT
so.OrgName communityName, se.*
FROM SysEnterprise se
left join SysOrg so on se.community_code = so.OrgCode
WHERE se.State='启用'
AND se.`EntName` != '' AND se.EntName IS NOT NULL
2023-03-31 15:52:51 +08:00
AND FIND_IN_SET(#{areaCode},se.area_path)
2022-09-16 15:07:17 +08:00
</select>
<!-- 通过地区查询企业 -->
<select id= "exportByAreaAll" resultMap= "BaseResultMap" >
SELECT
se.*,cm.OrgName communityName
FROM SysEnterprise se
left join SysOrg cm on se.community_code = cm.OrgCode
WHERE se.State='启用'
AND se.`EntName` != '' AND se.EntName IS NOT NULL
AND (se.`OrgCode` = #{areaCode}
OR se.`street_code` = #{areaCode}
OR se.`community_code` = #{areaCode})
order by se.community_code asc
</select>
<!-- 小程序修改企业信息 -->
<update id= "changeEntWork" parameterType= "com.rzyc.model.ent.SysEnterprise" >
update SysEnterprise
<set >
<if test= "orgcode != null" >
OrgCode = #{orgcode,jdbcType=VARCHAR},
</if>
<if test= "streetCode != null" >
street_code = #{streetCode,jdbcType=VARCHAR},
</if>
<if test= "communityCode != null" >
community_code = #{communityCode,jdbcType=VARCHAR},
</if>
<if test= "loworgcode != null" >
LowOrgCode = #{loworgcode,jdbcType=VARCHAR},
</if>
<if test= "entname != null" >
EntName = #{entname,jdbcType=VARCHAR},
</if>
<if test= "sysUnitId != null" >
sysUnitId = #{sysUnitId,jdbcType=VARCHAR},
</if>
<if test= "managerDept != null" >
ManagerDept = #{managerDept,jdbcType=VARCHAR},
</if>
<if test= "dynamicRiskLevel != null" >
dynamicRiskLevel = #{dynamicRiskLevel,jdbcType=VARCHAR},
</if>
<if test= "inherentRisk != null" >
inherentRisk = #{inherentRisk,jdbcType=VARCHAR},
</if>
<if test= "manageType != null" >
manageType = #{manageType,jdbcType=VARCHAR},
</if>
<if test= "entsection != null" >
EntSection = #{entsection,jdbcType=VARCHAR},
</if>
<if test= "workClassId != null" >
work_class_id = #{workClassId,jdbcType=VARCHAR},
</if>
<if test= "principal != null" >
Principal = #{principal,jdbcType=VARCHAR},
</if>
<if test= "sysaddress != null" >
SysAddress = #{sysaddress,jdbcType=VARCHAR},
</if>
<if test= "safeTelephone != null" >
safeTelephone = #{safeTelephone,jdbcType=VARCHAR},
</if>
<if test= "safeManager != null" >
safeManager = #{safeManager,jdbcType=VARCHAR},
</if>
<if test= "postcode != null" >
PostCode = #{postcode,jdbcType=VARCHAR},
</if>
<if test= "personcount != null" >
PersonCount = #{personcount,jdbcType=INTEGER},
</if>
<if test= "entlogopic != null" >
EntLogoPic = #{entlogopic,jdbcType=VARCHAR},
</if>
<if test= "malecode != null" >
MaleCode = #{malecode,jdbcType=VARCHAR},
</if>
<if test= "orgpassno != null" >
OrgPassNo = #{orgpassno,jdbcType=VARCHAR},
</if>
<if test= "legalrepre != null" >
LegalRepre = #{legalrepre,jdbcType=VARCHAR},
</if>
<if test= "lridcard != null" >
LRIDCard = #{lridcard,jdbcType=VARCHAR},
</if>
<if test= "lrlinktel != null" >
LRLinkTel = #{lrlinktel,jdbcType=VARCHAR},
</if>
<if test= "establishdate != null" >
EstablishDate = #{establishdate,jdbcType=TIMESTAMP},
</if>
<if test= "enthousenum != null" >
EntHouseNum = #{enthousenum,jdbcType=VARCHAR},
</if>
<if test= "modifiedon != null" >
ModifiedOn = #{modifiedon,jdbcType=TIMESTAMP},
</if>
<if test= "modifiedby != null" >
ModifiedBy = #{modifiedby,jdbcType=VARCHAR},
</if>
</set>
where SysEnterpriseId = #{sysenterpriseid,jdbcType=VARCHAR}
</update>
<resultMap id= "orgEnterpriseList" type= "com.rzyc.bean.organization.vo.EnterpriseVo" >
<id column= "SysEnterpriseId" property= "sysEnterpriseId" />
<result column= "EntName" property= "entName" />
<result column= "IndustryClassName" property= "industryClassName" />
<result column= "SysAddress" property= "sysAddress" />
<result column= "isChoose" property= "isChoose" />
</resultMap>
<!-- 第三方机构获取企业信息 -->
<select id= "getEnterpriseList" resultMap= "orgEnterpriseList" >
select sys.EntName,sys.SysEnterpriseId,sys.SysAddress,org.OrgName,bc.IndustryClassName,organization.enterprise_id as isChoose
from SysEnterprise sys
left join SysOrg org on sys.OrgCode = org.OrgCode
left join BaseInClass bc on sys.work_class_id = bc.BaseInClassId
left join (
select enterprise_id
from org_enterprise
where organization_id = #{organizationId}
)as organization on organization.enterprise_id = sys.SysEnterpriseId
where sys.State='启用' and sys.street_code = '510114103000'
<if test= "null != areaCode and '' != areaCode" >
And ( sys.OrgCode = #{areaCode} or sys.street_code = #{areaCode}
or sys.community_code = #{areaCode})
</if>
<if test= "null != entName and '' != entName" >
and sys.EntName like concat('%',#{entName},'%')
</if>
<if test= "null != baseinclassid and '' != baseinclassid" >
And sys.work_class_id like concat('',#{baseinclassid},'%')
</if>
order by organization.enterprise_id desc,sys.`SysEnterpriseId` DESC
</select>
<!-- 三方机构获取管理企业 -->
<select id= "getManageEnterpriseList" resultMap= "orgEnterpriseList" >
select sys.EntName,sys.SysEnterpriseId,sys.SysAddress,bc.IndustryClassName
from SysEnterprise sys
left join BaseInClass bc on sys.work_class_id = bc.BaseInClassId
left join (
select enterprise_id
from org_enterprise
where organization_id = #{manageEnterpriseListDto.organizationId}
)as organization on organization.enterprise_id = sys.SysEnterpriseId
where sys.State='启用' and organization.enterprise_id !='' and organization.enterprise_id is not null
<if test= "null != manageEnterpriseListDto.entName and '' != manageEnterpriseListDto.entName" >
and sys.EntName like concat('%',#{manageEnterpriseListDto.entName},'%')
</if>
order by organization.enterprise_id desc,sys.`SysEnterpriseId` DESC
</select>
<!-- 查询企业名字及id -->
<select id= "getEnterpriseInfo" resultType= "hashmap" >
select SysEnterpriseId,EntName
from SysEnterprise
<if test= "name!=null and name!=''" >
where EntName like concat('%',#{name},'%')
</if>
</select>
<!-- 机构下企业列表 -->
<select id= "findByOrgId" resultMap= "BaseResultMap" >
SELECT se.* FROM `org_enterprise` og
LEFT JOIN SysEnterprise se ON og.`enterprise_id` = se.`SysEnterpriseId`
WHERE og.`organization_id` = #{organizationId}
</select>
<!-- 修改企业被选数量 -->
<update id= "changeChoiceNum" >
UPDATE SysEnterprise
SET choice_num = (SELECT COUNT(*) FROM `duty_tree` dt WHERE dt.`target_id` = SysEnterpriseId)
where SysEnterpriseId in
<foreach collection= "entIds" item= "entId" open= "(" close= ")" separator= "," >
#{entId}
</foreach>
</update>
<!-- 企业总数 -->
<select id= "countByAreaCode" resultType= "java.lang.Integer" >
SELECT count(*) FROM SysEnterprise se
WHERE se.`State` = '启用'
<if test= "null != workClassIds and workClassIds.size() > 0" >
and se.work_class_id in
<foreach collection= "workClassIds" item= "workClassId" open= "(" close= ")" separator= "," >
#{workClassId}
</foreach>
</if>
<if test= "null != entType" >
<if test= "1 == entType" >
and se.work_class_id = #{storageId}
</if>
<if test= "2 == entType" >
and (se.work_class_id != #{storageId} or se.work_class_id = '' or se.work_class_id is null)
</if>
</if>
AND (se.`OrgCode` = #{areaCode}
OR se.`street_code` = #{areaCode}
OR se.`community_code` = #{areaCode})
</select>
<!-- 机构统计 -->
<resultMap id= "OrganizationNumList" type= "com.rzyc.bean.organization.vo.OrganizationNum" >
<result column= "organization_id" property= "organizationId" />
<result column= "organization_name" property= "organizationName" />
<result column= "entNum" property= "entNum" />
</resultMap>
<!-- 机构统计 -->
<select id= "organizationNum" resultMap= "OrganizationNumList" >
SELECT ot.organization_id, ot.`organization_name`,COUNT(se.`SysEnterpriseId`) entNum
FROM `SysEnterprise` se
LEFT JOIN `org_enterprise` oe ON se.`SysEnterpriseId` = oe.`enterprise_id`
LEFT JOIN `organization` ot
ON oe.`organization_id` = ot.`organization_id`
and ot.org_type = #{orgType}
WHERE se.State = '启用' and (se.OrgCode = #{areaCode} or se.street_code = #{areaCode}
or se.community_code = #{areaCode})
<if test= "null != workClassIds and '' != workClassIds.size() > 0" >
and se.work_class_id in
<foreach collection= "workClassIds" open= "(" close= ")" separator= "," item= "workClassId" >
#{workClassId}
</foreach>
</if>
GROUP BY ot.organization_id, ot.`organization_name`
</select>
<!-- 地区数量统计 -->
<resultMap id= "AreaEntNumList" type= "com.rzyc.bean.organization.vo.AreaEntNum" >
<result column= "orgcode" property= "orgcode" />
<result column= "orgname" property= "orgname" />
<result column= "entNum" property= "entNum" />
</resultMap>
<!-- 地区数量统计 -->
<select id= "areaEntNum" resultMap= "AreaEntNumList" >
SELECT so.`OrgCode` orgcode,so.`OrgName` orgname,
(
SELECT COUNT(*) FROM `SysEnterprise` se
WHERE se.State = '启用'
<if test= "null != workClassIds and '' != workClassIds.size() > 0" >
and se.work_class_id in
<foreach collection= "workClassIds" open= "(" close= ")" separator= "," item= "workClassId" >
#{workClassId}
</foreach>
</if>
AND (se.OrgCode = so.OrgCode OR se.street_code = so.OrgCode
OR se.community_code = so.OrgCode)
) entNum
FROM SysOrg so
WHERE so.`SuperiorOrgCode` = #{areaCode}
</select>
<resultMap id= "EntListResultMap" type= "com.rzyc.model.ent.SysEnterprise" >
<id column= "SysEnterpriseId" jdbcType= "VARCHAR" property= "sysenterpriseid" />
<result column= "OrgCode" jdbcType= "VARCHAR" property= "orgcode" />
<result column= "street_code" jdbcType= "VARCHAR" property= "streetCode" />
<result column= "community_code" jdbcType= "VARCHAR" property= "communityCode" />
<result column= "SuperiorEnterpriseId" jdbcType= "VARCHAR" property= "superiorenterpriseid" />
<result column= "LowOrgCode" jdbcType= "VARCHAR" property= "loworgcode" />
<result column= "EntName" jdbcType= "VARCHAR" property= "entname" />
<result column= "IsHide" jdbcType= "VARCHAR" property= "isHide" />
<result column= "State" jdbcType= "VARCHAR" property= "state" />
<result column= "complite" jdbcType= "VARCHAR" property= "complite" />
<result column= "sysUnitId" jdbcType= "VARCHAR" property= "sysUnitId" />
<result column= "ManagerDept" jdbcType= "VARCHAR" property= "managerDept" />
<result column= "dynamicRiskLevel" jdbcType= "VARCHAR" property= "dynamicRiskLevel" />
<result column= "inherentRisk" jdbcType= "VARCHAR" property= "inherentRisk" />
<result column= "manageType" jdbcType= "VARCHAR" property= "manageType" />
<result column= "EntType" jdbcType= "VARCHAR" property= "enttype" />
<result column= "EntSection" jdbcType= "VARCHAR" property= "entsection" />
<result column= "BaseSafeClassId" jdbcType= "VARCHAR" property= "basesafeclassid" />
<result column= "BaseInClassId" jdbcType= "VARCHAR" property= "baseinclassid" />
<result column= "work_class_id" jdbcType= "VARCHAR" property= "workClassId" />
<result column= "workClassName" jdbcType= "VARCHAR" property= "workClassName" />
<result column= "PinYin" jdbcType= "VARCHAR" property= "pinyin" />
<result column= "Principal" jdbcType= "VARCHAR" property= "principal" />
<result column= "SysAddress" jdbcType= "VARCHAR" property= "sysaddress" />
<result column= "safeManager" jdbcType= "VARCHAR" property= "safeManager" />
<result column= "safeTelephone" jdbcType= "VARCHAR" property= "safeTelephone" />
<result column= "PostCode" jdbcType= "VARCHAR" property= "postcode" />
<result column= "EcoType" jdbcType= "VARCHAR" property= "ecotype" />
<result column= "PersonCount" jdbcType= "INTEGER" property= "personcount" />
<result column= "EntLogoPic" jdbcType= "VARCHAR" property= "entlogopic" />
<result column= "MaleCode" jdbcType= "VARCHAR" property= "malecode" />
<result column= "OrgPassNo" jdbcType= "VARCHAR" property= "orgpassno" />
<result column= "LegalRepre" jdbcType= "VARCHAR" property= "legalrepre" />
<result column= "LRIDCard" jdbcType= "VARCHAR" property= "lridcard" />
<result column= "LRLinkTel" jdbcType= "VARCHAR" property= "lrlinktel" />
<result column= "EstablishDate" jdbcType= "TIMESTAMP" property= "establishdate" />
<result column= "RiskLevel" jdbcType= "VARCHAR" property= "risklevel" />
<result column= "Latitude" jdbcType= "VARCHAR" property= "latitude" />
<result column= "Longitude" jdbcType= "VARCHAR" property= "longitude" />
<result column= "IsBlackList" jdbcType= "VARCHAR" property= "isblacklist" />
<result column= "Comments" jdbcType= "VARCHAR" property= "comments" />
<result column= "ISMaleCode" jdbcType= "VARCHAR" property= "ismalecode" />
<result column= "EntScore" jdbcType= "VARCHAR" property= "entscore" />
<result column= "EntHouseNum" jdbcType= "VARCHAR" property= "enthousenum" />
<result column= "CreatedOn" jdbcType= "TIMESTAMP" property= "createdon" />
<result column= "CreatedBy" jdbcType= "VARCHAR" property= "createdby" />
<result column= "ModifiedOn" jdbcType= "TIMESTAMP" property= "modifiedon" />
<result column= "ModifiedBy" jdbcType= "VARCHAR" property= "modifiedby" />
<result column= "IndustryClassName" jdbcType= "VARCHAR" property= "industryClassName" />
<result column= "superClassName" jdbcType= "VARCHAR" property= "superClassName" />
<result column= "OrgName" jdbcType= "VARCHAR" property= "orgName" />
<result column= "streetName" jdbcType= "VARCHAR" property= "streetName" />
<result column= "communityName" jdbcType= "VARCHAR" property= "communityName" />
<result column= "qr_code" jdbcType= "VARCHAR" property= "qrCode" />
<result column= "street_code" jdbcType= "VARCHAR" property= "streetCode" />
<result column= "checkCount" jdbcType= "INTEGER" property= "checkCount" />
<result column= "dangerCount" jdbcType= "INTEGER" property= "dangerCount" />
<result column= "rectifiedCount" jdbcType= "INTEGER" property= "rectifiedCount" />
<result column= "rectificationCount" jdbcType= "INTEGER" property= "rectificationCount" />
<result column= "notRectificationCount" jdbcType= "INTEGER" property= "notRectificationCount" />
</resultMap>
<!-- 机构监管企业列表分页 -->
<select id= "orgEntList" resultMap= "EntListResultMap" >
select se.*,org.OrgName,st.OrgName streetName,cm.OrgName communityName,bc.IndustryClassName workClassName
,
(
SELECT COUNT(DISTINCT od.batch_id) FROM `org_danger` od WHERE od.enterprise_id = se.`SysEnterpriseId`
) checkCount,
(
SELECT COUNT(*) FROM `org_danger` od WHERE od.enterprise_id = se.`SysEnterpriseId`
) dangerCount,
(
SELECT COUNT(*) FROM `org_danger` od WHERE od.enterprise_id = se.`SysEnterpriseId` AND od.status = 4
) rectifiedCount,
(
SELECT COUNT(*) FROM `org_danger` od WHERE od.enterprise_id = se.`SysEnterpriseId` AND od.status IN(2,3)
) rectificationCount,
(
SELECT COUNT(*) FROM `org_danger` od WHERE od.enterprise_id = se.`SysEnterpriseId` AND od.status = 1
) notRectificationCount
from SysEnterprise se
left join SysOrg org on se.OrgCode = org.OrgCode
left join SysOrg st on se.street_code = st.OrgCode
left join SysOrg cm on se.community_code = cm.OrgCode
LEFT JOIN `org_enterprise` oe ON se.`SysEnterpriseId` = oe.`enterprise_id`
LEFT JOIN `organization` ot ON oe.`organization_id` = ot.`organization_id`
left join BaseInClass bc on bc.BaseInClassId = se.work_class_id
where se.State='启用'
AND (se.`OrgCode` = #{areaCode}
OR se.`street_code` = #{areaCode}
OR se.`community_code` = #{areaCode})
<if test= "null != organizationId and '' != organizationId" >
AND oe.`organization_id` = #{organizationId}
</if>
<if test= "null == organizationId or '' == organizationId" >
AND oe.`organization_id` IS NULL
</if>
<if test= "null != entName and '' != entName" >
and se.EntName like concat('%',#{entName},'%')
</if>
<if test= "null != riskLevel and '' != riskLevel" >
And se.RiskLevel like concat('',#{riskLevel},'%')
</if>
<if test= "null != inherentRisk and '' != inherentRisk" >
And se.InherentRisk = #{inherentRisk}
</if>
<if test= "null != workClassIds and '' != workClassIds.size() > 0" >
and se.work_class_id in
<foreach collection= "workClassIds" open= "(" close= ")" separator= "," item= "workClassId" >
#{workClassId}
</foreach>
</if>
order by se.ModifiedOn desc , se.SysEnterpriseId desc
</select>
<resultMap id= "ExportResultMap" type= "com.rzyc.bean.check.EntExport" >
<result column= "EntName" jdbcType= "VARCHAR" property= "entname" />
<result column= "OrgName" jdbcType= "VARCHAR" property= "orgName" />
<result column= "streetName" jdbcType= "VARCHAR" property= "streetName" />
<result column= "communityName" jdbcType= "VARCHAR" property= "communityName" />
<result column= "inherentRisk" jdbcType= "VARCHAR" property= "inherentRisk" />
<result column= "workClassName" jdbcType= "VARCHAR" property= "workClassName" />
<result column= "SysAddress" jdbcType= "VARCHAR" property= "sysaddress" />
<result column= "LegalRepre" jdbcType= "VARCHAR" property= "legalrepre" />
<result column= "LRLinkTel" jdbcType= "VARCHAR" property= "lrlinktel" />
<result column= "RiskLevel" jdbcType= "VARCHAR" property= "risklevel" />
<result column= "checkCount" jdbcType= "INTEGER" property= "checkCount" />
<result column= "dangerCount" jdbcType= "INTEGER" property= "dangerCount" />
<result column= "rectifiedCount" jdbcType= "INTEGER" property= "rectifiedCount" />
<result column= "rectificationCount" jdbcType= "INTEGER" property= "rectificationCount" />
<result column= "notRectificationCount" jdbcType= "INTEGER" property= "notRectificationCount" />
</resultMap>
<!-- 机构监管企业列表分页 -->
<select id= "orgEntListExport" resultMap= "ExportResultMap" >
select se.*,org.OrgName,st.OrgName streetName,cm.OrgName communityName,bc.IndustryClassName workClassName
,
(
SELECT COUNT(DISTINCT od.batch_id) FROM `org_danger` od WHERE od.enterprise_id = se.`SysEnterpriseId`
) checkCount,
(
SELECT COUNT(*) FROM `org_danger` od WHERE od.enterprise_id = se.`SysEnterpriseId`
) dangerCount,
(
SELECT COUNT(*) FROM `org_danger` od WHERE od.enterprise_id = se.`SysEnterpriseId` AND od.status = 4
) rectifiedCount,
(
SELECT COUNT(*) FROM `org_danger` od WHERE od.enterprise_id = se.`SysEnterpriseId` AND od.status IN(2,3)
) rectificationCount,
(
SELECT COUNT(*) FROM `org_danger` od WHERE od.enterprise_id = se.`SysEnterpriseId` AND od.status = 1
) notRectificationCount
from SysEnterprise se
left join SysOrg org on se.OrgCode = org.OrgCode
left join SysOrg st on se.street_code = st.OrgCode
left join SysOrg cm on se.community_code = cm.OrgCode
LEFT JOIN `org_enterprise` oe ON se.`SysEnterpriseId` = oe.`enterprise_id`
LEFT JOIN `organization` ot ON oe.`organization_id` = ot.`organization_id`
left join BaseInClass bc on bc.BaseInClassId = se.work_class_id
where se.State='启用'
AND (se.`OrgCode` = #{areaCode}
OR se.`street_code` = #{areaCode}
OR se.`community_code` = #{areaCode})
<if test= "null != organizationId and '' != organizationId" >
AND oe.`organization_id` = #{organizationId}
</if>
<if test= "null == organizationId or '' == organizationId" >
AND oe.`organization_id` IS NULL
</if>
<if test= "null != entName and '' != entName" >
and se.EntName like concat('%',#{entName},'%')
</if>
<if test= "null != riskLevel and '' != riskLevel" >
And se.RiskLevel like concat('',#{riskLevel},'%')
</if>
<if test= "null != inherentRisk and '' != inherentRisk" >
And se.InherentRisk = #{inherentRisk}
</if>
<if test= "null != workClassIds and '' != workClassIds.size() > 0" >
and se.work_class_id in
<foreach collection= "workClassIds" open= "(" close= ")" separator= "," item= "workClassId" >
#{workClassId}
</foreach>
</if>
order by se.ModifiedOn desc , se.SysEnterpriseId desc
</select>
<!-- 机构监管企业列表分页 -->
<select id= "countOrgEnt" resultType= "java.lang.Integer" >
select count(*)
from SysEnterprise se
LEFT JOIN `org_enterprise` oe ON se.`SysEnterpriseId` = oe.`enterprise_id`
LEFT JOIN `organization` ot ON oe.`organization_id` = ot.`organization_id`
where se.State='启用'
AND (se.`OrgCode` = #{areaCode}
OR se.`street_code` = #{areaCode}
OR se.`community_code` = #{areaCode})
<if test= "null != organizationId and '' != organizationId" >
AND oe.`organization_id` = #{organizationId}
</if>
<if test= "null == organizationId or '' == organizationId" >
AND oe.`organization_id` IS NULL
</if>
<if test= "null != entName and '' != entName" >
and se.EntName like concat('%',#{entName},'%')
</if>
<if test= "null != riskLevel and '' != riskLevel" >
And se.RiskLevel like concat('',#{riskLevel},'%')
</if>
<if test= "null != inherentRisk and '' != inherentRisk" >
And se.InherentRisk = #{inherentRisk}
</if>
<if test= "null != workClassIds and '' != workClassIds.size() > 0" >
and se.work_class_id in
<foreach collection= "workClassIds" open= "(" close= ")" separator= "," item= "workClassId" >
#{workClassId}
</foreach>
</if>
</select>
<!-- 地区企业列表分页 -->
<select id= "areaEntList" resultMap= "EntListResultMap" >
select se.*,org.OrgName,st.OrgName streetName,cm.OrgName communityName,bc.IndustryClassName workClassName
,
(
SELECT COUNT(DISTINCT od.batch_id) FROM `org_danger` od WHERE od.enterprise_id = se.`SysEnterpriseId`
) checkCount,
(
SELECT COUNT(*) FROM `org_danger` od WHERE od.enterprise_id = se.`SysEnterpriseId`
) dangerCount,
(
SELECT COUNT(*) FROM `org_danger` od WHERE od.enterprise_id = se.`SysEnterpriseId` AND od.status = 4
) rectifiedCount,
(
SELECT COUNT(*) FROM `org_danger` od WHERE od.enterprise_id = se.`SysEnterpriseId` AND od.status IN(2,3)
) rectificationCount,
(
SELECT COUNT(*) FROM `org_danger` od WHERE od.enterprise_id = se.`SysEnterpriseId` AND od.status = 1
) notRectificationCount
from SysEnterprise se
left join SysOrg org on se.OrgCode = org.OrgCode
left join SysOrg st on se.street_code = st.OrgCode
left join SysOrg cm on se.community_code = cm.OrgCode
LEFT JOIN `org_enterprise` oe ON se.`SysEnterpriseId` = oe.`enterprise_id`
LEFT JOIN `organization` ot ON oe.`organization_id` = ot.`organization_id`
left join BaseInClass bc on bc.BaseInClassId = se.work_class_id
where se.State='启用'
AND (se.`OrgCode` = #{areaCode}
OR se.`street_code` = #{areaCode}
OR se.`community_code` = #{areaCode})
<if test= "null != entName and '' != entName" >
and se.EntName like concat('%',#{entName},'%')
</if>
<if test= "null != riskLevel and '' != riskLevel" >
And se.RiskLevel like concat('',#{riskLevel},'%')
</if>
<if test= "null != inherentRisk and '' != inherentRisk" >
And se.InherentRisk = #{inherentRisk}
</if>
<if test= "null != workClassIds and '' != workClassIds.size() > 0" >
and se.work_class_id in
<foreach collection= "workClassIds" open= "(" close= ")" separator= "," item= "workClassId" >
#{workClassId}
</foreach>
</if>
order by se.ModifiedOn desc , se.SysEnterpriseId desc
</select>
<!-- 地区企业列表分页 -->
<select id= "areaEntListExport" resultMap= "ExportResultMap" >
select se.*,org.OrgName,st.OrgName streetName,cm.OrgName communityName,bc.IndustryClassName workClassName
,
(
SELECT COUNT(DISTINCT od.batch_id) FROM `org_danger` od WHERE od.enterprise_id = se.`SysEnterpriseId`
) checkCount,
(
SELECT COUNT(*) FROM `org_danger` od WHERE od.enterprise_id = se.`SysEnterpriseId`
) dangerCount,
(
SELECT COUNT(*) FROM `org_danger` od WHERE od.enterprise_id = se.`SysEnterpriseId` AND od.status = 4
) rectifiedCount,
(
SELECT COUNT(*) FROM `org_danger` od WHERE od.enterprise_id = se.`SysEnterpriseId` AND od.status IN(2,3)
) rectificationCount,
(
SELECT COUNT(*) FROM `org_danger` od WHERE od.enterprise_id = se.`SysEnterpriseId` AND od.status = 1
) notRectificationCount
from SysEnterprise se
left join SysOrg org on se.OrgCode = org.OrgCode
left join SysOrg st on se.street_code = st.OrgCode
left join SysOrg cm on se.community_code = cm.OrgCode
LEFT JOIN `org_enterprise` oe ON se.`SysEnterpriseId` = oe.`enterprise_id`
LEFT JOIN `organization` ot ON oe.`organization_id` = ot.`organization_id`
left join BaseInClass bc on bc.BaseInClassId = se.work_class_id
where se.State='启用'
AND (se.`OrgCode` = #{areaCode}
OR se.`street_code` = #{areaCode}
OR se.`community_code` = #{areaCode})
<if test= "null != entName and '' != entName" >
and se.EntName like concat('%',#{entName},'%')
</if>
<if test= "null != riskLevel and '' != riskLevel" >
And se.RiskLevel like concat('',#{riskLevel},'%')
</if>
<if test= "null != inherentRisk and '' != inherentRisk" >
And se.InherentRisk = #{inherentRisk}
</if>
<if test= "null != workClassIds and '' != workClassIds.size() > 0" >
and se.work_class_id in
<foreach collection= "workClassIds" open= "(" close= ")" separator= "," item= "workClassId" >
#{workClassId}
</foreach>
</if>
order by se.ModifiedOn desc , se.SysEnterpriseId desc
</select>
<!-- 地区企业列表总数 -->
<select id= "countAreaEnt" resultType= "java.lang.Integer" >
select count(*)
from SysEnterprise se
LEFT JOIN `org_enterprise` oe ON se.`SysEnterpriseId` = oe.`enterprise_id`
LEFT JOIN `organization` ot ON oe.`organization_id` = ot.`organization_id`
where se.State='启用'
AND (se.`OrgCode` = #{areaCode}
OR se.`street_code` = #{areaCode}
OR se.`community_code` = #{areaCode})
<if test= "null != entName and '' != entName" >
and se.EntName like concat('%',#{entName},'%')
</if>
<if test= "null != riskLevel and '' != riskLevel" >
And se.RiskLevel like concat('',#{riskLevel},'%')
</if>
<if test= "null != inherentRisk and '' != inherentRisk" >
And se.InherentRisk = #{inherentRisk}
</if>
<if test= "null != workClassIds and '' != workClassIds.size() > 0" >
and se.work_class_id in
<foreach collection= "workClassIds" open= "(" close= ")" separator= "," item= "workClassId" >
#{workClassId}
</foreach>
</if>
</select>
<resultMap id= "dangerDetaiManagerDtoMap" type= "com.rzyc.bean.organization.vo.DangerDetaiManagerlVo" >
<result column= "danger_id" property= "dangerId" />
<result column= "EntName" property= "entName" />
<result column= "organization_name" property= "organizationName" />
<result column= "create_time" property= "createTime" />
<result column= "OrgName" property= "streetName" />
<result column= "community_name" property= "communityName" />
<result column= "level" property= "level" />
<result column= "status" property= "status" />
<result column= "book_type_id" property= "bookTypeId" />
<result column= "book_name" property= "bookName" />
</resultMap>
<!-- 后台隐患列表 -->
<select id= "dangerEnt" resultMap= "BaseResultMap" >
SELECT distinct sys.*,
com.OrgName as communityName,
org.OrgName streetName,bc.IndustryClassName workClassName
from org_danger as danger
LEFT JOIN SysEnterprise as sys on sys.SysEnterpriseId = danger.enterprise_id
LEFT JOIN SysOrg as org on org.OrgCode = sys.street_code
left join SysOrg as com on com.OrgCode = sys.community_code
LEFT JOIN organization as orga on orga.organization_id = danger.organization_id
left join org_book_type as type on type.book_type_id = danger.book_type
left join BaseInClass bc on bc.BaseInClassId = sys.work_class_id
where (sys.`OrgCode` = #{statistics.streetCode}
OR sys.`street_code` = #{statistics.streetCode}
OR sys.`community_code` = #{statistics.streetCode})
and danger.org_type = #{statistics.orgType}
<if test= "statistics.status!=null" >
<if test= "statistics.status==2 or statistics.status==3" >
and (danger.status = 2 or danger.status = 3)
</if>
<if test= "statistics.status==1 or statistics.status==4" >
and danger.status = #{statistics.status}
</if>
</if>
<if test= "statistics.level!=null" >
and danger.level = #{statistics.level}
</if>
<if test= "statistics.communityCode!=null and statistics.communityCode!=''" >
and sys.community_code = #{statistics.communityCode}
</if>
<if test= "statistics.organizationId!=null and statistics.organizationId!=''" >
and danger.organization_id = #{statistics.organizationId}
</if>
<!--
<if test= "statistics.bookTypeId!=null and statistics.bookTypeId!=''" >
and danger.book_type = #{statistics.bookTypeId}
</if>
-->
<if test= "statistics.enterpriseName!=null and statistics.enterpriseName!=''" >
and sys.EntName like concat('%',#{statistics.enterpriseName},'%')
</if>
<if test= "statistics.createTime!=null" >
and danger.create_time > #{statistics.createTime}
</if>
<if test= "statistics.endTime!=null" >
and #{statistics.endTime} > danger.create_time
</if>
<if test= "statistics.name!=null and statistics.name!=''" >
and (sys.EntName like concat('%',#{statistics.name},'%') or danger.content like concat('%',#{statistics.name},'%'))
</if>
<if test= "bookTypes != null and bookTypes.size() > 0" >
and danger.book_type in
<foreach collection= "bookTypes" item= "bookType" separator= "," close= ")" open= "(" >
#{bookType}
</foreach>
</if>
<if test= "workClassIds != null and workClassIds.size() > 0" >
and sys.work_class_id in
<foreach collection= "workClassIds" item= "workClassId" separator= "," close= ")" open= "(" >
#{workClassId}
</foreach>
</if>
</select>
<!-- 修改企业地区 -->
<update id= "changeCommunityCode" >
UPDATE SysEnterprise
SET community_code = #{communityCode},
ModifiedOn = now(),
ModifiedBy = '导入'
WHERE SysEnterpriseId = #{enterpriseId}
</update>
<!-- 街道检查情况 -->
<resultMap id= "StreetEntCheckResultMap" type= "com.rzyc.bean.export.StreetEntCheck" >
<result column= "oprgName" jdbcType= "VARCHAR" property= "oprgName" />
<result column= "entNum" jdbcType= "VARCHAR" property= "entNum" />
<result column= "checkNum" jdbcType= "VARCHAR" property= "checkNum" />
<result column= "checkEntNum" jdbcType= "VARCHAR" property= "checkEntNum" />
</resultMap>
<!-- 街道检查情况 -->
<select id= "streetEntCheck" resultMap= "StreetEntCheckResultMap" >
select so.OrgCode,so.OrgName oprgName,
count( distinct se.SysEnterpriseId) entNum,
count(bc.BookEntCheckId) checkNum,
count(distinct bc.BaseEntId) checkEntNum
from SysEnterprise se
left join SysOrg so on se.street_code = so.OrgCode
left join BookEntCheck bc
on se.SysEnterpriseId = bc.BaseEntId
<if test= "null != startTime and '' != startTime" >
and bc.CreatedOn >= #{startTime}
</if>
<if test= "null != endTime and '' != endTime" >
and bc.CreatedOn < = #{endTime}
</if>
where se.State = '启用' and se.street_code != '' and se.street_code is not null
<if test= "null != inherentRisks and inherentRisks.size() > 0" >
and se.InherentRisk in
<foreach collection= "inherentRisks" item= "inherentRisk" open= "(" close= ")" separator= "," >
#{inherentRisk}
</foreach>
</if>
group by so.OrgCode,so.OrgName
order by so.OrgCode asc
<if test= "null != start and null != end" >
limit #{start},#{end}
</if>
</select>
<!-- 街道检查情况总数 -->
<select id= "countStreetEntCheck" resultType= "java.lang.Long" >
select count(*) from SysOrg so
</select>
<!-- 机构企业导出 -->
<resultMap id= "OrgEntResultMap" type= "com.rzyc.bean.ent.OrgEntInfo" >
<result column= "EntName" jdbcType= "VARCHAR" property= "entname" />
<result column= "OrgName" jdbcType= "VARCHAR" property= "orgName" />
<result column= "organization_name" jdbcType= "VARCHAR" property= "organizationName" />
<result column= "streetName" jdbcType= "VARCHAR" property= "streetName" />
<result column= "communityName" jdbcType= "VARCHAR" property= "communityName" />
<result column= "inherentRisk" jdbcType= "VARCHAR" property= "inherentRisk" />
<result column= "workClassName" jdbcType= "VARCHAR" property= "workClassName" />
<result column= "SysAddress" jdbcType= "VARCHAR" property= "sysaddress" />
<result column= "LegalRepre" jdbcType= "VARCHAR" property= "legalrepre" />
<result column= "LRLinkTel" jdbcType= "VARCHAR" property= "lrlinktel" />
<result column= "RiskLevel" jdbcType= "VARCHAR" property= "risklevel" />
<result column= "checkCount" jdbcType= "INTEGER" property= "checkCount" />
<result column= "dangerCount" jdbcType= "INTEGER" property= "dangerCount" />
<result column= "rectifiedCount" jdbcType= "INTEGER" property= "rectifiedCount" />
<result column= "rectificationCount" jdbcType= "INTEGER" property= "rectificationCount" />
<result column= "notRectificationCount" jdbcType= "INTEGER" property= "notRectificationCount" />
</resultMap>
<!-- 机构企业导出 -->
<select id= "oegEntExport" resultMap= "OrgEntResultMap" >
SELECT com.OrgName AS communityName,
org.OrgName streetName,bc.IndustryClassName workClassName,ot.organization_name,
se.*,
(
SELECT COUNT(DISTINCT od.batch_id) FROM `org_danger` od WHERE od.enterprise_id = se.`SysEnterpriseId`
) checkCount,
(
SELECT COUNT(*) FROM `org_danger` od WHERE od.enterprise_id = se.`SysEnterpriseId`
) dangerCount,
(
SELECT COUNT(*) FROM `org_danger` od WHERE od.enterprise_id = se.`SysEnterpriseId` AND od.status = 4
) rectifiedCount,
(
SELECT COUNT(*) FROM `org_danger` od WHERE od.enterprise_id = se.`SysEnterpriseId` AND od.status IN(2,3)
) rectificationCount,
(
SELECT COUNT(*) FROM `org_danger` od WHERE od.enterprise_id = se.`SysEnterpriseId` AND od.status = 1
) notRectificationCount
FROM SysEnterprise se
LEFT JOIN SysOrg AS org ON org.OrgCode = se.street_code
LEFT JOIN SysOrg AS com ON com.OrgCode = se.community_code
LEFT JOIN BaseInClass bc ON bc.BaseInClassId = se.work_class_id
LEFT JOIN org_enterprise oe ON oe.enterprise_id = se.SysEnterpriseId
LEFT JOIN organization ot ON oe.organization_id = ot.organization_id
WHERE se.State = '启用'
<if test= "workClassIds != null and workClassIds.size() > 0" >
and se.work_class_id in
<foreach collection= "workClassIds" item= "workClassId" separator= "," close= ")" open= "(" >
#{workClassId}
</foreach>
</if>
AND (se.`OrgCode` = #{areaCode}
OR se.`street_code` = #{areaCode}
OR se.`community_code` = #{areaCode})
order by se.street_code asc,se.community_code asc
</select>
<resultMap id= "AreaEntExportResultMap" type= "com.rzyc.bean.check.EntAllExport" >
<result column= "EntName" jdbcType= "VARCHAR" property= "entname" />
<result column= "OrgName" jdbcType= "VARCHAR" property= "orgName" />
<result column= "streetName" jdbcType= "VARCHAR" property= "streetName" />
<result column= "communityName" jdbcType= "VARCHAR" property= "communityName" />
<result column= "inherentRisk" jdbcType= "VARCHAR" property= "inherentRisk" />
<result column= "workClassName" jdbcType= "VARCHAR" property= "workClassName" />
<result column= "organization_name" jdbcType= "VARCHAR" property= "organizationName" />
<result column= "SysAddress" jdbcType= "VARCHAR" property= "sysaddress" />
<result column= "LegalRepre" jdbcType= "VARCHAR" property= "legalrepre" />
<result column= "LRLinkTel" jdbcType= "VARCHAR" property= "lrlinktel" />
<result column= "RiskLevel" jdbcType= "VARCHAR" property= "risklevel" />
<result column= "checkCount" jdbcType= "INTEGER" property= "checkCount" />
<result column= "dangerCount" jdbcType= "INTEGER" property= "dangerCount" />
<result column= "rectifiedCount" jdbcType= "INTEGER" property= "rectifiedCount" />
<result column= "rectificationCount" jdbcType= "INTEGER" property= "rectificationCount" />
<result column= "notRectificationCount" jdbcType= "INTEGER" property= "notRectificationCount" />
<result column= "majorNum" jdbcType= "INTEGER" property= "majorNum" />
<result column= "commonlyNum" jdbcType= "INTEGER" property= "commonlyNum" />
<result column= "electricNum" jdbcType= "INTEGER" property= "electricNum" />
</resultMap>
<!-- 机构企业导出 -->
<select id= "areaEntExport" resultMap= "AreaEntExportResultMap" >
SELECT com.OrgName AS communityName,
org.OrgName streetName,bc.IndustryClassName workClassName,ot.organization_name,
se.*,
(
SELECT COUNT(DISTINCT od.batch_id) FROM `org_danger` od WHERE od.enterprise_id = se.`SysEnterpriseId`
) checkCount,
(
SELECT COUNT(*) FROM `org_danger` od WHERE od.enterprise_id = se.`SysEnterpriseId`
) dangerCount,
(
SELECT COUNT(*) FROM `org_danger` od WHERE od.enterprise_id = se.`SysEnterpriseId` and od.level = 1
) majorNum,
(
SELECT COUNT(*) FROM `org_danger` od WHERE od.enterprise_id = se.`SysEnterpriseId` and od.level = 2
) commonlyNum,
(
SELECT COUNT(*) FROM `org_danger` od WHERE od.enterprise_id = se.`SysEnterpriseId` and od.book_type = #{bookType}
) electricNum,
(
SELECT COUNT(*) FROM `org_danger` od WHERE od.enterprise_id = se.`SysEnterpriseId` AND od.status = 4
) rectifiedCount,
(
SELECT COUNT(*) FROM `org_danger` od WHERE od.enterprise_id = se.`SysEnterpriseId` AND od.status IN(2,3)
) rectificationCount,
(
SELECT COUNT(*) FROM `org_danger` od WHERE od.enterprise_id = se.`SysEnterpriseId` AND od.status = 1
) notRectificationCount
FROM SysEnterprise se
LEFT JOIN SysOrg AS org ON org.OrgCode = se.street_code
LEFT JOIN SysOrg AS com ON com.OrgCode = se.community_code
LEFT JOIN BaseInClass bc ON bc.BaseInClassId = se.work_class_id
left join org_enterprise oe on se.SysEnterpriseId = oe.enterprise_id
left join organization ot on oe.organization_id = ot.organization_id
WHERE se.State = '启用'
<if test= "workClassIds != null and workClassIds.size() > 0" >
and se.work_class_id in
<foreach collection= "workClassIds" item= "workClassId" separator= "," close= ")" open= "(" >
#{workClassId}
</foreach>
</if>
AND (se.`OrgCode` = #{areaCode}
OR se.`street_code` = #{areaCode}
OR se.`community_code` = #{areaCode})
order by se.street_code asc,se.community_code asc
</select>
<!-- 未检查企业 -->
<select id= "notCheckEnt" resultMap= "BaseResultMap" >
select
st.OrgName streetName,cm.OrgName communityName,bc.IndustryClassName workClassName,
se.*
from
SysEnterprise se
left join SysOrg st on st.OrgCode = se.street_code
left join SysOrg cm on cm.OrgCode = se.community_code
LEFT JOIN BaseInClass bc ON bc.BaseInClassId = se.work_class_id
where se.State = '启用'
<if test= "null != inherentRisks and inherentRisks.size() > 0" >
and se.InherentRisk in
<foreach collection= "inherentRisks" item= "inherentRisk" open= "(" close= ")" separator= "," >
#{inherentRisk}
</foreach>
</if>
<if test= "null != areaCode and '' != areaCode" >
AND (se.`OrgCode` = #{areaCode}
OR se.`street_code` = #{areaCode}
OR se.`community_code` = #{areaCode})
</if>
and (select count(*) from BookEntCheck bc
where bc.BaseEntId = se.SysEnterpriseId
<if test= "null != startTime and '' != startTime" >
and bc.CreatedOn >= #{startTime}
</if>
<if test= "null != endTime and '' != endTime" >
and bc.CreatedOn < = #{endTime}
</if>
) = 0
order by se.street_code asc,se.community_code asc
</select>
<!-- 部门检查数量 -->
<select id= "unitCheckNum" resultType= "java.lang.Integer" >
select count(*) from
(
select se.SysEnterpriseId
from BookEntCheck bc
left join ChkPerson cp on bc.BookEntCheckId = cp.BookEntCheckId
left join SysUser su on su.SysUserId = cp.SysUserId
left join ListPerform lf on su.SysTitle = lf.ListPerformId
left join ListPerform sp on lf.SupClassId = sp.ListPerformId
left join SysEnterprise se on bc.BaseEntId = se.SysEnterpriseId
where su.State = '启用' and se.State = '启用'
and sp.SupClassId = #{supClassId}
and YEAR(bc.CreatedOn)= YEAR(NOW())
<if test= "null != inherentRisk" >
and se.InherentRisk = #{inherentRisk}
</if>
group by se.SysEnterpriseId
) a
</select>
<!-- 街道检查信息 -->
<resultMap id= "StreetInfoResultMap" type= "com.rzyc.bean.bigdata.StreetInfo" >
<result column= "OrgCode" jdbcType= "VARCHAR" property= "orgcode" />
<result column= "OrgName" jdbcType= "VARCHAR" property= "orgname" />
<result column= "blueNum" jdbcType= "INTEGER" property= "blueNum" />
<result column= "yellowNum" jdbcType= "INTEGER" property= "yellowNum" />
<result column= "orangeNum" jdbcType= "INTEGER" property= "orangeNum" />
<result column= "redNum" jdbcType= "INTEGER" property= "redNum" />
<result column= "commonlyNum" jdbcType= "INTEGER" property= "commonlyNum" />
<result column= "majorNum" jdbcType= "INTEGER" property= "majorNum" />
<result column= "rectifyedNum" jdbcType= "INTEGER" property= "rectifyedNum" />
<result column= "notRectifyNum" jdbcType= "INTEGER" property= "notRectifyNum" />
<result column= "rectifyingNum" jdbcType= "INTEGER" property= "rectifyingNum" />
</resultMap>
<!-- 街道检查信息 -->
<select id= "streetInfo" resultMap= "StreetInfoResultMap" >
select so.OrgCode,so.OrgName ,
SUM(case when se.InherentRisk = 1 then 1 else 0 end ) blueNum,
SUM(case when se.InherentRisk = 2 then 1 else 0 end ) yellowNum,
SUM(case when se.InherentRisk = 3 then 1 else 0 end ) orangeNum,
SUM(case when se.InherentRisk = 4 then 1 else 0 end ) redNum,
SUM(case when be.HTLevel = '一般隐患' then 1 else 0 end ) commonlyNum,
SUM(case when be.HTLevel = '重大隐患' then 1 else 0 end ) majorNum,
SUM(case when be.HTState = '已整改' then 1 else 0 end ) rectifyedNum,
SUM(case when be.HTState = '未整改' then 1 else 0 end ) notRectifyNum,
SUM(case when be.HTState = '整改中' then 1 else 0 end ) rectifyingNum
from SysOrg so
left join SysEnterprise se on so.OrgCode = se.street_code
left join BookEntHT be on se.SysEnterpriseId = be.SysEnterpriseId and YEAR(be.CreatedOn)= YEAR(NOW())
where so.SuperiorOrgCode = #{parentId} and se.State = '启用'
group by so.OrgCode
order by so.OrgCode asc
</select>
<!-- 属地检查数量 -->
<select id= "areaCheckNum" resultType= "java.lang.Integer" >
select count(*) from
(
select se.SysEnterpriseId
from BookEntCheck bc
left join ChkPerson cp on bc.BookEntCheckId = cp.BookEntCheckId
left join SysUser su on su.SysUserId = cp.SysUserId
left join SysOrg so on su.street_code = so.OrgCode
left join SysEnterprise se on bc.BaseEntId = se.SysEnterpriseId
where su.State = '启用' and se.State = '启用'
and YEAR(bc.CreatedOn)= YEAR(NOW())
<if test= "null != inherentRisk" >
and se.InherentRisk = #{inherentRisk}
</if>
and so.org_type = #{orgType}
group by se.SysEnterpriseId
) a;
</select>
<!-- 企业总数 -->
<select id= "countAll" resultType= "java.lang.Integer" >
select count(*) from SysEnterprise se
where se.State = '启用'
<if test= "null != areaCode and '' != areaCode" >
2023-02-16 17:13:59 +08:00
AND FIND_IN_SET(#{areaCode},se.area_path)
2022-09-16 15:07:17 +08:00
</if>
</select>
<!-- 已检查企业 -->
<select id= "checkedNum" resultType= "java.lang.Integer" >
select count(distinct se.SysEnterpriseId)
from SysEnterprise se
left join org_batch ob on se.SysEnterpriseId = ob.enterprise_id
and YEAR(ob.create_time)=YEAR(NOW())
where ob.batch_id is not null
and se.State = '启用'
<if test= "null != areaCode and '' != areaCode" >
and se.street_code = #{areaCode}
</if>
</select>
<!-- 未检查企业数 -->
<select id= "notCheckNum" resultType= "java.lang.Integer" >
select count(distinct se.SysEnterpriseId)
from SysEnterprise se
left join org_batch ob on se.SysEnterpriseId = ob.enterprise_id
and YEAR(ob.create_time)=YEAR(NOW())
where ob.batch_id is null
and se.State = '启用'
<if test= "null != areaCode and '' != areaCode" >
and se.street_code = #{areaCode}
</if>
</select>
<!-- 企业风险分布 -->
<resultMap id= "EntRiskNumResultMap" type= "com.rzyc.bean.bigdata.check.OrgEntRiskNum" >
<result column= "entTotal" jdbcType= "INTEGER" property= "entTotal" />
<result column= "yellowNum" jdbcType= "INTEGER" property= "yellowNum" />
<result column= "orangeNum" jdbcType= "INTEGER" property= "orangeNum" />
<result column= "redNum" jdbcType= "INTEGER" property= "redNum" />
</resultMap>
<!-- 机构服务企业风险分布 -->
<select id= "orgEntNum" resultMap= "EntRiskNumResultMap" >
select count(distinct se.SysEnterpriseId) entTotal,
SUM(case when se.InherentRisk = 2 then 1 else 0 end ) yellowNum,
SUM(case when se.InherentRisk = 3 then 1 else 0 end ) orangeNum,
SUM(case when se.InherentRisk = 4 then 1 else 0 end ) redNum
from SysEnterprise se
left join org_enterprise oe on se.SysEnterpriseId = oe.enterprise_id
left join organization ot on oe.organization_id = ot.organization_id
where se.State = '启用'
and ot.organization_id is not null
and ot.org_type = 1
<if test= "null != areaCode and '' != areaCode" >
and se.street_code = #{areaCode}
</if>
</select>
<!-- 无机构服务企业风险分布 -->
<select id= "notOrgEntNum" resultMap= "EntRiskNumResultMap" >
select count(distinct se.SysEnterpriseId) entTotal,
SUM(case when se.InherentRisk = 2 then 1 else 0 end ) yellowNum,
SUM(case when se.InherentRisk = 3 then 1 else 0 end ) orangeNum,
SUM(case when se.InherentRisk = 4 then 1 else 0 end ) redNum
from SysEnterprise se
left join org_enterprise oe on se.SysEnterpriseId = oe.enterprise_id
left join organization ot on oe.organization_id = ot.organization_id
where se.State = '启用'
and (ot.organization_id is null or ot.org_type = 2)
<if test= "null != areaCode and '' != areaCode" >
and se.street_code = #{areaCode}
</if>
</select>
<!-- 行业风险 -->
<resultMap id= "IndustryRiskResultMap" type= "com.rzyc.bean.bigdata.check.IndustryRisk" >
<result column= "IndustryClassName" jdbcType= "INTEGER" property= "name" />
<result column= "dangerNum" jdbcType= "INTEGER" property= "dangerNum" />
</resultMap>
<!-- 行业风险 -->
<select id= "industryRisk" resultMap= "IndustryRiskResultMap" >
select bc.IndustryClassName,count(bc.BaseInClassId) dangerNum
from BookEntHT be
left join SysEnterprise se on be.SysEnterpriseId = se.SysEnterpriseId
left join BaseInClass bc on se.work_class_id = bc.BaseInClassId
where se.State = '启用' and be.HTState != '已整改'
<if test= "null != areaCode and '' != areaCode" >
and se.street_code = #{areaCode}
</if>
group by bc.BaseInClassId
order by dangerNum desc limit 8;
</select>
<!-- 企业分页 -->
<select id= "entPage" resultMap= "BaseResultMap" >
select *
from SysEnterprise se
where se.State = '启用'
<if test= "null != areaCode and '' != areaCode" >
and se.street_code = #{areaCode}
</if>
order by se.street_code asc
</select>
<!-- 街道检查数量 -->
<select id= "streetCheckNum" resultType= "java.lang.Integer" >
select count(*) from
(
select se.SysEnterpriseId
from BookEntCheck bc
left join SysEnterprise se on bc.BaseEntId = se.SysEnterpriseId
where se.State = '启用'
2023-02-16 17:13:59 +08:00
AND FIND_IN_SET(#{streetCode},se.area_path)
2022-09-16 15:07:17 +08:00
and YEAR(bc.CreatedOn)= YEAR(NOW())
<if test= "null != inherentRisk" >
and se.InherentRisk = #{inherentRisk}
</if>
group by se.SysEnterpriseId
) a
</select>
<!-- 街道企业信息 -->
<resultMap id= "SrteetEntInfoResultMap" type= "com.rzyc.bean.bigdata.check.StreetEntInfo" >
<result column= "SysEnterpriseId" jdbcType= "VARCHAR" property= "sysEnterpriseId" />
<result column= "EntName" jdbcType= "VARCHAR" property= "entName" />
<result column= "Longitude" jdbcType= "VARCHAR" property= "longitude" />
<result column= "Latitude" jdbcType= "VARCHAR" property= "latitude" />
<result column= "RiskLevel" jdbcType= "VARCHAR" property= "riskLevel" />
<result column= "commonlyNum" jdbcType= "INTEGER" property= "commonlyNum" />
<result column= "majorNum" jdbcType= "INTEGER" property= "majorNum" />
<result column= "rectifyedNum" jdbcType= "INTEGER" property= "rectifyedNum" />
<result column= "notRectifyNum" jdbcType= "INTEGER" property= "notRectifyNum" />
<result column= "rectifyingNum" jdbcType= "INTEGER" property= "rectifyingNum" />
2023-03-20 09:25:09 +08:00
<result column= "SysAddress" jdbcType= "VARCHAR" property= "sysAddress" />
<result column= "SafeManager" jdbcType= "VARCHAR" property= "safeManager" />
<result column= "SafeTelephone" jdbcType= "VARCHAR" property= "safeTelephone" />
<result column= "ManageType" jdbcType= "VARCHAR" property= "manageType" />
<result column= "LegalRepre" jdbcType= "VARCHAR" property= "legalRepre" />
<result column= "LRLinkTel" jdbcType= "VARCHAR" property= "lRLinkTel" />
2022-09-16 15:07:17 +08:00
</resultMap>
<!-- 街道企业信息 -->
<select id= "streetEntList" resultMap= "SrteetEntInfoResultMap" >
select se.SysEnterpriseId,se.EntName,se.Longitude,se.Latitude,se.RiskLevel,
2023-03-20 09:25:09 +08:00
se.SysAddress,se.SafeManager,se.SafeTelephone,se.ManageType,se.LegalRepre,se.LRLinkTel,
2022-09-16 15:07:17 +08:00
SUM(case when be.HTLevel = '一般隐患' then 1 else 0 end ) commonlyNum,
SUM(case when be.HTLevel = '重大隐患' then 1 else 0 end ) majorNum,
SUM(case when be.HTState = '已整改' then 1 else 0 end ) rectifyedNum,
SUM(case when be.HTState = '未整改' then 1 else 0 end ) notRectifyNum,
SUM(case when be.HTState = '整改中' then 1 else 0 end ) rectifyingNum
from SysEnterprise se
left join BookEntHT be on se.SysEnterpriseId = be.SysEnterpriseId
2023-02-16 16:24:20 +08:00
where se.State = '启用' and se.EntName like #{condition}
2023-02-16 14:50:32 +08:00
<if test= "null != streetCode and '' != streetCode" >
2023-02-16 15:39:00 +08:00
AND FIND_IN_SET(#{streetCode},se.area_path)
2023-02-16 14:50:32 +08:00
</if>
2022-09-16 15:07:17 +08:00
group by se.SysEnterpriseId
</select>
<!-- 企业总数 -->
<select id= "entNumByRiskLevel" resultType= "java.lang.Integer" >
select count(*) from SysEnterprise se
where se.State = '启用'
<if test= "null != riskLevel and '' != riskLevel" >
and se.InherentRisk = #{riskLevel}
</if>
<if test= "null != areaCode and '' != areaCode" >
and (se.OrgCode = #{areaCode} or se.street_code = #{areaCode} or se.community_code = #{areaCode})
</if>
</select>
<!-- 企业隐患数量列表 -->
<resultMap id= "DangerNumResultMap" type= "com.rzyc.model.ent.SysEnterprise" >
<id column= "SysEnterpriseId" jdbcType= "VARCHAR" property= "sysenterpriseid" />
<result column= "OrgCode" jdbcType= "VARCHAR" property= "orgcode" />
<result column= "street_code" jdbcType= "VARCHAR" property= "streetCode" />
<result column= "community_code" jdbcType= "VARCHAR" property= "communityCode" />
<result column= "SuperiorEnterpriseId" jdbcType= "VARCHAR" property= "superiorenterpriseid" />
<result column= "LowOrgCode" jdbcType= "VARCHAR" property= "loworgcode" />
<result column= "EntName" jdbcType= "VARCHAR" property= "entname" />
<result column= "IsHide" jdbcType= "VARCHAR" property= "isHide" />
<result column= "State" jdbcType= "VARCHAR" property= "state" />
<result column= "complite" jdbcType= "VARCHAR" property= "complite" />
<result column= "sysUnitId" jdbcType= "VARCHAR" property= "sysUnitId" />
<result column= "ManagerDept" jdbcType= "VARCHAR" property= "managerDept" />
<result column= "dynamicRiskLevel" jdbcType= "VARCHAR" property= "dynamicRiskLevel" />
<result column= "inherentRisk" jdbcType= "VARCHAR" property= "inherentRisk" />
<result column= "manageType" jdbcType= "VARCHAR" property= "manageType" />
<result column= "EntType" jdbcType= "VARCHAR" property= "enttype" />
<result column= "EntSection" jdbcType= "VARCHAR" property= "entsection" />
<result column= "BaseSafeClassId" jdbcType= "VARCHAR" property= "basesafeclassid" />
<result column= "BaseInClassId" jdbcType= "VARCHAR" property= "baseinclassid" />
<result column= "work_class_id" jdbcType= "VARCHAR" property= "workClassId" />
<result column= "PinYin" jdbcType= "VARCHAR" property= "pinyin" />
<result column= "Principal" jdbcType= "VARCHAR" property= "principal" />
<result column= "SysAddress" jdbcType= "VARCHAR" property= "sysaddress" />
<result column= "safeManager" jdbcType= "VARCHAR" property= "safeManager" />
<result column= "safeTelephone" jdbcType= "VARCHAR" property= "safeTelephone" />
<result column= "PostCode" jdbcType= "VARCHAR" property= "postcode" />
<result column= "EcoType" jdbcType= "VARCHAR" property= "ecotype" />
<result column= "PersonCount" jdbcType= "INTEGER" property= "personcount" />
<result column= "EntLogoPic" jdbcType= "VARCHAR" property= "entlogopic" />
<result column= "MaleCode" jdbcType= "VARCHAR" property= "malecode" />
<result column= "OrgPassNo" jdbcType= "VARCHAR" property= "orgpassno" />
<result column= "LegalRepre" jdbcType= "VARCHAR" property= "legalrepre" />
<result column= "LRIDCard" jdbcType= "VARCHAR" property= "lridcard" />
<result column= "LRLinkTel" jdbcType= "VARCHAR" property= "lrlinktel" />
<result column= "EstablishDate" jdbcType= "TIMESTAMP" property= "establishdate" />
<result column= "RiskLevel" jdbcType= "VARCHAR" property= "risklevel" />
<result column= "Latitude" jdbcType= "VARCHAR" property= "latitude" />
<result column= "Longitude" jdbcType= "VARCHAR" property= "longitude" />
<result column= "IsBlackList" jdbcType= "VARCHAR" property= "isblacklist" />
<result column= "Comments" jdbcType= "VARCHAR" property= "comments" />
<result column= "ISMaleCode" jdbcType= "VARCHAR" property= "ismalecode" />
<result column= "EntScore" jdbcType= "VARCHAR" property= "entscore" />
<result column= "EntHouseNum" jdbcType= "VARCHAR" property= "enthousenum" />
<result column= "CreatedOn" jdbcType= "TIMESTAMP" property= "createdon" />
<result column= "CreatedBy" jdbcType= "VARCHAR" property= "createdby" />
<result column= "ModifiedOn" jdbcType= "TIMESTAMP" property= "modifiedon" />
<result column= "ModifiedBy" jdbcType= "VARCHAR" property= "modifiedby" />
<result column= "IndustryClassName" jdbcType= "VARCHAR" property= "industryClassName" />
<result column= "superClassName" jdbcType= "VARCHAR" property= "superClassName" />
<result column= "OrgName" jdbcType= "VARCHAR" property= "orgName" />
<result column= "streetName" jdbcType= "VARCHAR" property= "streetName" />
<result column= "communityName" jdbcType= "VARCHAR" property= "communityName" />
<result column= "qr_code" jdbcType= "VARCHAR" property= "qrCode" />
<result column= "street_code" jdbcType= "VARCHAR" property= "streetCode" />
<result column= "dangerNum" jdbcType= "INTEGER" property= "dangerCount" />
<result column= "rectifyedNum" jdbcType= "INTEGER" property= "rectifiedCount" />
<result column= "rectifyingNum" jdbcType= "INTEGER" property= "rectificationCount" />
</resultMap>
<!-- 用户列表 -->
<select id= "userEntList" resultMap= "DangerNumResultMap" >
SELECT se.*,st.OrgName streetName,cm.OrgName communityName,
(
SELECT COUNT(*) FROM `bookentht` bt
WHERE bt.SysEnterpriseId = se.`SysEnterpriseId`
) dangerNum,
(
SELECT COUNT(*) FROM `bookentht` bt
WHERE bt.SysEnterpriseId = se.`SysEnterpriseId`
AND bt.HTState = '已整改'
) rectifyedNum,
(
SELECT COUNT(*) FROM `bookentht` bt
WHERE bt.SysEnterpriseId = se.`SysEnterpriseId`
AND bt.HTState = '整改中'
) rectifyingNum
FROM sysenterprise se
left join SysOrg st on se.street_code = st.OrgCode
left join SysOrg cm on se.community_code = cm.OrgCode
where se.State='启用' and se.EntName like #{condition}
and (se.`OrgCode` = #{areaCode}
OR se.`street_code` = #{areaCode}
OR se.`community_code` = #{areaCode})
ORDER BY dangerNum DESC,se.SysEnterpriseId desc
</select>
2022-10-11 15:21:09 +08:00
<select id= "findEnterpriseByName" resultMap= "BaseResultMap" >
2022-11-07 17:47:41 +08:00
select sysent.EntName,sysent.state,sysent.SysEnterpriseId from ent_user eu left join sysenterprise sysent on eu.enterprise_id = sysent.SysEnterpriseId where eu.name = #{entUserName}
2022-10-11 15:21:09 +08:00
</select>
2022-11-08 18:09:46 +08:00
<select id= "findEnterpriseByPhoneNumber" resultMap= "BaseResultMap" >
2023-02-15 14:39:25 +08:00
select sysent.EntName,sysent.state,sysent.SysEnterpriseId,sysent.EntName
from ent_user eu
left join sysenterprise sysent on eu.enterprise_id = sysent.SysEnterpriseId
where eu.account = #{entUserPhone}
2022-11-08 18:09:46 +08:00
</select>
2022-12-29 18:02:27 +08:00
<insert id= "insertList" >
insert into sysenterprise (SysEnterpriseId,EntName,OrgPassNo,area_code,area_path,area_name,SysAddress,work_class_id,LegalRepre,LRLinkTel,
SafeManager,SafeTelephone,PersonCount,EstablishDate,ManageType,IsHide,`State`,CreatedOn,CreatedBy)values
<foreach collection= "list" item= "list" separator= "," >
(#{list.SysEnterpriseId},
#{list.EntName},
#{list.OrgPassNo},
#{list.areaCode},
#{list.areaPath},
#{list.areaName},
#{list.address},
#{list.industryId},
#{list.legalPerson},
#{list.legalPersonPhone},
#{list.safeChangePerson},
#{list.safeChangePersonPhone},
#{list.staffNumber},
#{list.establishTime},
#{list.businessScope},
'否',
'启用',
#{list.CreatedOn},
#{list.CreatedBy})
</foreach>
</insert>
<select id= "selectNoEntList" resultType= "com.rzyc.model.ent.SysEnterprise" >
select s.BaseInClassId,s.SysEnterpriseId from sysenterprise s left join in_ent_list iel on s.SysEnterpriseId = iel.enterprise_id where iel.ent_list_id is null
</select>
<select id= "selectNoLegalPersonPost" resultType= "com.rzyc.model.ent.SysEnterprise" >
select s.SysEnterpriseId,s.LegalRepre,s.LRLinkTel,s.EntName
from sysenterprise s
left join ent_post ep on s.SysEnterpriseId = ep.enterprise_id and ep.name = '法人'
where ep.post_id is null
</select>
2023-03-16 16:39:22 +08:00
<!-- 修改企业静态风险等级 -->
<update id= "changeInherentRisk" >
update sysenterprise set InherentRisk = #{inherentRisk} where SysEnterpriseId = #{enterpriseId}
</update>
2022-09-16 15:07:17 +08:00
</mapper>