|
@@ -20,16 +20,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
</sql>
|
|
|
|
|
|
<select id="selectBtpSchoolPvList" parameterType="BtpSchoolPv" resultMap="BtpSchoolPvResult">
|
|
|
- select group_concat(a.v_id) id, a.p_id, b.pv_name p_name, group_concat(c.pv_name) v_name, a.school_id, d.school_name, d.school_type
|
|
|
+ select
|
|
|
+ concat( a.school_id, '_', group_concat( a.v_id ) ) id,
|
|
|
+ a.p_id, b.pv_name p_name,
|
|
|
+ group_concat( c.pv_name ) v_name,
|
|
|
+ a.school_id, d.school_name, d.school_type
|
|
|
from btp_school_pv a
|
|
|
left join btp_policestation_village b on b.pv_id = a.p_id
|
|
|
left join btp_policestation_village c on c.pv_id = a.v_id
|
|
|
left join btp_school d on d.school_id = a.school_id
|
|
|
<where>
|
|
|
- <if test="pId != null "> and a.p_id = #{pId}</if>
|
|
|
- <if test="vId != null "> and a.v_id = #{vId}</if>
|
|
|
- <if test="schoolType != null "> and d.school_type = #{schoolType}</if>
|
|
|
-
|
|
|
<if test="pName != null "> and b.pv_name like concat('%', #{pName}, '%')</if>
|
|
|
<if test="vName != null "> and c.pv_name like concat('%', #{vName}, '%')</if>
|
|
|
<if test="schoolName != null "> and d.school_name like concat('%', #{schoolName}, '%')</if>
|
|
@@ -37,10 +37,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
group by a.p_id, a.school_id
|
|
|
</select>
|
|
|
|
|
|
- <select id="selectBtpSchoolPvInVIds" parameterType="Long" resultMap="BtpSchoolPvResult">
|
|
|
- select group_concat(v_id) id, p_id, school_id from btp_school_pv
|
|
|
- where v_id in
|
|
|
- <foreach item="item" index="index" collection="vIds.split(',')" open="(" separator="," close=")">
|
|
|
+ <select id="selectBtpSchoolPvBySchoolIdAndVId" parameterType="Long" resultMap="BtpSchoolPvResult">
|
|
|
+ select concat( school_id, '_', group_concat( v_id ) ) id, p_id, school_id from btp_school_pv
|
|
|
+ where school_id = #{schoolId} and v_id in
|
|
|
+ <foreach item="item" index="index" collection="vIds" open="(" separator="," close=")">
|
|
|
#{item}
|
|
|
</foreach>
|
|
|
</select>
|
|
@@ -68,9 +68,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
where p_id = #{pId}
|
|
|
</update>
|
|
|
|
|
|
- <delete id="deleteBtpSchoolPvByVIds" parameterType="String">
|
|
|
- delete from btp_school_pv where v_id in
|
|
|
- <foreach item="vId" collection="array" open="(" separator="," close=")">
|
|
|
+ <delete id="deleteBtpSchoolPvBySchoolIdAndVIds" parameterType="String">
|
|
|
+ delete from btp_school_pv where school_id = #{schoolId} and v_id in
|
|
|
+ <foreach item="vId" collection="vIds" open="(" separator="," close=")">
|
|
|
#{vId}
|
|
|
</foreach>
|
|
|
</delete>
|
|
@@ -83,4 +83,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
</foreach>
|
|
|
</select>
|
|
|
|
|
|
+ <select id="getSchoolName" parameterType="BtpSchoolPv" resultType="String">
|
|
|
+ select school_name from schooldistrict_view
|
|
|
+ <where>
|
|
|
+ <if test="schoolType != null "> and school_type = #{schoolType}</if>
|
|
|
+ <if test="pId != null "> and p_id = #{pId}</if>
|
|
|
+ <if test="vId != null "> and v_id = #{vId}</if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
</mapper>
|