| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- <?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.yonge.cooleshow.biz.dal.dao.ImGroupDao">
- <resultMap id="BaseResultMap" type="com.yonge.cooleshow.biz.dal.entity.ImGroup">
- <id column="id_" jdbcType="INTEGER" property="id"/>
- <result column="name_" jdbcType="VARCHAR" property="name"/>
- <result column="introduce_" jdbcType="VARCHAR" property="introduce"/>
- <result column="member_num_" jdbcType="INTEGER" property="memberNum"/>
- <result column="memo_" jdbcType="VARCHAR" property="memo"/>
- <result column="img_" jdbcType="VARCHAR" property="img"/>
- <result column="type_" jdbcType="VARCHAR" property="type" typeHandler="com.yonge.cooleshow.common.dal.CustomEnumTypeHandler"/>
- <result column="create_by_" property="createBy"/>
- <result column="auto_pass_flag_" property="autoPassFlag"/>
- <result column="create_time_" jdbcType="TIMESTAMP" property="createTime"/>
- <result column="update_time_" jdbcType="TIMESTAMP" property="updateTime"/>
- </resultMap>
- <sql id="Base_Column_List">
- id_, name_, introduce_, member_num_, memo_, img_, type_,create_by_, create_time_, update_time_
- </sql>
- <update id="updateById" parameterType="com.yonge.cooleshow.biz.dal.entity.ImGroup">
- update im_group
- <set>
- <if test="et.name != null">
- name_ = #{et.name},
- </if>
- <if test="et.autoPassFlag != null">
- auto_pass_flag_ = #{et.autoPassFlag},
- </if>
- introduce_ = #{et.introduce},
- memo_ = #{et.memo},
- update_time_ = NOW()
- </set>
- where id_ = #{et.id}
- </update>
- <select id="getLock" resultMap="BaseResultMap">
- SELECT * FROM im_group WHERE id_ = #{groupId} LIMIT 1 FOR UPDATE
- </select>
- <select id="findAll" resultMap="BaseResultMap">
- SELECT ig.* FROM im_group ig
- LEFT JOIN im_group_member igm ON igm.group_id_ = ig.id_
- <where>
- <if test="userId != null">
- AND igm.user_id_ = #{userId}
- </if>
- <if test="search != null and search != ''">
- AND (ig.id_ = #{search} OR
- ig.name_ LIKE CONCAT('%',#{search},'%') OR ig.introduce_ LIKE CONCAT('%',#{search},'%'))
- </if>
- </where>
- ORDER BY id_ DESC
- </select>
- <insert id="insertBatch" keyColumn="id_" keyProperty="id" useGeneratedKeys="true"
- parameterType="com.yonge.cooleshow.biz.dal.entity.ImGroup">
- INSERT INTO im_group(name_, introduce_, member_num_, memo_, img_, type_,create_by_,auto_pass_flag_, create_time_, update_time_)
- VALUES
- <foreach collection="entities" item="entity" separator=",">
- (#{entity.name}, #{entity.introduce}, #{entity.memberNum}, #{entity.memo}, #{entity.img},
- #{entity.type,typeHandler=com.yonge.cooleshow.common.dal.CustomEnumTypeHandler},
- #{entity.createBy},#{entity.autoPassFlag}, NOW(), NOW())
- </foreach>
- </insert>
- </mapper>
|