ganzi-api/inventory-dao/src/main/resources/mapper/check/BookEntCheckMapper.xml

1387 lines
55 KiB
XML
Raw Normal View History

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.check.BookEntCheckMapper">
<resultMap id="BaseResultMap" type="com.rzyc.model.check.BookEntCheck">
<id column="BookEntCheckId" jdbcType="VARCHAR" property="bookentcheckid" />
<result column="BaseEntId" jdbcType="VARCHAR" property="baseentid" />
<result column="ChkBillId" jdbcType="VARCHAR" property="chkbillid" />
<result column="CheckSite" jdbcType="VARCHAR" property="checksite" />
<result column="BegCheckDate" jdbcType="TIMESTAMP" property="begcheckdate" />
<result column="EndCheckDate" jdbcType="TIMESTAMP" property="endcheckdate" />
<result column="CheckUniy" jdbcType="VARCHAR" property="checkuniy" />
<result column="ZhiFaRen" jdbcType="VARCHAR" property="zhifaren" />
<result column="IDNumber" jdbcType="VARCHAR" property="idnumber" />
<result column="CheckType" jdbcType="VARCHAR" property="checktype" />
<result column="ChkBillName" jdbcType="VARCHAR" property="chkbillName" />
<result column="CheckContent" jdbcType="VARCHAR" property="checkcontent" />
<result column="CheckProblem" jdbcType="VARCHAR" property="checkproblem" />
<result column="IsToTrouble" jdbcType="VARCHAR" property="istotrouble" />
<result column="ProcessingOpinion" jdbcType="VARCHAR" property="processingopinion" />
<result column="CheckMethod" jdbcType="VARCHAR" property="checkmethod" />
<result column="CheckBasis" jdbcType="VARCHAR" property="checkbasis" />
<result column="CheckObject" jdbcType="VARCHAR" property="checkobject" />
<result column="CheckState" jdbcType="VARCHAR" property="checkstate" />
<result column="ConfimDate" jdbcType="TIMESTAMP" property="confimdate" />
<result column="Remark" jdbcType="VARCHAR" property="remark" />
<result column="BookCheckScores" jdbcType="INTEGER" property="bookcheckscores" />
<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="UnitName" jdbcType="VARCHAR" property="unitName" />
<result column="EntName" jdbcType="VARCHAR" property="entName" />
<result column="longitude" jdbcType="BIGINT" property="longitude" />
<result column="latitude" jdbcType="BIGINT" property="latitude" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
BookEntCheckId, BaseEntId, ChkBillId, CheckSite, BegCheckDate, EndCheckDate, CheckUniy,
ZhiFaRen, IDNumber, CheckType, CheckContent, CheckProblem, IsToTrouble, ProcessingOpinion,
CheckMethod, CheckBasis, CheckObject, CheckState, ConfimDate, Remark, BookCheckScores,
CreatedOn, CreatedBy, ModifiedOn, ModifiedBy
</sql>
<select id="selectByExample" parameterType="com.rzyc.model.check.BookEntCheckExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from BookEntCheck
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
<if test="limit != null">
<if test="offset != null">
limit ${offset}, ${limit}
</if>
<if test="offset == null">
limit ${limit}
</if>
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from BookEntCheck
where BookEntCheckId = #{bookentcheckid,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from BookEntCheck
where BookEntCheckId = #{bookentcheckid,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="com.rzyc.model.check.BookEntCheckExample">
delete from BookEntCheck
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.rzyc.model.check.BookEntCheck">
insert into BookEntCheck (BookEntCheckId, BaseEntId, ChkBillId,
ChkBillName,
CheckSite, BegCheckDate, EndCheckDate,
CheckUniy, ZhiFaRen, IDNumber,
CheckType, CheckContent, CheckProblem,
IsToTrouble, ProcessingOpinion, CheckMethod,
CheckBasis, CheckObject, CheckState,
ConfimDate, Remark, BookCheckScores,
CreatedOn, CreatedBy, ModifiedOn,
ModifiedBy,min_unit_check,longitude,latitude)
values (#{bookentcheckid,jdbcType=VARCHAR}, #{baseentid,jdbcType=VARCHAR},
#{chkbillid,jdbcType=VARCHAR},
#{chkbillName,jdbcType=VARCHAR},
#{checksite,jdbcType=VARCHAR}, #{begcheckdate,jdbcType=TIMESTAMP}, #{endcheckdate,jdbcType=TIMESTAMP},
#{checkuniy,jdbcType=VARCHAR}, #{zhifaren,jdbcType=VARCHAR}, #{idnumber,jdbcType=VARCHAR},
#{checktype,jdbcType=VARCHAR}, #{checkcontent,jdbcType=VARCHAR}, #{checkproblem,jdbcType=VARCHAR},
#{istotrouble,jdbcType=VARCHAR}, #{processingopinion,jdbcType=VARCHAR}, #{checkmethod,jdbcType=VARCHAR},
#{checkbasis,jdbcType=VARCHAR}, #{checkobject,jdbcType=VARCHAR}, #{checkstate,jdbcType=VARCHAR},
#{confimdate,jdbcType=TIMESTAMP}, #{remark,jdbcType=VARCHAR}, #{bookcheckscores,jdbcType=INTEGER},
#{createdon,jdbcType=TIMESTAMP}, #{createdby,jdbcType=VARCHAR}, #{modifiedon,jdbcType=TIMESTAMP},
#{modifiedby,jdbcType=VARCHAR},#{minUnitCheck},#{longitude},#{latitude})
</insert>
<insert id="insertSelective" parameterType="com.rzyc.model.check.BookEntCheck">
insert into BookEntCheck
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="bookentcheckid != null">
BookEntCheckId,
</if>
<if test="baseentid != null">
BaseEntId,
</if>
<if test="chkbillid != null">
ChkBillId,
</if>
<if test="checksite != null">
CheckSite,
</if>
<if test="begcheckdate != null">
BegCheckDate,
</if>
<if test="endcheckdate != null">
EndCheckDate,
</if>
<if test="checkuniy != null">
CheckUniy,
</if>
<if test="zhifaren != null">
ZhiFaRen,
</if>
<if test="idnumber != null">
IDNumber,
</if>
<if test="checktype != null">
CheckType,
</if>
<if test="checkcontent != null">
CheckContent,
</if>
<if test="checkproblem != null">
CheckProblem,
</if>
<if test="istotrouble != null">
IsToTrouble,
</if>
<if test="processingopinion != null">
ProcessingOpinion,
</if>
<if test="checkmethod != null">
CheckMethod,
</if>
<if test="checkbasis != null">
CheckBasis,
</if>
<if test="checkobject != null">
CheckObject,
</if>
<if test="checkstate != null">
CheckState,
</if>
<if test="confimdate != null">
ConfimDate,
</if>
<if test="remark != null">
Remark,
</if>
<if test="bookcheckscores != null">
BookCheckScores,
</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="bookentcheckid != null">
#{bookentcheckid,jdbcType=VARCHAR},
</if>
<if test="baseentid != null">
#{baseentid,jdbcType=VARCHAR},
</if>
<if test="chkbillid != null">
#{chkbillid,jdbcType=VARCHAR},
</if>
<if test="checksite != null">
#{checksite,jdbcType=VARCHAR},
</if>
<if test="begcheckdate != null">
#{begcheckdate,jdbcType=TIMESTAMP},
</if>
<if test="endcheckdate != null">
#{endcheckdate,jdbcType=TIMESTAMP},
</if>
<if test="checkuniy != null">
#{checkuniy,jdbcType=VARCHAR},
</if>
<if test="zhifaren != null">
#{zhifaren,jdbcType=VARCHAR},
</if>
<if test="idnumber != null">
#{idnumber,jdbcType=VARCHAR},
</if>
<if test="checktype != null">
#{checktype,jdbcType=VARCHAR},
</if>
<if test="checkcontent != null">
#{checkcontent,jdbcType=VARCHAR},
</if>
<if test="checkproblem != null">
#{checkproblem,jdbcType=VARCHAR},
</if>
<if test="istotrouble != null">
#{istotrouble,jdbcType=VARCHAR},
</if>
<if test="processingopinion != null">
#{processingopinion,jdbcType=VARCHAR},
</if>
<if test="checkmethod != null">
#{checkmethod,jdbcType=VARCHAR},
</if>
<if test="checkbasis != null">
#{checkbasis,jdbcType=VARCHAR},
</if>
<if test="checkobject != null">
#{checkobject,jdbcType=VARCHAR},
</if>
<if test="checkstate != null">
#{checkstate,jdbcType=VARCHAR},
</if>
<if test="confimdate != null">
#{confimdate,jdbcType=TIMESTAMP},
</if>
<if test="remark != null">
#{remark,jdbcType=VARCHAR},
</if>
<if test="bookcheckscores != null">
#{bookcheckscores,jdbcType=INTEGER},
</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>
<select id="countByExample" parameterType="com.rzyc.model.check.BookEntCheckExample" resultType="java.lang.Long">
select count(*) from BookEntCheck
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update BookEntCheck
<set>
<if test="record.bookentcheckid != null">
BookEntCheckId = #{record.bookentcheckid,jdbcType=VARCHAR},
</if>
<if test="record.baseentid != null">
BaseEntId = #{record.baseentid,jdbcType=VARCHAR},
</if>
<if test="record.chkbillid != null">
ChkBillId = #{record.chkbillid,jdbcType=VARCHAR},
</if>
<if test="record.checksite != null">
CheckSite = #{record.checksite,jdbcType=VARCHAR},
</if>
<if test="record.begcheckdate != null">
BegCheckDate = #{record.begcheckdate,jdbcType=TIMESTAMP},
</if>
<if test="record.endcheckdate != null">
EndCheckDate = #{record.endcheckdate,jdbcType=TIMESTAMP},
</if>
<if test="record.checkuniy != null">
CheckUniy = #{record.checkuniy,jdbcType=VARCHAR},
</if>
<if test="record.zhifaren != null">
ZhiFaRen = #{record.zhifaren,jdbcType=VARCHAR},
</if>
<if test="record.idnumber != null">
IDNumber = #{record.idnumber,jdbcType=VARCHAR},
</if>
<if test="record.checktype != null">
CheckType = #{record.checktype,jdbcType=VARCHAR},
</if>
<if test="record.checkcontent != null">
CheckContent = #{record.checkcontent,jdbcType=VARCHAR},
</if>
<if test="record.checkproblem != null">
CheckProblem = #{record.checkproblem,jdbcType=VARCHAR},
</if>
<if test="record.istotrouble != null">
IsToTrouble = #{record.istotrouble,jdbcType=VARCHAR},
</if>
<if test="record.processingopinion != null">
ProcessingOpinion = #{record.processingopinion,jdbcType=VARCHAR},
</if>
<if test="record.checkmethod != null">
CheckMethod = #{record.checkmethod,jdbcType=VARCHAR},
</if>
<if test="record.checkbasis != null">
CheckBasis = #{record.checkbasis,jdbcType=VARCHAR},
</if>
<if test="record.checkobject != null">
CheckObject = #{record.checkobject,jdbcType=VARCHAR},
</if>
<if test="record.checkstate != null">
CheckState = #{record.checkstate,jdbcType=VARCHAR},
</if>
<if test="record.confimdate != null">
ConfimDate = #{record.confimdate,jdbcType=TIMESTAMP},
</if>
<if test="record.remark != null">
Remark = #{record.remark,jdbcType=VARCHAR},
</if>
<if test="record.bookcheckscores != null">
BookCheckScores = #{record.bookcheckscores,jdbcType=INTEGER},
</if>
<if test="record.createdon != null">
CreatedOn = #{record.createdon,jdbcType=TIMESTAMP},
</if>
<if test="record.createdby != null">
CreatedBy = #{record.createdby,jdbcType=VARCHAR},
</if>
<if test="record.modifiedon != null">
ModifiedOn = #{record.modifiedon,jdbcType=TIMESTAMP},
</if>
<if test="record.modifiedby != null">
ModifiedBy = #{record.modifiedby,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update BookEntCheck
set BookEntCheckId = #{record.bookentcheckid,jdbcType=VARCHAR},
BaseEntId = #{record.baseentid,jdbcType=VARCHAR},
ChkBillId = #{record.chkbillid,jdbcType=VARCHAR},
CheckSite = #{record.checksite,jdbcType=VARCHAR},
BegCheckDate = #{record.begcheckdate,jdbcType=TIMESTAMP},
EndCheckDate = #{record.endcheckdate,jdbcType=TIMESTAMP},
CheckUniy = #{record.checkuniy,jdbcType=VARCHAR},
ZhiFaRen = #{record.zhifaren,jdbcType=VARCHAR},
IDNumber = #{record.idnumber,jdbcType=VARCHAR},
CheckType = #{record.checktype,jdbcType=VARCHAR},
CheckContent = #{record.checkcontent,jdbcType=VARCHAR},
CheckProblem = #{record.checkproblem,jdbcType=VARCHAR},
IsToTrouble = #{record.istotrouble,jdbcType=VARCHAR},
ProcessingOpinion = #{record.processingopinion,jdbcType=VARCHAR},
CheckMethod = #{record.checkmethod,jdbcType=VARCHAR},
CheckBasis = #{record.checkbasis,jdbcType=VARCHAR},
CheckObject = #{record.checkobject,jdbcType=VARCHAR},
CheckState = #{record.checkstate,jdbcType=VARCHAR},
ConfimDate = #{record.confimdate,jdbcType=TIMESTAMP},
Remark = #{record.remark,jdbcType=VARCHAR},
BookCheckScores = #{record.bookcheckscores,jdbcType=INTEGER},
CreatedOn = #{record.createdon,jdbcType=TIMESTAMP},
CreatedBy = #{record.createdby,jdbcType=VARCHAR},
ModifiedOn = #{record.modifiedon,jdbcType=TIMESTAMP},
ModifiedBy = #{record.modifiedby,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.rzyc.model.check.BookEntCheck">
update BookEntCheck
<set>
<if test="baseentid != null">
BaseEntId = #{baseentid,jdbcType=VARCHAR},
</if>
<if test="chkbillid != null">
ChkBillId = #{chkbillid,jdbcType=VARCHAR},
</if>
<if test="checksite != null">
CheckSite = #{checksite,jdbcType=VARCHAR},
</if>
<if test="begcheckdate != null">
BegCheckDate = #{begcheckdate,jdbcType=TIMESTAMP},
</if>
<if test="endcheckdate != null">
EndCheckDate = #{endcheckdate,jdbcType=TIMESTAMP},
</if>
<if test="checkuniy != null">
CheckUniy = #{checkuniy,jdbcType=VARCHAR},
</if>
<if test="zhifaren != null">
ZhiFaRen = #{zhifaren,jdbcType=VARCHAR},
</if>
<if test="idnumber != null">
IDNumber = #{idnumber,jdbcType=VARCHAR},
</if>
<if test="checktype != null">
CheckType = #{checktype,jdbcType=VARCHAR},
</if>
<if test="checkcontent != null">
CheckContent = #{checkcontent,jdbcType=VARCHAR},
</if>
<if test="checkproblem != null">
CheckProblem = #{checkproblem,jdbcType=VARCHAR},
</if>
<if test="istotrouble != null">
IsToTrouble = #{istotrouble,jdbcType=VARCHAR},
</if>
<if test="processingopinion != null">
ProcessingOpinion = #{processingopinion,jdbcType=VARCHAR},
</if>
<if test="checkmethod != null">
CheckMethod = #{checkmethod,jdbcType=VARCHAR},
</if>
<if test="checkbasis != null">
CheckBasis = #{checkbasis,jdbcType=VARCHAR},
</if>
<if test="checkobject != null">
CheckObject = #{checkobject,jdbcType=VARCHAR},
</if>
<if test="checkstate != null">
CheckState = #{checkstate,jdbcType=VARCHAR},
</if>
<if test="confimdate != null">
ConfimDate = #{confimdate,jdbcType=TIMESTAMP},
</if>
<if test="remark != null">
Remark = #{remark,jdbcType=VARCHAR},
</if>
<if test="bookcheckscores != null">
BookCheckScores = #{bookcheckscores,jdbcType=INTEGER},
</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>
</set>
where BookEntCheckId = #{bookentcheckid,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.rzyc.model.check.BookEntCheck">
update BookEntCheck
set BaseEntId = #{baseentid,jdbcType=VARCHAR},
ChkBillId = #{chkbillid,jdbcType=VARCHAR},
CheckSite = #{checksite,jdbcType=VARCHAR},
BegCheckDate = #{begcheckdate,jdbcType=TIMESTAMP},
EndCheckDate = #{endcheckdate,jdbcType=TIMESTAMP},
CheckUniy = #{checkuniy,jdbcType=VARCHAR},
ZhiFaRen = #{zhifaren,jdbcType=VARCHAR},
IDNumber = #{idnumber,jdbcType=VARCHAR},
CheckType = #{checktype,jdbcType=VARCHAR},
CheckContent = #{checkcontent,jdbcType=VARCHAR},
CheckProblem = #{checkproblem,jdbcType=VARCHAR},
IsToTrouble = #{istotrouble,jdbcType=VARCHAR},
ProcessingOpinion = #{processingopinion,jdbcType=VARCHAR},
CheckMethod = #{checkmethod,jdbcType=VARCHAR},
CheckBasis = #{checkbasis,jdbcType=VARCHAR},
CheckObject = #{checkobject,jdbcType=VARCHAR},
CheckState = #{checkstate,jdbcType=VARCHAR},
ConfimDate = #{confimdate,jdbcType=TIMESTAMP},
Remark = #{remark,jdbcType=VARCHAR},
BookCheckScores = #{bookcheckscores,jdbcType=INTEGER},
CreatedOn = #{createdon,jdbcType=TIMESTAMP},
CreatedBy = #{createdby,jdbcType=VARCHAR},
ModifiedOn = #{modifiedon,jdbcType=TIMESTAMP},
ModifiedBy = #{modifiedby,jdbcType=VARCHAR}
where BookEntCheckId = #{bookentcheckid,jdbcType=VARCHAR}
</update>
<!--企业列表-->
<select id="entCheckPage" resultMap="BaseResultMap">
SELECT bc.`BookEntCheckId`,bc.`CreatedOn`,bc.CheckSite,bc.ChkBillName
FROM ChkPerson cp
LEFT JOIN SysUser su ON cp.`SysUserId` = su.`SysUserId`
LEFT JOIN `BookEntCheck` bc ON bc.`BookEntCheckId` = cp.BookEntCheckId
LEFT JOIN SysEnterprise se ON bc.`BaseEntId` = se.`SysEnterpriseId`
LEFT JOIN ChkGovBill cg ON cg.`ChkGovBillId` = bc.`ChkBillId`
WHERE se.State = '启用' and se.`EntName` LIKE #{condition}
<if test="null != startTime and '' != startTime">
AND bc.CreatedOn >= #{startTime}
</if>
<if test="null != endTime and '' != endTime">
AND bc.CreatedOn &lt;= #{endTime}
</if>
<if test="null != enterpriseId and '' != enterpriseId">
AND bc.`BaseEntId` = #{enterpriseId}
</if>
<if test="null != baseinclassid and '' != baseinclassid">
AND se.BaseInClassId = #{baseinclassid}
</if>
<if test="null != htSource and '' != htSource">
AND su.`SysUnitOrEntId` = #{htSource}
</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>
GROUP BY bc.`CreatedOn`,bc.`BookEntCheckId`,bc.CheckSite,bc.ChkBillName
ORDER BY bc.createdOn DESC
LIMIT #{start},#{end};
</select>
<!--企业列表-->
<select id="countEntCheck" resultType="java.lang.Long">
select count(*) from (
SELECT count(*)
FROM ChkPerson cp
LEFT JOIN SysUser su ON cp.`SysUserId` = su.`SysUserId`
LEFT JOIN `BookEntCheck` bc ON bc.`BookEntCheckId` = cp.BookEntCheckId
LEFT JOIN SysEnterprise se ON bc.`BaseEntId` = se.`SysEnterpriseId`
LEFT JOIN ChkGovBill cg ON cg.`ChkGovBillId` = bc.`ChkBillId`
WHERE se.State = '启用' and se.`EntName` LIKE #{condition}
<if test="null != startTime and '' != startTime">
AND bc.CreatedOn >= #{startTime}
</if>
<if test="null != endTime and '' != endTime">
AND bc.CreatedOn &lt;= #{endTime}
</if>
<if test="null != enterpriseId and '' != enterpriseId">
AND bc.`BaseEntId` = #{enterpriseId}
</if>
<if test="null != baseinclassid and '' != baseinclassid">
AND se.BaseInClassId = #{baseinclassid}
</if>
<if test="null != htSource and '' != htSource">
AND su.`SysUnitOrEntId` = #{htSource}
</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>
GROUP BY bc.`BookEntCheckId`,bc.`CreatedOn`,bc.CheckSite
) a
</select>
<!--本年检查记录-->
<select id="yearCheck" resultMap="BaseResultMap">
SELECT * FROM BookEntCheck bc WHERE YEAR( bc.`BegCheckDate` ) = YEAR( NOW( ) )
</select>
<!--修改检查人-->
<update id="changeCheck" parameterType="com.rzyc.model.check.BookEntCheck">
update BookEntCheck
set
Remark = #{remark,jdbcType=VARCHAR},
ModifiedOn = #{modifiedon,jdbcType=TIMESTAMP},
ModifiedBy = #{modifiedby,jdbcType=VARCHAR}
where
BookEntCheckId = #{bookentcheckid,jdbcType=VARCHAR}
</update>
<!--通过时间 查询添加的安全检查-->
<select id="findByTime" resultMap="BaseResultMap">
SELECT bc.* FROM ChkPerson cp
LEFT JOIN BookEntCheck bc ON bc.BookEntCheckId = cp.BookEntCheckId
WHERE cp.SysUserId = #{sysUserId}
AND cp.IsSign = 2
AND bc.CreatedOn LIKE #{time}
<if test="null != checkIds and checkIds.size > 0 ">
AND bc.BookEntCheckId NOT IN (
<foreach collection ="checkIds" item="checkId" index= "index" separator =",">
#{checkId}
</foreach>
)
</if>
ORDER BY cp.SignTime DESC
</select>
<!--查询履职关联的检查记录-->
<select id="findListCheck" resultMap="BaseResultMap">
SELECT bc.* FROM `ListDetaCheck` lt
LEFT JOIN `BookEntCheck` bc ON bc.BookEntCheckId = lt.BookEntCheckId
LEFT JOIN ChkGovBill cg ON cg.`ChkGovBillId` = bc.`ChkBillId`
WHERE lt.ListDetailId = #{listDetailId}
ORDER BY lt.CreatedOn DESC
</select>
<!--查询一年的检查数据-->
<select id="findByYear" resultMap="BaseResultMap">
SELECT * FROM `BookEntCheck` bc
WHERE bc.BaseEntId = #{entId}
AND bc.CreatedOn >= #{startTime}
AND bc.CreatedOn &lt;= #{endTime}
;
</select>
<!--修改企业检查清单名-->
<update id="changeChkBillName">
UPDATE `BookEntCheck` SET ChkBillName = #{ChkBillName} WHERE BookEntCheckId = #{checkId}
</update>
<select id="companyDetailCheck" resultMap="BaseResultMap">
select bc.*,su.UnitName from BookEntCheck bc
left join SysUnit su on bc.CheckUniy=su.SysUnitId
left join SysEnterprise se on se.SysEnterpriseId=bc.BaseEntId
where bc.BaseEntId=#{SysEnterpriseId}
order by ModifiedOn desc
</select>
<select id="checkRecordList" resultMap="BaseResultMap">
select bc.*,se.EntName,su.UnitName from BookEntCheck bc
left join SysUnit su on bc.CheckUniy=su.SysUnitId
left join SysEnterprise se on se.SysEnterpriseId=bc.BaseEntId
And se.IsHide='否' and se.State = '启用'
where (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},'%') or bc.ZhiFaRen like concat('%',#{entName},'%') )
</if>
<if test="null != unitId and '' != unitId">
and su.SysUnitId = #{unitId}
</if>
<if test="null != startTime and '' != startTime">
and bc.BegCheckDate >= #{startTime}
</if>
<if test="null != endTime and '' != endTime">
and bc.EndCheckDate &lt;= #{endTime}
</if>
order by ModifiedOn desc
</select>
<resultMap id="BaseResultMapChildren" type="com.rzyc.model.check.BookEntCheck">
<id column="BookEntCheckId" jdbcType="VARCHAR" property="bookentcheckid" />
<result column="BaseEntId" jdbcType="VARCHAR" property="baseentid" />
<result column="ChkBillId" jdbcType="VARCHAR" property="chkbillid" />
<result column="CheckSite" jdbcType="VARCHAR" property="checksite" />
<result column="BegCheckDate" jdbcType="TIMESTAMP" property="begcheckdate" />
<result column="EndCheckDate" jdbcType="TIMESTAMP" property="endcheckdate" />
<result column="CheckUniy" jdbcType="VARCHAR" property="checkuniy" />
<result column="ZhiFaRen" jdbcType="VARCHAR" property="zhifaren" />
<result column="IDNumber" jdbcType="VARCHAR" property="idnumber" />
<result column="CheckType" jdbcType="VARCHAR" property="checktype" />
<result column="ChkBillName" jdbcType="VARCHAR" property="chkbillName" />
<result column="CheckContent" jdbcType="VARCHAR" property="checkcontent" />
<result column="CheckProblem" jdbcType="VARCHAR" property="checkproblem" />
<result column="IsToTrouble" jdbcType="VARCHAR" property="istotrouble" />
<result column="ProcessingOpinion" jdbcType="VARCHAR" property="processingopinion" />
<result column="CheckMethod" jdbcType="VARCHAR" property="checkmethod" />
<result column="CheckBasis" jdbcType="VARCHAR" property="checkbasis" />
<result column="CheckObject" jdbcType="VARCHAR" property="checkobject" />
<result column="CheckState" jdbcType="VARCHAR" property="checkstate" />
<result column="ConfimDate" jdbcType="TIMESTAMP" property="confimdate" />
<result column="Remark" jdbcType="VARCHAR" property="remark" />
<result column="BookCheckScores" jdbcType="INTEGER" property="bookcheckscores" />
<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="UnitName" jdbcType="VARCHAR" property="unitName" />
<result column="EntName" jdbcType="VARCHAR" property="entName" />
<result column="UnitName" jdbcType="VARCHAR" property="unitName" />
<result column="longitude" jdbcType="BIGINT" property="longitude" />
<result column="latitude" jdbcType="BIGINT" property="latitude" />
<collection property="bookEntCheckDetails" ofType="com.rzyc.model.check.BookEntCheckDetailWithBLOBs" column="bookentcheckdetailid">
<id column="BookEntCheckDetailId" jdbcType="VARCHAR" property="bookentcheckdetailid" />
<result column="BookEntCheckId" jdbcType="VARCHAR" property="bookentcheckid" />
<result column="ChkBillDetailId" jdbcType="VARCHAR" property="chkbilldetailid" />
<result column="ChkGovBillDetailId" jdbcType="VARCHAR" property="chkgovbilldetailid" />
<result column="ChkBillId" jdbcType="VARCHAR" property="chkbillid" />
<result column="CheckObjectName" jdbcType="LONGVARCHAR" property="checkobjectname" />
<result column="CheckMethod" jdbcType="LONGVARCHAR" property="checkmethod" />
<result column="CheckBasisDetail" jdbcType="LONGVARCHAR" property="checkbasis" />
<result column="istotrouble" jdbcType="VARCHAR" property="istotrouble" />
<result column="IsQualified" jdbcType="VARCHAR" property="isqualified" />
<collection property="hiddenDangers" ofType="com.rzyc.bean.HiddenDanger" column="bookenthtid">
<id column="BooKEntHTId" jdbcType="VARCHAR" property="bookenthtid" />
<result column="HiddenArea" jdbcType="VARCHAR" property="hiddenDanger" />
<result column="HTState" jdbcType="VARCHAR" property="htstate" />
<result column="RectifyTime" jdbcType="TIMESTAMP" property="rectifytime" />
<result column="RectifyResult" jdbcType="VARCHAR" property="rectifyresult" />
</collection>
</collection>
</resultMap>
<select id="selectCheckDetail" resultMap="BaseResultMapChildren">
select bt.*,btd.*,btd.CheckBasis,btt.*,su.UnitName from BookEntCheck bt
left join BookEntCheckDetail btd on bt.BookEntCheckId = btd.BookEntCheckId
left join BookEntHT btt on btt.BookEntCheckDetailId = btd.BookEntCheckDetailId
left join SysUnit su on bt.CheckUniy = su.SysUnitId
where bt.BooKEntCheckId = #{id}
</select>
<select id="countBySuperiorUnitId" resultType="java.lang.Integer">
select count(*) as DepartmentCheckTotal from BookEntCheck where CheckUniy in(select SysUnitId from SysUnit where SuperiorUnitId=#{superiorUnitId})
</select>
<!---->
<select id="performCheckList" resultMap="BaseResultMap">
SELECT bc.*,su.UnitName
FROM ChkPerson cp
LEFT JOIN `BookEntCheck` bc ON cp.`BookEntCheckId` = bc.`BookEntCheckId`
LEFT JOIN SysUnit su ON bc.CheckUniy=su.SysUnitId
LEFT JOIN SysEnterprise se ON se.SysEnterpriseId=bc.BaseEntId
WHERE se.State = '启用' and cp.`SysUserId` = #{userId}
<if test="null != startTime and '' != startTime">
AND bc.CreatedOn >= #{startTime}
</if>
<if test="null != endTime and '' != endTime">
AND bc.CreatedOn &lt;= #{endTime}
</if>
and se.`EntName` LIKE #{condition}
<if test=" '' == startTime and '' == endTime">
AND DATE_FORMAT(cp.CreatedOn,'%Y-%m')=DATE_FORMAT(NOW(),'%Y-%m')
</if>
AND se.IsHide='否'
ORDER BY ModifiedOn DESC
</select>
<!--街道检查情况-->
<resultMap id="StreetCheckMsgResultMap" type="com.rzyc.bean.check.StreetCheckMsg">
<result column="orgName" jdbcType="VARCHAR" property="orgName" />
<result column="streetNum" jdbcType="INTEGER" property="streetNum" />
<result column="communityNum" jdbcType="INTEGER" property="communityNum" />
<result column="totalEnt" jdbcType="INTEGER" property="totalEnt" />
<result column="checkEntNum" jdbcType="INTEGER" property="checkEntNum" />
<result column="totalCheck" jdbcType="INTEGER" property="totalCheck" />
<result column="totalDangerNum" jdbcType="INTEGER" property="totalDangerNum" />
<result column="rectifyNum" jdbcType="INTEGER" property="rectifyNum" />
</resultMap>
<!--街道检查情况-->
<select id="streetCheckMsg" resultMap="StreetCheckMsgResultMap">
select so.OrgCode, so.OrgName orgName,
(
select count(*)
from SysEnterprise se
where se.street_code = so.OrgCode
and 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>
)totalEnt,
(
select count(bc.BookEntCheckId) from BookEntCheck bc
left join SysEnterprise se on bc.BaseEntId = se.SysEnterpriseId
where se.street_code = so.OrgCode and 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 != startTime and '' != startTime">
AND bc.CreatedOn >= #{startTime}
</if>
<if test="null != endTime and '' != endTime">
AND bc.CreatedOn &lt;= #{endTime}
</if>
)totalCheck,
(
select count(distinct bc.BaseEntId) from BookEntCheck bc
left join SysEnterprise se on bc.BaseEntId = se.SysEnterpriseId
where se.street_code = so.OrgCode and 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 != startTime and '' != startTime">
AND bc.CreatedOn >= #{startTime}
</if>
<if test="null != endTime and '' != endTime">
AND bc.CreatedOn &lt;= #{endTime}
</if>
)checkEntNum,
(
select count(be.BookEntHTId) from BookEntHT be
left join SysEnterprise se on be.SysEnterpriseId = se.SysEnterpriseId
where se.street_code = so.OrgCode and 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 != startTime and '' != startTime">
AND be.CreatedOn >= #{startTime}
</if>
<if test="null != endTime and '' != endTime">
AND be.CreatedOn &lt;= #{endTime}
</if>
)totalDangerNum,
(
select count(be.BookEntHTId) from BookEntHT be
left join SysEnterprise se on be.SysEnterpriseId = se.SysEnterpriseId
where se.street_code = so.OrgCode and se.State = '启用'
and be.HTState = '未整改'
<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 != startTime and '' != startTime">
AND be.CreatedOn >= #{startTime}
</if>
<if test="null != endTime and '' != endTime">
AND be.CreatedOn &lt;= #{endTime}
</if>
)rectifyNum,
(
select count(be.BookEntHTId) from BookEntHT be
left join SysEnterprise se on be.SysEnterpriseId = se.SysEnterpriseId
where se.street_code = so.OrgCode and se.State = '启用'
and be.HTState = '已整改'
<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 != startTime and '' != startTime">
AND be.CreatedOn >= #{startTime}
</if>
<if test="null != endTime and '' != endTime">
AND be.CreatedOn &lt;= #{endTime}
</if>
)rectifyedNum,
(
select count(be.BookEntHTId) from BookEntHT be
left join SysEnterprise se on be.SysEnterpriseId = se.SysEnterpriseId
where se.street_code = so.OrgCode and se.State = '启用'
and be.HTState = '整改中'
<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 != startTime and '' != startTime">
AND be.CreatedOn >= #{startTime}
</if>
<if test="null != endTime and '' != endTime">
AND be.CreatedOn &lt;= #{endTime}
</if>
)rectifyedingNum
from SysOrg so
where so.SuperiorOrgCode = '510114'
<if test="null != streetCode and '' != streetCode">
and so.OrgCode = #{streetCode}
</if>
order by so.OrgCode asc
</select>
<select id="streetCheckMsgV2" resultMap="StreetCheckMsgResultMap">
SELECT st.`OrgCode`,st.`OrgName` orgName,
COUNT(DISTINCT se.`SysEnterpriseId`) totalEnt,
COUNT(DISTINCT bc.BookEntCheckId) totalCheck,
COUNT(DISTINCT bc.BaseEntId) checkEntNum,
COUNT(DISTINCT be.BookEntHTId) totalDangerNum,
COUNT(DISTINCT notbe.BookEntHTId) rectifyNum
FROM SysEnterprise se
LEFT JOIN SysOrg st ON se.street_code = st.OrgCode
left join BookEntCheck bc on se.SysEnterpriseId = bc.BaseEntId
left join BookEntHT notbe on se.SysEnterpriseId = notbe.SysEnterpriseId
left join BookEntHT be on se.SysEnterpriseId = be.SysEnterpriseId
and notbe.HTState = '未整改'
<if test="null != startTime and '' != startTime">
AND bc.CreatedOn >= #{startTime}
</if>
<if test="null != endTime and '' != endTime">
AND bc.CreatedOn &lt;= #{endTime}
</if>
<if test="null != startTime and '' != startTime">
AND be.CreatedOn >= #{startTime}
</if>
<if test="null != endTime and '' != endTime">
AND be.CreatedOn &lt;= #{endTime}
</if>
<if test="null != startTime and '' != startTime">
AND notbe.CreatedOn >= #{startTime}
</if>
<if test="null != endTime and '' != endTime">
AND notbe.CreatedOn &lt;= #{endTime}
</if>
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>
and st.OrgCode is not null
<if test="null != streetCode and '' != streetCode">
and se.street_code = #{streetCode}
</if>
GROUP BY st.`OrgCode`,st.`OrgName`
ORDER BY st.`OrgCode`;
</select>
<!--街道检查情况-->
<select id="streetCheckMsgV1" resultMap="StreetCheckMsgResultMap">
SELECT so.OrgName orgName,
(
SELECT COUNT(*) FROM SysUser su
WHERE su.street_code = so.OrgCode
AND (su.community_code IS NULL OR su.community_code = '')
)streetNum,
(
SELECT COUNT(*) FROM SysUser su
WHERE su.street_code = so.OrgCode
AND su.community_code IS NOT NULL AND su.community_code != ''
)communityNum,
(SELECT COUNT(*) FROM SysEnterprise se
WHERE se.street_code = so.OrgCode AND 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>
) totalEnt,
(
SELECT COUNT(*) FROM SysEnterprise se
WHERE se.street_code = so.OrgCode
AND 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>
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 &lt;= #{endTime}
</if>
) > 0
) checkEntNum,
(
SELECT COUNT(*) FROM BookEntCheck bc
LEFT JOIN SysEnterprise se ON bc.BaseEntId = se.SysEnterpriseId
WHERE se.street_code = so.OrgCode AND 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 != startTime and '' != startTime">
AND bc.CreatedOn >= #{startTime}
</if>
<if test="null != endTime and '' != endTime">
AND bc.CreatedOn &lt;= #{endTime}
</if>
) totalCheck,
(
SELECT COUNT(*) FROM BookEntHT bh
LEFT JOIN SysEnterprise se ON bh.SysEnterpriseId = se.SysEnterpriseId
WHERE se.street_code = so.OrgCode AND 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 != startTime and '' != startTime">
AND bh.CreatedOn >= #{startTime}
</if>
<if test="null != endTime and '' != endTime">
AND bh.CreatedOn &lt;= #{endTime}
</if>
) totalDangerNum,
(
SELECT COUNT(*) FROM BookEntHT bh
LEFT JOIN SysEnterprise se ON bh.SysEnterpriseId = se.SysEnterpriseId
WHERE se.street_code = so.OrgCode AND 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>
AND bh.HTState = '已整改'
<if test="null != startTime and '' != startTime">
AND bh.CreatedOn >= #{startTime}
</if>
<if test="null != endTime and '' != endTime">
AND bh.CreatedOn &lt;= #{endTime}
</if>
) rectifyNum
FROM SysOrg so
WHERE so.SuperiorOrgCode = '510114'
<if test="null != streetCode and '' != streetCode">
and so.OrgCode = #{streetCode}
</if>
</select>
<!--社区检查情况-->
<resultMap id="CommunityCheckMsgResultMap" type="com.rzyc.bean.check.CommunityCheckMsg">
<result column="orgName" jdbcType="VARCHAR" property="orgName" />
<result column="communityNum" jdbcType="INTEGER" property="communityNum" />
<result column="totalEnt" jdbcType="INTEGER" property="totalEnt" />
<result column="checkEntNum" jdbcType="INTEGER" property="checkEntNum" />
<result column="totalCheck" jdbcType="INTEGER" property="totalCheck" />
<result column="totalDangerNum" jdbcType="INTEGER" property="totalDangerNum" />
<result column="rectifyNum" jdbcType="INTEGER" property="rectifyNum" />
</resultMap>
<!--社区检查情况-->
<select id="communityCheckMsg" resultMap="CommunityCheckMsgResultMap">
SELECT so.OrgName orgName,
(
SELECT COUNT(*) FROM SysUser su WHERE su.community_code = so.OrgCode
)communityNum,
(SELECT COUNT(*) FROM SysEnterprise se
WHERE se.community_code = so.OrgCode AND 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>
) totalEnt,
(
SELECT COUNT(*) FROM SysEnterprise se
WHERE se.community_code = so.OrgCode
AND 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>
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 &lt;= #{endTime}
</if>
) > 0
) checkEntNum,
(
SELECT COUNT(*) FROM BookEntCheck bc
LEFT JOIN SysEnterprise se ON bc.BaseEntId = se.SysEnterpriseId
WHERE se.community_code = so.OrgCode AND 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 != startTime and '' != startTime">
AND bc.CreatedOn >= #{startTime}
</if>
<if test="null != endTime and '' != endTime">
AND bc.CreatedOn &lt;= #{endTime}
</if>
) totalCheck,
(
SELECT COUNT(*) FROM BookEntHT bh
LEFT JOIN SysEnterprise se ON bh.SysEnterpriseId = se.SysEnterpriseId
WHERE se.community_code = so.OrgCode AND 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 != startTime and '' != startTime">
AND bh.CreatedOn >= #{startTime}
</if>
<if test="null != endTime and '' != endTime">
AND bh.CreatedOn &lt;= #{endTime}
</if>
) totalDangerNum,
(
SELECT COUNT(*)
FROM BookEntHT bh
LEFT JOIN SysEnterprise se ON bh.SysEnterpriseId = se.SysEnterpriseId
WHERE se.community_code = so.OrgCode AND 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>
AND bh.HTState = '未整改'
<if test="null != startTime and '' != startTime">
AND bh.CreatedOn >= #{startTime}
</if>
<if test="null != endTime and '' != endTime">
AND bh.CreatedOn &lt;= #{endTime}
</if>
) rectifyNum
FROM SysOrg so
WHERE so.SuperiorOrgCode = #{streetCode}
<if test="null != communityCode and '' != communityCode">
AND so.OrgCode = #{communityCode}
</if>
</select>
<!--履职检查记录-->
<select id="factorCheck" resultMap="BaseResultMap">
SELECT bc.*,su.UnitName
FROM BookEntCheck bc
LEFT JOIN SysUnit su ON bc.CheckUniy=su.SysUnitId
LEFT JOIN SysEnterprise se ON se.SysEnterpriseId=bc.BaseEntId
LEFT JOIN ListDetaCheck lc ON lc.BookEntCheckId = bc.BookEntCheckId
LEFT JOIN ListDetail ld ON lc.`ListDetailId` = ld.`ListDetailId`
WHERE se.State = '启用' and ld.`ListFactorId` = #{listFactorId}
ORDER BY ModifiedOn DESC
</select>
<!--检查日历-->
<resultMap id="CheckCalendarResultMap" type="com.rzyc.bean.check.CheckCalendar">
<result column="times" jdbcType="VARCHAR" property="time" />
<result column="checkNum" jdbcType="VARCHAR" property="checkNum" />
</resultMap>
<!--检查日历-->
<select id="checkCalendar" resultMap="CheckCalendarResultMap">
SELECT DATE_FORMAT(bc.`CreatedOn`,"%Y-%m-%d") times,COUNT(*) checkNum
FROM BookEntCheck bc
left join ChkPerson cp on bc.BookEntCheckId = cp.BookEntCheckId
where bc.CreatedOn like #{condition} and cp.SysUserId = #{userId}
GROUP BY DATE_FORMAT(bc.`CreatedOn`,"%Y-%m-%d")
order by times asc
</select>
<!--用户检查记录-->
<select id="userCheckList" resultMap="BaseResultMap">
select bc.*,se.EntName,su.UnitName from BookEntCheck bc
left join SysUnit su on bc.CheckUniy=su.SysUnitId
left join SysEnterprise se on se.SysEnterpriseId=bc.BaseEntId
left join ChkPerson cp on bc.BookEntCheckId = cp.BookEntCheckId
where cp.SysUserId = #{userId} and bc.CreatedOn like #{condition}
order by CreatedOn desc
</select>
<!--周检查信息-->
<resultMap id="WeekCheckInfoResultMap" type="com.rzyc.bean.bigdata.WeekCheckInfo">
<result column="orgcode" jdbcType="VARCHAR" property="orgcode" />
<result column="orgname" jdbcType="VARCHAR" property="orgname" />
<result column="checkNum" jdbcType="INTEGER" property="checkNum" />
</resultMap>
<!--周检查信息-->
<select id="weekCheckInfo" resultMap="WeekCheckInfoResultMap">
SELECT so.OrgCode, so.OrgName,COUNT(be.BookEntCheckId) checkNum
FROM SysOrg so
LEFT JOIN SysEnterprise se
ON (se.street_code = so.OrgCode or se.community_code = so.OrgCode )
AND se.State = '启用'
LEFT JOIN BookEntCheck be
ON se.SysEnterpriseId = be.BaseEntId
AND YEARWEEK( DATE_FORMAT( be.CreatedOn,'%Y-%m-%d' ) ) = YEARWEEK( NOW() )
WHERE so.SuperiorOrgCode = #{parentId}
GROUP BY so.OrgCode
ORDER BY so.OrgCode
</select>
<!--检查情况-->
<resultMap id="DutyNetResultMap" type="com.rzyc.bean.bigdata.DutyNet">
<result column="OrgCode" jdbcType="VARCHAR" property="targetId" />
<result column="OrgName" jdbcType="VARCHAR" property="showName" />
<result column="ChinaName" jdbcType="VARCHAR" property="leaderName" />
<result column="totalEnt" jdbcType="VARCHAR" property="totalEnt" />
<result column="checkEnt" jdbcType="VARCHAR" property="checkEnt" />
</resultMap>
<!--多个街道、社区检查情况-->
<select id="streetCheckList" resultMap="DutyNetResultMap">
select so.OrgCode,so.OrgName,su.ChinaName,
(
select count(*) from SysEnterprise se
where (se.`OrgCode` = so.OrgCode
OR se.`street_code` = so.OrgCode
OR se.`community_code` = so.OrgCode) and se.State = '启用'
) totalEnt,
(
select count(distinct be.BaseEntId)
from BookEntCheck be
left join SysEnterprise se on be.BaseEntId = se.SysEnterpriseId
where (se.`OrgCode` = so.OrgCode
OR se.`street_code` = so.OrgCode
OR se.`community_code` = so.OrgCode) and se.State = '启用'
AND YEARWEEK( DATE_FORMAT( be.CreatedOn,'%Y-%m-%d' ) ) = YEARWEEK( NOW() )
)checkEnt
from SysOrg so
left join SysUser su on (su.street_code = so.OrgCode or su.community_code = so.OrgCode )
and su.member_type = #{memberType}
where so.SuperiorOrgCode = #{parentId} and su.State = '启用'
order by so.OrgCode asc
</select>
<!--单个街道检查情况-->
<select id="streetCheck" resultMap="DutyNetResultMap">
select so.OrgCode,so.OrgName,su.ChinaName,
(
select count(*) from SysEnterprise se
where se.street_code = so.OrgCode and se.State = '启用'
) totalEnt,
(
select count(distinct be.BaseEntId)
from BookEntCheck be
left join SysEnterprise se on be.BaseEntId = se.SysEnterpriseId
where se.street_code = so.OrgCode and se.State = '启用'
AND YEARWEEK( DATE_FORMAT( be.CreatedOn,'%Y-%m-%d' ) ) = YEARWEEK( NOW() )
)checkEnt
from SysOrg so
left join SysUser su on so.OrgCode = su.street_code and su.member_type = #{memberType}
where so.OrgCode = #{orgCode} and su.State = '启用'
</select>
<!--本月检查企业数-->
<select id="countByAreaCode" resultType="java.lang.Integer">
select count(DISTINCT bc.BaseEntId)
from BookEntCheck bc
left join SysEnterprise se on bc.BaseEntId = se.SysEnterpriseId
where se.State = '启用' and DATE_FORMAT(bc.CreatedOn,'%Y%m')=DATE_FORMAT(CURDATE(),'%Y%m')
and (se.OrgCode = #{areaCode}
or se.street_code = #{areaCode}
or se.community_code = #{areaCode})
</select>
<!--本月检查企业数-->
<select id="countByTime" resultType="java.lang.Integer">
select count(DISTINCT bc.BaseEntId)
from BookEntCheck bc
left join SysEnterprise se on bc.BaseEntId = se.SysEnterpriseId
where se.State = '启用'
<if test="null != startTime and '' != startTime">
and bc.CreatedOn >= #{startTime}
</if>
<if test="null != endTime and '' != endTime">
and bc.CreatedOn &lt;= #{endTime}
</if>
and (se.OrgCode = #{areaCode}
or se.street_code = #{areaCode}
or se.community_code = #{areaCode})
</select>
<select id="countByRisk" resultType="java.lang.Integer">
select count(DISTINCT bc.BaseEntId)
from BookEntCheck bc
left join SysEnterprise se on bc.BaseEntId = se.SysEnterpriseId
where se.State = '启用'
<if test="null != startTime and '' != startTime">
and bc.CreatedOn >= #{startTime}
</if>
<if test="null != endTime and '' != endTime">
and bc.CreatedOn &lt;= #{endTime}
</if>
<if test="null != riskLevel and '' != riskLevel">
and se.InherentRisk = #{riskLevel}
</if>
and (se.OrgCode = #{areaCode}
or se.street_code = #{areaCode}
or se.community_code = #{areaCode})
</select>
</mapper>