bkjxxxw/build/classes/mappings/ccqnsoft/sys/userconfig/SysUserConfigDao.xml

142 lines
3.2 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.jeeplus.ccqnsoft.sys.userconfig.dao.SysUserConfigDao">
<sql id="sysUserConfigColumns">
a.id AS "id",
a.user_id AS "user.id",
a.type_config AS "typeConfig",
a.value_config AS "valueConfig",
a.create_by AS "createBy.id",
a.create_date AS "createDate",
a.update_id AS "updateId",
a.update_date AS "updateDate",
a.flag AS "flag",
a.flag1 AS "flag1",
a.flag2 AS "flag2",
u.name AS "user.name"
</sql>
<sql id="sysUserConfigJoins">
LEFT JOIN sys_user u ON u.id = a.user_id
</sql>
<select id="get" resultType="SysUserConfig" >
SELECT
<include refid="sysUserConfigColumns"/>
FROM sys_user_config a
<include refid="sysUserConfigJoins"/>
WHERE a.id = #{id}
</select>
<select id="getByUserId" resultType="SysUserConfig" >
SELECT
<include refid="sysUserConfigColumns"/>
FROM sys_user_config a
<include refid="sysUserConfigJoins"/>
WHERE a.user_id = #{user.id}
AND a.type_config = #{typeConfig}
</select>
<select id="findList" resultType="SysUserConfig" >
SELECT
<include refid="sysUserConfigColumns"/>
FROM sys_user_config a
<include refid="sysUserConfigJoins"/>
<where>
<if test="valueConfig != null and valueConfig != ''">
AND a.value_config = #{valueConfig}
</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="SysUserConfig" >
SELECT
<include refid="sysUserConfigColumns"/>
FROM sys_user_config a
<include refid="sysUserConfigJoins"/>
<where>
</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="insert">
INSERT INTO sys_user_config(
id,
user_id,
type_config,
value_config,
create_by,
create_date,
update_id,
update_date,
flag,
flag1,
flag2
) VALUES (
SQL_HW_MAIN.nextval,
#{user.id},
#{typeConfig},
#{valueConfig},
#{createBy.id},
#{createDate},
#{updateId},
#{updateDate},
#{flag},
#{flag1},
#{flag2}
)
</insert>
<update id="update">
UPDATE sys_user_config SET
user_id = #{user.id},
type_config = #{typeConfig},
value_config = #{valueConfig},
update_id = #{updateId},
update_date = #{updateDate},
flag = #{flag},
flag1 = #{flag1},
flag2 = #{flag2}
WHERE id = #{id}
</update>
<!--物理删除-->
<update id="delete">
DELETE FROM sys_user_config
WHERE id = #{id}
</update>
<!--逻辑删除-->
<update id="deleteByLogic">
UPDATE sys_user_config SET
del_flag = #{DEL_FLAG_DELETE}
WHERE id = #{id}
</update>
<!-- 根据实体名称和字段名称和字段值获取唯一记录 -->
<select id="findUniqueByProperty" resultType="SysUserConfig" statementType="STATEMENT">
select * FROM sys_user_config where ${propertyName} = '${value}'
</select>
</mapper>