<?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.javaweb.geo.mapper.CompanyMapper">
|
|
<resultMap type="Company" id="CompanyResult">
|
<result property="ids" column="ids" />
|
<result property="addTime" column="add_time" />
|
<result property="cardAnnex" column="card_annex" />
|
<result property="cardBackAnnex" column="card_back_annex" />
|
<result property="city" column="city" />
|
<result property="code" column="code" />
|
<result property="creditAnnex" column="credit_annex" />
|
<result property="creditCode" column="credit_code" />
|
<result property="district" column="district" />
|
<result property="fullName" column="full_name" />
|
<result property="idCard" column="id_card" />
|
<result property="legalPerson" column="legal_person" />
|
<result property="legalPersonPhone" column="legal_person_phone" />
|
<result property="powerOfAttorneyAnnex" column="power_of_attorney_annex" />
|
<result property="province" column="province" />
|
<result property="regAddress" column="reg_address" />
|
<result property="secretKey" column="secret_key" />
|
<result property="nature" column="nature" />
|
<result property="position" column="position" />
|
<result property="certificationsCode" column="certifications_code" />
|
<result property="certificationsAnnex" column="certifications_annex" />
|
<result property="description" column="description" />
|
<result property="certificationsCode2" column="certifications_code2" />
|
<result property="certificationsAnnex2" column="certifications_annex2" />
|
<result property="userName" column="user_name" />
|
<result property="userPhone" column="user_phone" />
|
<result property="category" column="category" />
|
<result property="status" column="status" />
|
<result property="projectNums" column="project_nums" />
|
</resultMap>
|
|
<sql id="selectCompanyVo">
|
select ids, add_time, card_annex, card_back_annex, city, code, credit_annex, credit_code, district, full_name, id_card, legal_person, legal_person_phone, power_of_attorney_annex, province, reg_address, secret_key, nature, position, certifications_code, certifications_annex, description, certifications_code2, certifications_annex2, user_name, user_phone, category, status from js_company
|
</sql>
|
|
<select id="selectCompanyList" parameterType="Company" resultMap="CompanyResult">
|
<include refid="selectCompanyVo"/>
|
<where>
|
<if test="ids != null and ids != ''"> and ids = #{ids}</if>
|
<if test="addTime != null "> and add_time = #{addTime}</if>
|
<if test="cardAnnex != null and cardAnnex != ''"> and card_annex = #{cardAnnex}</if>
|
<if test="cardBackAnnex != null and cardBackAnnex != ''"> and card_back_annex = #{cardBackAnnex}</if>
|
<if test="city != null and city != ''"> and city = #{city}</if>
|
<if test="code != null and code != ''"> and code = #{code}</if>
|
<if test="creditAnnex != null and creditAnnex != ''"> and credit_annex = #{creditAnnex}</if>
|
<if test="creditCode != null and creditCode != ''"> and credit_code = #{creditCode}</if>
|
<if test="district != null and district != ''"> and district = #{district}</if>
|
<if test="fullName != null and fullName != ''"> and full_name like concat('%', #{fullName}, '%')</if>
|
<if test="idCard != null and idCard != ''"> and id_card = #{idCard}</if>
|
<if test="legalPerson != null and legalPerson != ''"> and legal_person = #{legalPerson}</if>
|
<if test="legalPersonPhone != null and legalPersonPhone != ''"> and legal_person_phone = #{legalPersonPhone}</if>
|
<if test="powerOfAttorneyAnnex != null and powerOfAttorneyAnnex != ''"> and power_of_attorney_annex = #{powerOfAttorneyAnnex}</if>
|
<if test="province != null and province != ''"> and province = #{province}</if>
|
<if test="regAddress != null and regAddress != ''"> and reg_address = #{regAddress}</if>
|
<if test="secretKey != null and secretKey != ''"> and secret_key = #{secretKey}</if>
|
<if test="nature != null and nature != ''"> and nature = #{nature}</if>
|
<if test="position != null and position != ''"> and position = #{position}</if>
|
<if test="certificationsCode != null and certificationsCode != ''"> and certifications_code = #{certificationsCode}</if>
|
<if test="certificationsAnnex != null and certificationsAnnex != ''"> and certifications_annex = #{certificationsAnnex}</if>
|
<if test="description != null and description != ''"> and description = #{description}</if>
|
<if test="certificationsCode2 != null and certificationsCode2 != ''"> and certifications_code2 = #{certificationsCode2}</if>
|
<if test="certificationsAnnex2 != null and certificationsAnnex2 != ''"> and certifications_annex2 = #{certificationsAnnex2}</if>
|
<if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
|
<if test="userPhone != null and userPhone != ''"> and user_phone = #{userPhone}</if>
|
<if test="category != null and category != ''"> and category = #{category}</if>
|
<if test="status != null and status != ''"> and status = #{status}</if>
|
</where>
|
</select>
|
|
<select id="selectCompanyById" parameterType="String" resultMap="CompanyResult">
|
<include refid="selectCompanyVo"/>
|
where ids = #{ids}
|
</select>
|
|
<select id="selectAllCompanyNum" resultType="java.lang.Long">
|
SELECT count(ids) FROM js_company
|
</select>
|
|
<select id="selectCompanyNum" resultType="java.lang.Long">
|
select count(a.ids) from (SELECT * FROM js_project WHERE `status` = '0' AND is_deleted = '0' GROUP BY company_id) a
|
</select>
|
|
<select id="selectCompanProjectNums" resultMap="CompanyResult">
|
SELECT
|
a.full_name,
|
count(b.full_name) AS project_nums
|
FROM
|
js_company a
|
LEFT JOIN js_project b ON a.ids = b.company_id
|
<where>
|
<if test="startTime != null and startTime != ''">
|
and b.create_time >= #{startTime,jdbcType=TIMESTAMP}
|
</if>
|
<if test="endTime != null and endTime != ''">
|
and b.create_time <= #{endTime,jdbcType=TIMESTAMP}
|
</if>
|
</where>
|
GROUP BY
|
a.full_name
|
ORDER BY project_nums DESC
|
LIMIT 0,10
|
</select>
|
|
<insert id="insertCompany" parameterType="Company">
|
insert into js_company
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="ids != null and ids != ''">ids,</if>
|
<if test="addTime != null ">add_time,</if>
|
<if test="cardAnnex != null and cardAnnex != ''">card_annex,</if>
|
<if test="cardBackAnnex != null and cardBackAnnex != ''">card_back_annex,</if>
|
<if test="city != null and city != ''">city,</if>
|
<if test="code != null and code != ''">code,</if>
|
<if test="creditAnnex != null and creditAnnex != ''">credit_annex,</if>
|
<if test="creditCode != null and creditCode != ''">credit_code,</if>
|
<if test="district != null and district != ''">district,</if>
|
<if test="fullName != null and fullName != ''">full_name,</if>
|
<if test="idCard != null and idCard != ''">id_card,</if>
|
<if test="legalPerson != null and legalPerson != ''">legal_person,</if>
|
<if test="legalPersonPhone != null and legalPersonPhone != ''">legal_person_phone,</if>
|
<if test="powerOfAttorneyAnnex != null and powerOfAttorneyAnnex != ''">power_of_attorney_annex,</if>
|
<if test="province != null and province != ''">province,</if>
|
<if test="regAddress != null and regAddress != ''">reg_address,</if>
|
<if test="secretKey != null and secretKey != ''">secret_key,</if>
|
<if test="nature != null and nature != ''">nature,</if>
|
<if test="position != null and position != ''">position,</if>
|
<if test="certificationsCode != null and certificationsCode != ''">certifications_code,</if>
|
<if test="certificationsAnnex != null and certificationsAnnex != ''">certifications_annex,</if>
|
<if test="description != null and description != ''">description,</if>
|
<if test="certificationsCode2 != null and certificationsCode2 != ''">certifications_code2,</if>
|
<if test="certificationsAnnex2 != null and certificationsAnnex2 != ''">certifications_annex2,</if>
|
<if test="userName != null and userName != ''">user_name,</if>
|
<if test="userPhone != null and userPhone != ''">user_phone,</if>
|
<if test="category != null and category != ''">category,</if>
|
<if test="status != null and status != ''">status,</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="ids != null and ids != ''">#{ids},</if>
|
<if test="addTime != null ">#{addTime},</if>
|
<if test="cardAnnex != null and cardAnnex != ''">#{cardAnnex},</if>
|
<if test="cardBackAnnex != null and cardBackAnnex != ''">#{cardBackAnnex},</if>
|
<if test="city != null and city != ''">#{city},</if>
|
<if test="code != null and code != ''">#{code},</if>
|
<if test="creditAnnex != null and creditAnnex != ''">#{creditAnnex},</if>
|
<if test="creditCode != null and creditCode != ''">#{creditCode},</if>
|
<if test="district != null and district != ''">#{district},</if>
|
<if test="fullName != null and fullName != ''">#{fullName},</if>
|
<if test="idCard != null and idCard != ''">#{idCard},</if>
|
<if test="legalPerson != null and legalPerson != ''">#{legalPerson},</if>
|
<if test="legalPersonPhone != null and legalPersonPhone != ''">#{legalPersonPhone},</if>
|
<if test="powerOfAttorneyAnnex != null and powerOfAttorneyAnnex != ''">#{powerOfAttorneyAnnex},</if>
|
<if test="province != null and province != ''">#{province},</if>
|
<if test="regAddress != null and regAddress != ''">#{regAddress},</if>
|
<if test="secretKey != null and secretKey != ''">#{secretKey},</if>
|
<if test="nature != null and nature != ''">#{nature},</if>
|
<if test="position != null and position != ''">#{position},</if>
|
<if test="certificationsCode != null and certificationsCode != ''">#{certificationsCode},</if>
|
<if test="certificationsAnnex != null and certificationsAnnex != ''">#{certificationsAnnex},</if>
|
<if test="description != null and description != ''">#{description},</if>
|
<if test="certificationsCode2 != null and certificationsCode2 != ''">#{certificationsCode2},</if>
|
<if test="certificationsAnnex2 != null and certificationsAnnex2 != ''">#{certificationsAnnex2},</if>
|
<if test="userName != null and userName != ''">#{userName},</if>
|
<if test="userPhone != null and userPhone != ''">#{userPhone},</if>
|
<if test="category != null and category != ''">#{category},</if>
|
<if test="status != null and status != ''">#{status},</if>
|
</trim>
|
</insert>
|
|
<update id="updateCompany" parameterType="Company">
|
update js_company
|
<trim prefix="SET" suffixOverrides=",">
|
<if test="addTime != null ">add_time = #{addTime},</if>
|
<if test="cardAnnex != null and cardAnnex != ''">card_annex = #{cardAnnex},</if>
|
<if test="cardBackAnnex != null and cardBackAnnex != ''">card_back_annex = #{cardBackAnnex},</if>
|
<if test="city != null and city != ''">city = #{city},</if>
|
<if test="code != null and code != ''">code = #{code},</if>
|
<if test="creditAnnex != null and creditAnnex != ''">credit_annex = #{creditAnnex},</if>
|
<if test="creditCode != null and creditCode != ''">credit_code = #{creditCode},</if>
|
<if test="district != null and district != ''">district = #{district},</if>
|
<if test="fullName != null and fullName != ''">full_name = #{fullName},</if>
|
<if test="idCard != null and idCard != ''">id_card = #{idCard},</if>
|
<if test="legalPerson != null and legalPerson != ''">legal_person = #{legalPerson},</if>
|
<if test="legalPersonPhone != null and legalPersonPhone != ''">legal_person_phone = #{legalPersonPhone},</if>
|
<if test="powerOfAttorneyAnnex != null and powerOfAttorneyAnnex != ''">power_of_attorney_annex = #{powerOfAttorneyAnnex},</if>
|
<if test="province != null and province != ''">province = #{province},</if>
|
<if test="regAddress != null and regAddress != ''">reg_address = #{regAddress},</if>
|
<if test="secretKey != null and secretKey != ''">secret_key = #{secretKey},</if>
|
<if test="nature != null and nature != ''">nature = #{nature},</if>
|
<if test="position != null and position != ''">position = #{position},</if>
|
<if test="certificationsCode != null and certificationsCode != ''">certifications_code = #{certificationsCode},</if>
|
<if test="certificationsAnnex != null and certificationsAnnex != ''">certifications_annex = #{certificationsAnnex},</if>
|
<if test="description != null and description != ''">description = #{description},</if>
|
<if test="certificationsCode2 != null and certificationsCode2 != ''">certifications_code2 = #{certificationsCode2},</if>
|
<if test="certificationsAnnex2 != null and certificationsAnnex2 != ''">certifications_annex2 = #{certificationsAnnex2},</if>
|
<if test="userName != null and userName != ''">user_name = #{userName},</if>
|
<if test="userPhone != null and userPhone != ''">user_phone = #{userPhone},</if>
|
<if test="category != null and category != ''">category = #{category},</if>
|
<if test="status != null and status != ''">status = #{status},</if>
|
</trim>
|
where ids = #{ids}
|
</update>
|
|
<delete id="deleteCompanyById" parameterType="String">
|
delete from js_company where ids = #{ids}
|
</delete>
|
|
<delete id="deleteCompanyByIds" parameterType="String">
|
delete from js_company where ids in
|
<foreach item="ids" collection="array" open="(" separator="," close=")">
|
#{ids}
|
</foreach>
|
</delete>
|
|
</mapper>
|