<?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.panzhihua.service_community.dao.ComActDynTypeMapper">
|
|
<!-- 通用查询映射结果 -->
|
<resultMap id="BaseResultMap" type="com.panzhihua.service_community.model.dos.ComActDynTypeDO">
|
<id column="id" property="id" />
|
<result column="name" property="name" />
|
<result column="color" property="color" />
|
<result column="is_del" property="isDel" />
|
<result column="community_id" property="communityId" />
|
<result column="create_at" property="createAt" />
|
<result column="create_by" property="createBy" />
|
<result column="update_at" property="updateAt" />
|
<result column="update_by" property="updateBy" />
|
<result column="category" property="category" />
|
<result column="area" property="area" />
|
</resultMap>
|
|
<!-- 通用查询结果列 -->
|
<sql id="Base_Column_List">
|
id, name, color, is_del, community_id, create_at, create_by, update_at, update_by
|
</sql>
|
|
<select id="pageDynTypeByAdmin" parameterType="com.panzhihua.common.model.dtos.community.PageComActDynTypeDTO"
|
resultType="com.panzhihua.common.model.vos.community.ComActDynTypeVO">
|
SELECT
|
cadt.id,
|
cadt.`name`,
|
cadt.color,
|
cadt.community_id,
|
cadt.create_at,
|
cadt.update_at,
|
su.`name` AS createBy,
|
su1.`name` AS updateBy,
|
cadt.category
|
FROM
|
com_act_dyn_type AS cadt
|
LEFT JOIN sys_user AS su ON su.user_id = cadt.create_by
|
LEFT JOIN sys_user AS su1 ON su1.user_id = cadt.update_by
|
where cadt.community_id = 0 and cadt.is_del = 2
|
<if test="comActDynTypeDTO.area == '2'">
|
AND cadt.area in (1,2)
|
</if>
|
<if test="comActDynTypeDTO.area == null or comActDynTypeDTO.area == '1' ">
|
AND cadt.area in (1)
|
</if>
|
<if test="comActDynTypeDTO.category != null">
|
AND cadt.category = #{comActDynTypeDTO.category}
|
</if>
|
<if test="comActDynTypeDTO.keyWord != null and comActDynTypeDTO.keyWord != """>
|
and (cadt.id = #{comActDynTypeDTO.keyWord} or cadt.`name` like concat (#{comActDynTypeDTO.keyWord},'%'))
|
</if>
|
union all
|
|
SELECT
|
cadt.id,
|
cadt.`name`,
|
cadt.color,
|
cadt.community_id,
|
cadt.create_at,
|
cadt.update_at,
|
su.`name` AS createBy,
|
su1.`name` AS updateBy,
|
cadt.category
|
FROM
|
com_act_dyn_type AS cadt
|
LEFT JOIN sys_user AS su ON su.user_id = cadt.create_by
|
LEFT JOIN sys_user AS su1 ON su1.user_id = cadt.update_by
|
where cadt.is_del = 2
|
<if test="comActDynTypeDTO.area == '2'">
|
AND cadt.area in (1,2)
|
</if>
|
<if test="comActDynTypeDTO.area == null or comActDynTypeDTO.area == '1' ">
|
AND cadt.area in (1)
|
</if>
|
<if test='comActDynTypeDTO.category != null '>
|
AND cadt.category = #{comActDynTypeDTO.category}
|
</if>
|
<if test="comActDynTypeDTO.communityId != null">
|
<if test="comActDynTypeDTO.communityId == 0">
|
AND 1=2
|
</if>
|
and cadt.community_id = ${comActDynTypeDTO.communityId}
|
</if>
|
<if test="comActDynTypeDTO.keyWord != null and comActDynTypeDTO.keyWord != """>
|
and (cadt.id = #{comActDynTypeDTO.keyWord} or cadt.`name` like concat (#{comActDynTypeDTO.keyWord},'%'))
|
</if>
|
order by create_at desc
|
</select>
|
|
<select id="getDynTypeListByAdmin" parameterType="com.panzhihua.common.model.dtos.community.PageComActDynTypeDTO"
|
resultType="com.panzhihua.common.model.vos.community.ComActDynTypeVO">
|
SELECT
|
cadt.id,
|
cadt.`name`,
|
cadt.color,
|
cadt.community_id,
|
cadt.create_at,
|
cadt.update_at,
|
su.`name` AS createBy,
|
su1.`name` AS updateBy
|
FROM
|
com_act_dyn_type AS cadt
|
LEFT JOIN sys_user AS su ON su.user_id = cadt.create_by
|
LEFT JOIN sys_user AS su1 ON su1.user_id = cadt.update_by
|
where cadt.community_id = 0 and cadt.is_del = 2
|
<if test="comActDynTypeDTO.area == '2'">
|
AND cadt.area in (1,2)
|
</if>
|
<if test="comActDynTypeDTO.area == null or comActDynTypeDTO.area == '1' ">
|
AND cadt.area in (1)
|
</if>
|
<if test="comActDynTypeDTO.category != null">
|
AND cadt.category = #{comActDynTypeDTO.category}
|
</if>
|
<if test="comActDynTypeDTO.keyWord != null and comActDynTypeDTO.keyWord != """>
|
and (cadt.id = #{comActDynTypeDTO.keyWord} or cadt.`name` like concat (#{comActDynTypeDTO.keyWord},'%'))
|
</if>
|
union all
|
|
SELECT
|
cadt.id,
|
cadt.`name`,
|
cadt.color,
|
cadt.community_id,
|
cadt.create_at,
|
cadt.update_at,
|
su.`name` AS createBy,
|
su1.`name` AS updateBy
|
FROM
|
com_act_dyn_type AS cadt
|
LEFT JOIN sys_user AS su ON su.user_id = cadt.create_by
|
LEFT JOIN sys_user AS su1 ON su1.user_id = cadt.update_by
|
where cadt.is_del = 2
|
<if test="comActDynTypeDTO.area == '2'">
|
AND cadt.area in (1,2)
|
</if>
|
<if test="comActDynTypeDTO.area == null or comActDynTypeDTO.area == '1' ">
|
AND cadt.area in (1)
|
</if>
|
<if test='comActDynTypeDTO.category != null '>
|
AND cadt.category = #{comActDynTypeDTO.category}
|
</if>
|
<if test="comActDynTypeDTO.communityId != null and comActDynTypeDTO.communityId != 0 ">
|
AND cadt.community_id = ${comActDynTypeDTO.communityId}
|
</if>
|
<if test="comActDynTypeDTO.keyWord != null and comActDynTypeDTO.keyWord != """>
|
and (cadt.id = #{comActDynTypeDTO.keyWord} or cadt.`name` like concat (#{comActDynTypeDTO.keyWord},'%'))
|
</if>
|
</select>
|
|
<select id="getDynCountByDynTypeIds" parameterType="List" resultType="Integer">
|
select count(id) from com_act_dyn where `type` in
|
<foreach collection='ids' item='id' index='index' open='(' close=')' separator=',' >
|
#{id}
|
</foreach>
|
</select>
|
|
<update id="deleteDynTypeByIds" parameterType="List">
|
update com_act_dyn_type set is_del = 1 where id in
|
<foreach collection='ids' item='id' index='index' open='(' close=')' separator=',' >
|
#{id}
|
</foreach>
|
</update>
|
|
</mapper>
|