java-mall/mall-im/target/classes/mapper/im/LayGroupMapper.xml
2024-10-26 10:01:40 +08:00

118 lines
2.5 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="com.suisung.mall.im.mapper.LayGroupMapper">
<sql id="layGroupColumns">
a.id,
a.groupname,
a.avatar,
a.create_by,
a.create_date,
a.update_by,
a.update_date,
a.remarks,
a.del_flag
</sql>
<sql id="layGroupJoins"></sql>
<select id="get" resultType="com.suisung.mall.im.pojo.entity.LayGroup" >
SELECT
<include refid="layGroupColumns"/>
FROM t_group a
WHERE a.id = #{id}
</select>
<select id="findList" resultType="com.suisung.mall.im.pojo.entity.LayGroup" >
SELECT
<include refid="layGroupColumns"/>
FROM t_group a
<where>
a.del_flag = #{DEL_FLAG_NORMAL}
<if test="create_by != null and create_by != ''">
AND a.create_by = #{create_by}
</if>
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
<otherwise>
ORDER BY a.update_date DESC
</otherwise>
</choose>
</select>
<select id="findAllList" resultType="com.suisung.mall.im.pojo.entity.LayGroup" >
SELECT
<include refid="layGroupColumns"/>
FROM t_group a
<where>
a.del_flag = #{DEL_FLAG_NORMAL}
</where>
<choose>
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
ORDER BY ${page.orderBy}
</when>
<otherwise>
ORDER BY a.update_date DESC
</otherwise>
</choose>
</select>
<insert id="saveNew">
INSERT INTO t_group(
id,
groupname,
avatar,
create_by,
create_date,
update_by,
update_date,
remarks,
del_flag
) VALUES (
#{id},
#{groupname},
#{avatar},
#{create_by},
now(),
#{update_by},
now(),
#{remarks},
#{del_flag}
)
</insert>
<update id="update">
UPDATE t_group SET
groupname = #{groupname},
avatar = #{avatar},
update_by = #{update_by},
update_date = now(),
remarks = #{remarks}
WHERE id = #{id}
</update>
<!--物理删除-->
<update id="delete">
DELETE FROM t_group
WHERE id = #{id}
</update>
<!--逻辑删除-->
<update id="deleteByLogic">
UPDATE t_group SET
del_flag = #{DEL_FLAG_DELETE}
WHERE id = #{id}
</update>
<!-- 根据实体名称和字段名称和字段值获取唯一记录 -->
<select id="findUniqueByProperty" resultType="com.suisung.mall.im.pojo.entity.LayGroup" statementType="STATEMENT">
select * FROM t_group where ${propertyName} = '${value}'
</select>
</mapper>