461 lines
15 KiB
XML
461 lines
15 KiB
XML
<?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.cm.inspection.dao.enterprise.IEnterpriseDao">
|
|
|
|
<resultMap id="enterpriseDTO" type="com.cm.inspection.pojo.dtos.enterprise.EnterpriseDTO">
|
|
<id column="enterprise_id" property="enterpriseId"/>
|
|
<result column="name" property="name"/>
|
|
<result column="type" property="type"/>
|
|
<result column="type_dictionary_name" property="typeDictionaryName"/>
|
|
<result column="area1" property="area1"/>
|
|
<result column="area1_dictionary_name" property="area1DictionaryName"/>
|
|
<result column="area2" property="area2"/>
|
|
<result column="area2_dictionary_name" property="area2DictionaryName"/>
|
|
<result column="area3" property="area3"/>
|
|
<result column="area3_dictionary_name" property="area3DictionaryName"/>
|
|
<result column="area4" property="area4"/>
|
|
<result column="area4_dictionary_name" property="area4DictionaryName"/>
|
|
<result column="area5" property="area5"/>
|
|
<result column="area5_dictionary_name" property="area5DictionaryName"/>
|
|
<result column="address" property="address"/>
|
|
<result column="industry_type" property="industryType"/>
|
|
<result column="industry_type_dictionary_name" property="industryTypeDictionaryName"/>
|
|
<result column="industry" property="industry"/>
|
|
<result column="industry_dictionary_name" property="industryDictionaryName"/>
|
|
<result column="engaged_count" property="engagedCount"/>
|
|
<result column="risk_operation" property="riskOperation"/>
|
|
<result column="risk_operation_dictionary_name" property="riskOperationDictionaryName"/>
|
|
<result column="master" property="master"/>
|
|
<result column="phone" property="phone"/>
|
|
<result column="factory_gate" property="factoryGate"/>
|
|
<result column="workplace" property="workplace"/>
|
|
<result column="industry_type" property="industryType"/>
|
|
<result column="bussiness_reg_num" property="bussinessRegNum"/>
|
|
<result column="legal_person" property="legalPerson"/>
|
|
<result column="summary" property="summary"/>
|
|
<result column="classify" property="classify"/>
|
|
<result column="classify_dictionary_name" property="classifyDictionaryName"/>
|
|
<result column="nature" property="nature"/>
|
|
<result column="nature_dictionary_name" property="natureDictionaryName"/>
|
|
<result column="is_log_off" property="isLogOff"/>
|
|
<result column="remarks" property="remarks"/>
|
|
</resultMap>
|
|
|
|
<!-- 新增企业 -->
|
|
<insert id="saveEnterprise" parameterType="map">
|
|
INSERT INTO gen_enterprise(
|
|
enterprise_id,
|
|
name,
|
|
type,
|
|
area1,
|
|
area2,
|
|
area3,
|
|
area4,
|
|
area5,
|
|
address,
|
|
industry,
|
|
engaged_count,
|
|
risk_operation,
|
|
master,
|
|
phone,
|
|
factory_gate,
|
|
workplace,
|
|
industry_type,
|
|
bussiness_reg_num,
|
|
legal_person,
|
|
summary,
|
|
type_dictionary_name,
|
|
area1_dictionary_name,
|
|
area2_dictionary_name,
|
|
area3_dictionary_name,
|
|
area4_dictionary_name,
|
|
area5_dictionary_name,
|
|
industry_type_dictionary_name,
|
|
industry_dictionary_name,
|
|
risk_operation_dictionary_name,
|
|
classify,
|
|
classify_dictionary_name,
|
|
nature,
|
|
nature_dictionary_name,
|
|
is_log_off,
|
|
remarks,
|
|
creator,
|
|
gmt_create,
|
|
modifier,
|
|
gmt_modified,
|
|
is_delete
|
|
) VALUES(
|
|
#{enterpriseId},
|
|
#{name},
|
|
#{type},
|
|
#{area1},
|
|
#{area2},
|
|
#{area3},
|
|
#{area4},
|
|
#{area5},
|
|
#{address},
|
|
#{industry},
|
|
#{engagedCount},
|
|
#{riskOperation},
|
|
#{master},
|
|
#{phone},
|
|
#{factoryGate},
|
|
#{workplace},
|
|
#{industryType},
|
|
#{bussinessRegNum},
|
|
#{legalPerson},
|
|
#{summary},
|
|
#{typeDictionaryName},
|
|
#{area1DictionaryName},
|
|
#{area2DictionaryName},
|
|
#{area3DictionaryName},
|
|
#{area4DictionaryName},
|
|
#{area5DictionaryName},
|
|
#{industryTypeDictionaryName},
|
|
#{industryDictionaryName},
|
|
#{riskOperationDictionaryName},
|
|
#{classify},
|
|
#{classifyDictionaryName},
|
|
#{nature},
|
|
#{natureDictionaryName},
|
|
#{isLogOff},
|
|
#{remarks},
|
|
#{creator},
|
|
#{gmtCreate},
|
|
#{modifier},
|
|
#{gmtModified},
|
|
#{isDelete}
|
|
)
|
|
</insert>
|
|
|
|
<!-- 删除企业 -->
|
|
<update id="removeEnterprise" parameterType="map">
|
|
UPDATE
|
|
gen_enterprise
|
|
SET
|
|
is_delete = 1,
|
|
modifier = #{modifier},
|
|
gmt_modified = #{gmtModified}
|
|
WHERE
|
|
enterprise_id IN
|
|
<foreach collection="enterpriseIds" index="index" open="(" separator="," close=")">
|
|
#{enterpriseIds[${index}]}
|
|
</foreach>
|
|
</update>
|
|
|
|
<!-- 修改企业 -->
|
|
<update id="updateEnterprise" parameterType="map">
|
|
UPDATE
|
|
gen_enterprise
|
|
SET
|
|
<if test="name != null and name != ''">
|
|
name = #{name},
|
|
</if>
|
|
<if test="type != null and type != ''">
|
|
type = #{type},
|
|
</if>
|
|
<if test="area1 != null and area1 != ''">
|
|
area1 = #{area1},
|
|
</if>
|
|
<if test="area2 != null and area2 != ''">
|
|
area2 = #{area2},
|
|
</if>
|
|
<if test="area3 != null and area3 != ''">
|
|
area3 = #{area3},
|
|
</if>
|
|
<if test="area4 != null and area4 != ''">
|
|
area4 = #{area4},
|
|
</if>
|
|
<if test="area5 != null and area5 != ''">
|
|
area5 = #{area5},
|
|
</if>
|
|
<if test="address != null and address != ''">
|
|
address = #{address},
|
|
</if>
|
|
<if test="industry != null and industry != ''">
|
|
industry = #{industry},
|
|
</if>
|
|
<if test="engagedCount != null">
|
|
engaged_count = #{engagedCount},
|
|
</if>
|
|
<if test="riskOperation != null and riskOperation != ''">
|
|
risk_operation = #{riskOperation},
|
|
</if>
|
|
<if test="master != null and master != ''">
|
|
master = #{master},
|
|
</if>
|
|
<if test="phone != null and phone != ''">
|
|
phone = #{phone},
|
|
</if>
|
|
<if test="factoryGate != null and factoryGate != ''">
|
|
factory_gate = #{factoryGate},
|
|
</if>
|
|
<if test="workplace != null and workplace != ''">
|
|
workplace = #{workplace},
|
|
</if>
|
|
<if test="industryType != null and industryType != ''">
|
|
industry_type = #{industryType},
|
|
</if>
|
|
<if test="bussinessRegNum != null and bussinessRegNum != ''">
|
|
bussiness_reg_num = #{bussinessRegNum},
|
|
</if>
|
|
<if test="legalPerson != null and legalPerson != ''">
|
|
legal_person = #{legalPerson},
|
|
</if>
|
|
<if test="summary != null and summary != ''">
|
|
summary = #{summary},
|
|
</if>
|
|
<if test="typeDictionaryName != null and typeDictionaryName != ''">
|
|
type_dictionary_name = #{typeDictionaryName},
|
|
</if>
|
|
<if test="area1DictionaryName != null and area1DictionaryName != ''">
|
|
area1_dictionary_name = #{area1DictionaryName},
|
|
</if>
|
|
<if test="area2DictionaryName != null and area2DictionaryName != ''">
|
|
area2_dictionary_name = #{area2DictionaryName},
|
|
</if>
|
|
<if test="area3NictionaryName != null and area3NictionaryName != ''">
|
|
area3_dictionary_name = #{area3NictionaryName},
|
|
</if>
|
|
<if test="area4NictionaryName != null and area4NictionaryName != ''">
|
|
area4_dictionary_name = #{area4NictionaryName},
|
|
</if>
|
|
<if test="area5NictionaryName != null and area5NictionaryName != ''">
|
|
area5_dictionary_name = #{area5NictionaryName},
|
|
</if>
|
|
<if test="industryTypeNictionaryName != null and industryTypeNictionaryName != ''">
|
|
industry_type_dictionary_name = #{industryTypeNictionaryName},
|
|
</if>
|
|
<if test="industryNictionaryName != null and industryNictionaryName != ''">
|
|
industry_dictionary_name = #{industryNictionaryName},
|
|
</if>
|
|
<if test="riskOperationNictionaryName != null and riskOperationNictionaryName != ''">
|
|
risk_operation_dictionary_name = #{riskOperationNictionaryName},
|
|
</if>
|
|
<if test="classify != null and classify != ''">
|
|
classify = #{classify},
|
|
</if>
|
|
<if test="classifyDictionaryName != null and classifyDictionaryName != ''">
|
|
classify_dictionary_name = #{classifyDictionaryName},
|
|
</if>
|
|
<if test="nature != null and nature != ''">
|
|
nature = #{nature},
|
|
</if>
|
|
<if test="natureDictionaryName != null and natureDictionaryName != ''">
|
|
nature_dictionary_name = #{natureDictionaryName},
|
|
</if>
|
|
<if test="isLogOff != null and isLogOff != ''">
|
|
is_log_off = #{isLogOff},
|
|
</if>
|
|
modifier = #{modifier},
|
|
gmt_modified = #{gmtModified}
|
|
WHERE
|
|
enterprise_id = #{enterpriseId}
|
|
</update>
|
|
|
|
<!-- 修改企业位置 -->
|
|
<update id="updateEnterpriseLocation" parameterType="map">
|
|
UPDATE
|
|
gen_enterprise
|
|
SET
|
|
<if test="enterpriseLng != null and enterpriseLng != ''">
|
|
enterprise_lng = #{enterpriseLng},
|
|
</if>
|
|
<if test="enterpriseLat != null and enterpriseLat != ''">
|
|
enterprise_lat = #{enterpriseLat},
|
|
</if>
|
|
modifier = #{modifier},
|
|
gmt_modified = #{gmtModified}
|
|
WHERE
|
|
enterprise_id = #{enterpriseId}
|
|
</update>
|
|
|
|
<!-- 企业详情 -->
|
|
<select id="getEnterprise" parameterType="map" resultMap="enterpriseDTO">
|
|
SELECT
|
|
t1.name,
|
|
t1.type,
|
|
t1.type_dictionary_name,
|
|
t1.area1,
|
|
t1.area1_dictionary_name,
|
|
t1.area2,
|
|
t1.area2_dictionary_name,
|
|
t1.area3,
|
|
t1.area3_dictionary_name,
|
|
t1.area4,
|
|
t1.area4_dictionary_name,
|
|
t1.area5,
|
|
t1.area5_dictionary_name,
|
|
t1.address,
|
|
t1.industry,
|
|
t1.industry_dictionary_name,
|
|
t1.engaged_count,
|
|
t1.risk_operation,
|
|
t1.risk_operation_dictionary_name,
|
|
t1.master,
|
|
t1.phone,
|
|
t1.factory_gate,
|
|
t1.workplace,
|
|
t1.industry_type,
|
|
t1.industry_type_dictionary_name,
|
|
t1.bussiness_reg_num,
|
|
t1.legal_person,
|
|
t1.summary,
|
|
t1.classify,
|
|
t1.classify_dictionary_name,
|
|
t1.nature,
|
|
t1.nature_dictionary_name,
|
|
t1.is_log_off,
|
|
t1.remarks,
|
|
t1.enterprise_id
|
|
FROM
|
|
gen_enterprise t1
|
|
WHERE
|
|
t1.is_delete = 0
|
|
<if test="enterpriseId != null and enterpriseId != ''">
|
|
AND
|
|
t1.enterprise_id = #{enterpriseId}
|
|
</if>
|
|
</select>
|
|
|
|
<!-- 企业详情单表 -->
|
|
<select id="getEnterpriseSingle" resultMap="enterpriseDTO">
|
|
SELECT
|
|
t1.name,
|
|
t1.type,
|
|
t1.area1,
|
|
t1.area2,
|
|
t1.area3,
|
|
t1.area4,
|
|
t1.area5,
|
|
t1.address,
|
|
t1.industry_type,
|
|
t1.industry,
|
|
t1.engaged_count,
|
|
t1.risk_operation,
|
|
t1.master,
|
|
t1.phone,
|
|
t1.factory_gate,
|
|
t1.workplace,
|
|
t1.industry_type,
|
|
t1.bussiness_reg_num,
|
|
t1.legal_person,
|
|
t1.summary,
|
|
t1.classify,
|
|
t1.classify_dictionary_name,
|
|
t1.nature,
|
|
t1.nature_dictionary_name,
|
|
t1.is_log_off,
|
|
t1.remarks,
|
|
t1.enterprise_id
|
|
FROM
|
|
gen_enterprise t1
|
|
WHERE
|
|
t1.is_delete = 0
|
|
<if test="enterpriseId != null and enterpriseId != ''">
|
|
AND
|
|
t1.enterprise_id = #{enterpriseId}
|
|
</if>
|
|
</select>
|
|
|
|
<!-- 企业列表 -->
|
|
<select id="listEnterprise" parameterType="map" resultMap="enterpriseDTO">
|
|
SELECT
|
|
t1.name,
|
|
t1.type,
|
|
t1.type_dictionary_name,
|
|
t1.area1,
|
|
t1.area1_dictionary_name,
|
|
t1.area2,
|
|
t1.area2_dictionary_name,
|
|
t1.area3,
|
|
t1.area3_dictionary_name,
|
|
t1.area4,
|
|
t1.area4_dictionary_name,
|
|
t1.area5,
|
|
t1.area5_dictionary_name,
|
|
t1.address,
|
|
t1.industry,
|
|
t1.industry_dictionary_name,
|
|
t1.engaged_count,
|
|
t1.risk_operation,
|
|
t1.risk_operation_dictionary_name,
|
|
t1.master,
|
|
t1.phone,
|
|
t1.industry_type,
|
|
t1.industry_type_dictionary_name,
|
|
t1.bussiness_reg_num,
|
|
t1.legal_person,
|
|
t1.summary,
|
|
t1.classify,
|
|
t1.classify_dictionary_name,
|
|
t1.nature,
|
|
t1.nature_dictionary_name,
|
|
t1.is_log_off,
|
|
t1.remarks,
|
|
t1.enterprise_id
|
|
FROM
|
|
gen_enterprise t1
|
|
WHERE
|
|
t1.is_delete = 0
|
|
<if test="keywords != null and keywords != ''">
|
|
AND
|
|
t1.name LIKE CONCAT('%', #{keywords}, '%')
|
|
</if>
|
|
<if test="startTime != null and startTime != ''">
|
|
AND
|
|
LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
|
|
</if>
|
|
<if test="endTime != null and endTime != ''">
|
|
AND
|
|
LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
|
|
</if>
|
|
<if test="area1 != null and area1 != ''">
|
|
AND
|
|
t1.area1 = #{area1}
|
|
</if>
|
|
<if test="area2 != null and area2 != ''">
|
|
AND
|
|
t1.area2 = #{area2}
|
|
</if>
|
|
<if test="area3 != null and area3 != ''">
|
|
AND
|
|
t1.area3 = #{area3}
|
|
</if>
|
|
<if test="area4 != null and area4 != ''">
|
|
AND
|
|
t1.area4 = #{area4}
|
|
</if>
|
|
<if test="area5 != null and area5 != ''">
|
|
AND
|
|
t1.area5 = #{area5}
|
|
</if>
|
|
<if test="enterpriseIds != null and enterpriseIds.size > 0">
|
|
AND
|
|
t1.enterprise_id IN
|
|
<foreach collection="enterpriseIds" index="index" open="(" separator="," close=")">
|
|
#{enterpriseIds[${index}]}
|
|
</foreach>
|
|
</if>
|
|
</select>
|
|
|
|
<!-- 统计企业 -->
|
|
<select id="countEnterprise" parameterType="map" resultType="java.lang.Integer">
|
|
SELECT
|
|
COUNT(*)
|
|
FROM
|
|
gen_enterprise
|
|
WHERE
|
|
is_delete = 0
|
|
<if test="isLogOff != null">
|
|
AND
|
|
is_log_off = #{isLogOff}
|
|
</if>
|
|
<if test="nature != null and nature != ''">
|
|
AND
|
|
nature = #{nature}
|
|
</if>
|
|
</select>
|
|
|
|
|
|
</mapper> |