tenlion-module/module-institution-management/src/main/resources/mybatis/mapper/institution/institution-mapper.xml
2021-05-01 15:19:34 +08:00

477 lines
18 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="cn.com.tenlion.institutionmanagement.dao.institution.IInstitutionDao">
<resultMap id="institutionDTO" type="cn.com.tenlion.institutionmanagement.pojo.dtos.institution.InstitutionDTO">
<result column="institution_id" property="institutionId"/>
<result column="institution_name" property="institutionName"/>
<result column="institution_desc" property="institutionDesc"/>
<result column="institution_image" property="institutionImage"/>
<result column="institution_address" property="institutionAddress"/>
<result column="institution_x" property="institutionX"/>
<result column="institution_y" property="institutionY"/>
<result column="institution_founding_time" property="institutionFoundingTime"/>
<result column="institution_principal" property="institutionPrincipal"/>
<result column="institution_contact" property="institutionContact"/>
<result column="institution_region_province" property="institutionRegionProvince"/>
<result column="institution_region_city" property="institutionRegionCity"/>
<result column="institution_region_area" property="institutionRegionArea"/>
<result column="institution_region_village" property="institutionRegionVillage"/>
<result column="institution_region_street" property="institutionRegionStreet"/>
<result column="institution_type" property="institutionType"/>
<result column="creator" property="creator"/>
<result column="gmt_create" property="gmtCreate"/>
</resultMap>
<resultMap id="institutionBO" type="cn.com.tenlion.institutionmanagement.pojo.bos.institution.InstitutionBO">
<result column="institution_id" property="institutionId"/>
<result column="institution_name" property="institutionName"/>
<result column="institution_desc" property="institutionDesc"/>
<result column="institution_image" property="institutionImage"/>
<result column="institution_address" property="institutionAddress"/>
<result column="institution_x" property="institutionX"/>
<result column="institution_y" property="institutionY"/>
<result column="institution_founding_time" property="institutionFoundingTime"/>
<result column="institution_principal" property="institutionPrincipal"/>
<result column="institution_contact" property="institutionContact"/>
<result column="institution_region_province" property="institutionRegionProvince"/>
<result column="institution_region_city" property="institutionRegionCity"/>
<result column="institution_region_area" property="institutionRegionArea"/>
<result column="institution_region_village" property="institutionRegionVillage"/>
<result column="institution_region_street" property="institutionRegionStreet"/>
<result column="institution_type" property="institutionType"/>
<result column="creator" property="creator"/>
<result column="gmt_create" property="gmtCreate"/>
<result column="modifier" property="modifier"/>
<result column="gmt_modified" property="gmtModified"/>
<result column="is_delete" property="isDelete"/>
</resultMap>
<resultMap id="institutionPO" type="cn.com.tenlion.institutionmanagement.pojo.pos.institution.InstitutionPO">
<result column="institution_id" property="institutionId"/>
<result column="institution_name" property="institutionName"/>
<result column="institution_desc" property="institutionDesc"/>
<result column="institution_image" property="institutionImage"/>
<result column="institution_address" property="institutionAddress"/>
<result column="institution_x" property="institutionX"/>
<result column="institution_y" property="institutionY"/>
<result column="institution_founding_time" property="institutionFoundingTime"/>
<result column="institution_principal" property="institutionPrincipal"/>
<result column="institution_contact" property="institutionContact"/>
<result column="institution_region_province" property="institutionRegionProvince"/>
<result column="institution_region_city" property="institutionRegionCity"/>
<result column="institution_region_area" property="institutionRegionArea"/>
<result column="institution_region_village" property="institutionRegionVillage"/>
<result column="institution_region_street" property="institutionRegionStreet"/>
<result column="institution_type" property="institutionType"/>
<result column="creator" property="creator"/>
<result column="gmt_create" property="gmtCreate"/>
<result column="modifier" property="modifier"/>
<result column="gmt_modified" property="gmtModified"/>
<result column="is_delete" property="isDelete"/>
</resultMap>
<!-- 新增机构管理 -->
<insert id="save" parameterType="map">
INSERT INTO m_institution(
institution_id,
institution_name,
institution_desc,
institution_image,
institution_address,
institution_x,
institution_y,
institution_founding_time,
institution_principal,
institution_contact,
institution_region_province,
institution_region_city,
institution_region_area,
institution_region_village,
institution_region_street,
institution_type,
creator,
gmt_create,
modifier,
gmt_modified,
is_delete
) VALUES(
#{institutionId},
#{institutionName},
#{institutionDesc},
#{institutionImage},
#{institutionAddress},
#{institutionX},
#{institutionY},
#{institutionFoundingTime},
#{institutionPrincipal},
#{institutionContact},
#{institutionRegionProvince},
#{institutionRegionCity},
#{institutionRegionArea},
#{institutionRegionVillage},
#{institutionRegionStreet},
#{institutionType}
#{creator},
#{gmtCreate},
#{modifier},
#{gmtModified},
#{isDelete}
)
</insert>
<!-- 删除机构管理 -->
<update id="remove" parameterType="map">
UPDATE
m_institution
SET
gmt_modified = #{gmtModified},
modifier = #{modifier},
is_delete = 1
WHERE
institution_id IN
<foreach collection="institutionIds" index="index" open="(" separator="," close=")">
#{institutionIds[${index}]}
</foreach>
</update>
<!-- 删除机构管理(物理) -->
<update id="delete" parameterType="map">
DELETE FROM
m_institution
WHERE
institution_id IN
<foreach collection="institutionIds" index="index" open="(" separator="," close=")">
#{institutionIds[${index}]}
</foreach>
</update>
<!-- 修改机构管理 -->
<update id="update" parameterType="map">
UPDATE
m_institution
SET
<if test="institutionName != null and institutionName != ''">
institution_name = #{institutionName},
</if>
<if test="institutionDesc != null and institutionDesc != ''">
institution_desc = #{institutionDesc},
</if>
<if test="institutionImage != null and institutionImage != ''">
institution_image = #{institutionImage},
</if>
<if test="institutionAddress != null and institutionAddress != ''">
institution_address = #{institutionAddress},
</if>
<if test="institutionX != null and institutionX != ''">
institution_x = #{institutionX},
</if>
<if test="institutionY != null and institutionY != ''">
institution_y = #{institutionY},
</if>
<if test="institutionFoundingTime != null and institutionFoundingTime != ''">
institution_founding_time = #{institutionFoundingTime},
</if>
<if test="institutionPrincipal != null and institutionPrincipal != ''">
institution_principal = #{institutionPrincipal},
</if>
<if test="institutionContact != null and institutionContact != ''">
institution_contact = #{institutionContact},
</if>
<if test="institutionRegionProvince != null and institutionRegionProvince != ''">
institution_region_province = #{institutionRegionProvince},
</if>
<if test="institutionRegionCity != null and institutionRegionCity != ''">
institution_region_city = #{institutionRegionCity},
</if>
<if test="institutionRegionArea != null and institutionRegionArea != ''">
institution_region_area = #{institutionRegionArea},
</if>
<if test="institutionRegionVillage != null and institutionRegionVillage != ''">
institution_region_village = #{institutionRegionVillage},
</if>
<if test="institutionRegionStreet != null and institutionRegionStreet != ''">
institution_region_street = #{institutionRegionStreet},
</if>
<if test="institutionType != null and institutionType != ''">
institution_type = #{institutionType},
</if>
gmt_modified = #{gmtModified},
modifier = #{modifier},
institution_id = institution_id
WHERE
institution_id = #{institutionId}
</update>
<!-- 机构管理详情 -->
<select id="get" parameterType="map" resultMap="institutionDTO">
SELECT
t1.institution_name,
t1.institution_desc,
t1.institution_image,
t1.institution_address,
t1.institution_x,
t1.institution_y,
t1.institution_founding_time,
t1.institution_principal,
t1.institution_contact,
t1.institution_region_province,
t1.institution_region_city,
t1.institution_region_area,
t1.institution_region_village,
t1.institution_region_street,
t1.institution_type,
t1.institution_id
FROM
m_institution t1
WHERE
t1.is_delete = 0
<if test="institutionId != null and institutionId != ''">
AND
t1.institution_id = #{institutionId}
</if>
</select>
<!-- 机构管理详情 -->
<select id="getBO" parameterType="map" resultMap="institutionBO">
SELECT
t1.institution_id,
t1.institution_name,
t1.institution_desc,
t1.institution_image,
t1.institution_address,
t1.institution_x,
t1.institution_y,
t1.institution_founding_time,
t1.institution_principal,
t1.institution_contact,
t1.institution_region_province,
t1.institution_region_city,
t1.institution_region_area,
t1.institution_region_village,
t1.institution_region_street,
t1.institution_type,
t1.creator,
t1.gmt_create,
t1.modifier,
t1.gmt_modified,
t1.is_delete
FROM
m_institution t1
WHERE
t1.is_delete = 0
<if test="institutionId != null and institutionId != ''">
AND
t1.institution_id = #{institutionId}
</if>
</select>
<!-- 机构管理详情 -->
<select id="getPO" parameterType="map" resultMap="institutionPO">
SELECT
t1.institution_id,
t1.institution_name,
t1.institution_desc,
t1.institution_image,
t1.institution_address,
t1.institution_x,
t1.institution_y,
t1.institution_founding_time,
t1.institution_principal,
t1.institution_contact,
t1.institution_region_province,
t1.institution_region_city,
t1.institution_region_area,
t1.institution_region_village,
t1.institution_region_street,
t1.institution_type,
t1.creator,
t1.gmt_create,
t1.modifier,
t1.gmt_modified,
t1.is_delete
FROM
m_institution t1
WHERE
t1.is_delete = 0
<if test="institutionId != null and institutionId != ''">
AND
t1.institution_id = #{institutionId}
</if>
</select>
<!-- 机构管理列表 -->
<select id="list" parameterType="map" resultMap="institutionDTO">
SELECT
t1.institution_id,
t1.institution_name,
t1.institution_desc,
t1.institution_image,
t1.institution_address,
t1.institution_x,
t1.institution_y,
t1.institution_founding_time,
t1.institution_principal,
t1.institution_contact,
t1.institution_region_province,
t1.institution_region_city,
t1.institution_region_area,
t1.institution_region_village,
t1.institution_region_street,
t1.institution_type,
t1.creator,
t1.gmt_create
FROM
m_institution t1
WHERE
t1.is_delete = 0
<if test="keywords != null and keywords != ''">
AND (
<!-- 这里添加其他条件 -->
t1.institution_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="institutionIds != null and institutionIds.size > 0">
AND
t1.institution_id IN
<foreach collection="institutionIds" index="index" open="(" separator="," close=")">
#{institutionIds[${index}]}
</foreach>
</if>
<if test="institutionType != null and institutionType != ''">
AND
t1.institution_type = #{institutionType}
</if>
ORDER BY t1.gmt_create DESC
</select>
<!-- 机构管理列表 -->
<select id="listBO" parameterType="map" resultMap="institutionBO">
SELECT
t1.institution_id,
t1.institution_name,
t1.institution_desc,
t1.institution_image,
t1.institution_address,
t1.institution_x,
t1.institution_y,
t1.institution_founding_time,
t1.institution_principal,
t1.institution_contact,
t1.institution_region_province,
t1.institution_region_city,
t1.institution_region_area,
t1.institution_region_village,
t1.institution_region_street,
t1.institution_type,
t1.creator,
t1.gmt_create,
t1.modifier,
t1.gmt_modified,
t1.is_delete
FROM
m_institution t1
WHERE
t1.is_delete = 0
<if test="keywords != null and keywords != ''">
AND (
<!-- 这里添加其他条件 -->
t1.institution_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="institutionIds != null and institutionIds.size > 0">
AND
t1.institution_id IN
<foreach collection="institutionIds" index="index" open="(" separator="," close=")">
#{institutionIds[${index}]}
</foreach>
</if>
<if test="institutionType != null and institutionType != ''">
AND
t1.institution_type = #{institutionType}
</if>
ORDER BY t1.gmt_create DESC
</select>
<!-- 机构管理列表 -->
<select id="listPO" parameterType="map" resultMap="institutionPO">
SELECT
t1.institution_id,
t1.institution_name,
t1.institution_desc,
t1.institution_image,
t1.institution_address,
t1.institution_x,
t1.institution_y,
t1.institution_founding_time,
t1.institution_principal,
t1.institution_contact,
t1.institution_region_province,
t1.institution_region_city,
t1.institution_region_area,
t1.institution_region_village,
t1.institution_region_street,
t1.creator,
t1.gmt_create,
t1.modifier,
t1.gmt_modified,
t1.is_delete
FROM
m_institution t1
WHERE
t1.is_delete = 0
<if test="keywords != null and keywords != ''">
AND (
<!-- 这里添加其他条件 -->
t1.institution_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="institutionIds != null and institutionIds.size > 0">
AND
t1.institution_id IN
<foreach collection="institutionIds" index="index" open="(" separator="," close=")">
#{institutionIds[${index}]}
</foreach>
</if>
<if test="institutionType != null and institutionType != ''">
AND
t1.institution_type = #{institutionType}
</if>
ORDER BY t1.gmt_create DESC
</select>
<!-- 机构管理统计 -->
<select id="count" parameterType="map" resultType="Integer">
SELECT
COUNT(*)
FROM
m_institution t1
WHERE
t1.is_delete = 0
</select>
</mapper>