report-config-mapper.xml
2.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?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">
<!-- 报表查询配置 @author 仝玉甫 -->
<mapper namespace="com.cjs.cms.dao.report.ReportConfigDao">
<sql id="report_config_field">
id, name, menu_id, parent_menu_id, parent_menu_title, db_type, report_sql, remark
</sql>
<sql id="search_condition">
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%') </if>
</sql>
<resultMap type="ReportConfigInfo" id="ReportConfigMap" autoMapping="true">
<id column="id" property="id" />
<collection property="terms" column="id" javaType="ArrayList" autoMapping="true"
ofType="ReportTermInfo" select="com.cjs.cms.dao.report.ReportTermDao.queryByConfigId" />
<collection property="fields" column="id" javaType="ArrayList" autoMapping="true"
ofType="ReportFieldInfo" select="com.cjs.cms.dao.report.ReportFieldDao.queryByConfigId" />
</resultMap>
<select id="search" parameterType="map" resultType="ReportConfigInfo">
select <include refid="report_config_field"/>
from report_config
where 1 = 1
<include refid="search_condition"/>
<include refid="common.pageLimit" />
</select>
<select id="searchTotal" parameterType="map" resultType="int">
select count(*)
from report_config
where 1 = 1
<include refid="search_condition"/>
</select>
<select id="queryById" parameterType="int" resultMap="ReportConfigMap">
select <include refid="report_config_field"/>
from report_config
where id = #{value}
</select>
<select id="queryByName" parameterType="string" resultMap="ReportConfigMap">
select <include refid="report_config_field"/>
from report_config
where name = #{value}
</select>
<insert id="save" parameterType="ReportConfigInfo" keyColumn="id" keyProperty="id" useGeneratedKeys="true">
insert into report_config(name, menu_id, parent_menu_id, parent_menu_title, db_type, report_sql, remark)
values (#{name}, #{menuId}, #{parentMenuId}, #{parentMenuTitle}, #{dbType}, #{reportSql}, #{remark})
</insert>
<update id="update" parameterType="ReportConfigInfo">
update report_config set name = #{name}, menu_id = #{menuId}, parent_menu_id = #{parentMenuId},
parent_menu_title = #{parentMenuTitle}, db_type = #{dbType}, report_sql = #{reportSql}, remark = #{remark}
where id = #{id}
</update>
<delete id="delete" parameterType="int">
delete from report_config where id = #{id}
</delete>
</mapper>