173 lines
4.3 KiB
XML
173 lines
4.3 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.hx.slj.modules.sys.dao.SysTemplateMagDao">
|
|
|
|
<sql id="sysTemplateMagColumns">
|
|
a.id AS "id",
|
|
a.create_by AS "createBy.id",
|
|
a.create_date AS "createDate",
|
|
a.update_by AS "updateBy.id",
|
|
a.update_date AS "updateDate",
|
|
a.remarks AS "remarks",
|
|
a.del_flag AS "delFlag",
|
|
a.template_cd AS "templateCd",
|
|
a.template_nm AS "templateNm",
|
|
a.template_type AS "templateType",
|
|
a.template_path AS "templatePath",
|
|
a.template_ext AS "templateExt",
|
|
a.template_treenode AS "treeNode",
|
|
a.other_id AS "otherId"
|
|
</sql>
|
|
|
|
<sql id="sysTemplateMagJoins">
|
|
</sql>
|
|
|
|
|
|
<select id="get" resultType="SysTemplateMag" >
|
|
SELECT
|
|
<include refid="sysTemplateMagColumns"/>,
|
|
o.name AS "office",
|
|
u.name AS "name",
|
|
u.phone AS "phone"
|
|
FROM
|
|
sys_template_mag a
|
|
inner join sys_user u on a.update_by=u.id
|
|
inner join sys_office o on u.office_id=o.id
|
|
<include refid="sysTemplateMagJoins"/>
|
|
WHERE a.id = #{id}
|
|
</select>
|
|
|
|
<select id="findList" resultType="SysTemplateMag" >
|
|
SELECT
|
|
<include refid="sysTemplateMagColumns"/>,
|
|
o.name AS "office",
|
|
u.name AS "name"
|
|
FROM
|
|
sys_template_mag a
|
|
inner join sys_user u on a.update_by=u.id
|
|
inner join sys_office o on u.office_id=o.id
|
|
<include refid="sysTemplateMagJoins"/>
|
|
<where>
|
|
a.del_flag = #{DEL_FLAG_NORMAL}
|
|
<if test="upDtFrom != null and upDtFrom != '' and upDtTo != null and upDtTo != ''">
|
|
AND a.update_date between #{upDtFrom} and #{upDtTo}
|
|
</if>
|
|
<if test="templateNm != null and templateNm != ''">
|
|
AND a.template_nm LIKE
|
|
<if test="dbName == 'oracle'">'%'||#{templateNm}||'%'</if>
|
|
<if test="dbName == 'mssql'">'%'+#{templateNm}+'%'</if>
|
|
<if test="dbName == 'mysql'">concat('%',#{templateNm},'%')</if>
|
|
</if>
|
|
<if test="templateType != null and templateType != ''">
|
|
AND a.template_type = #{templateType}
|
|
</if>
|
|
<if test="treeNode !=null and treeNode !='' ">
|
|
AND a.template_treenode=#{treeNode}
|
|
</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="SysTemplateMag" >
|
|
SELECT
|
|
<include refid="sysTemplateMagColumns"/>,
|
|
o.name AS "office",
|
|
u.name AS "name"
|
|
FROM
|
|
sys_template_mag a
|
|
sys_user u
|
|
sys_office o
|
|
WHERE
|
|
a.update_by = u.id
|
|
AND
|
|
u.office_id = o.id
|
|
AND
|
|
a.del_flag = #{DEL_FLAG_NORMAL}
|
|
<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_template_mag(
|
|
id,
|
|
create_by,
|
|
create_date,
|
|
update_by,
|
|
update_date,
|
|
remarks,
|
|
del_flag,
|
|
template_cd,
|
|
template_nm,
|
|
template_type,
|
|
template_path,
|
|
template_ext,
|
|
template_treenode,
|
|
other_id
|
|
)
|
|
values(
|
|
#{id},
|
|
#{createBy.id},
|
|
#{createDate},
|
|
#{updateBy.id},
|
|
#{updateDate},
|
|
#{remarks},
|
|
#{delFlag},
|
|
#{templateCd},
|
|
#{templateNm},
|
|
#{templateType},
|
|
#{templatePath},
|
|
#{templateExt},
|
|
#{treeNode},
|
|
#{otherId}
|
|
)
|
|
</insert>
|
|
|
|
<update id="update">
|
|
UPDATE sys_template_mag SET
|
|
update_by = #{updateBy.id},
|
|
update_date = #{updateDate},
|
|
remarks = #{remarks},
|
|
template_cd = #{templateCd},
|
|
template_nm = #{templateNm},
|
|
template_type = #{templateType},
|
|
template_path = #{templatePath},
|
|
template_ext = #{templateExt},
|
|
template_treenode=#{treeNode},
|
|
other_id = #{otherId}
|
|
WHERE id = #{id}
|
|
</update>
|
|
|
|
|
|
<!--物理删除-->
|
|
<update id="delete">
|
|
DELETE FROM sys_template_mag
|
|
WHERE id = #{id}
|
|
</update>
|
|
|
|
<!--逻辑删除-->
|
|
<update id="deleteByLogic">
|
|
UPDATE sys_template_mag SET
|
|
del_flag = #{DEL_FLAG_DELETE}
|
|
WHERE id = #{id}
|
|
</update>
|
|
|
|
|
|
<!-- 根据实体名称和字段名称和字段值获取唯一记录 -->
|
|
<select id="findUniqueByProperty" resultType="SysTemplateMag" statementType="STATEMENT">
|
|
select * FROM sys_template_mag where ${propertyName} = '${value}'
|
|
</select>
|
|
|
|
</mapper> |