OrganizationServiceTemplateGroupMapper.xml 11.7 KB
Newer Older
eddie.woo's avatar
eddie.woo committed
1 2 3 4 5 6 7 8
<?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="pwc.taxtech.atms.dao.OrganizationServiceTemplateGroupMapper">
  <resultMap id="BaseResultMap" type="pwc.taxtech.atms.entitiy.OrganizationServiceTemplateGroup">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
9 10 11 12
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="organization_id" jdbcType="VARCHAR" property="organizationId" />
    <result column="service_type_id" jdbcType="VARCHAR" property="serviceTypeId" />
    <result column="template_group_id" jdbcType="BIGINT" property="templateGroupId" />
eddie.woo's avatar
eddie.woo committed
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 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
  </resultMap>
  <sql id="Example_Where_Clause">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    <where>
      <foreach collection="oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Update_By_Example_Where_Clause">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    <where>
      <foreach collection="example.oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Base_Column_List">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
85
    id, organization_id, service_type_id, template_group_id
eddie.woo's avatar
eddie.woo committed
86 87 88 89 90 91 92 93 94 95 96
  </sql>
  <select id="selectByExample" parameterType="pwc.taxtech.atms.entitiy.OrganizationServiceTemplateGroupExample" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
97
    from organization_service_template_group
eddie.woo's avatar
eddie.woo committed
98 99 100 101 102 103 104
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
105
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
eddie.woo's avatar
eddie.woo committed
106 107 108 109 110 111
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    select 
    <include refid="Base_Column_List" />
112 113
    from organization_service_template_group
    where id = #{id,jdbcType=BIGINT}
eddie.woo's avatar
eddie.woo committed
114
  </select>
115
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
eddie.woo's avatar
eddie.woo committed
116 117 118 119
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
120 121
    delete from organization_service_template_group
    where id = #{id,jdbcType=BIGINT}
eddie.woo's avatar
eddie.woo committed
122 123 124 125 126 127
  </delete>
  <delete id="deleteByExample" parameterType="pwc.taxtech.atms.entitiy.OrganizationServiceTemplateGroupExample">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
128
    delete from organization_service_template_group
eddie.woo's avatar
eddie.woo committed
129 130 131 132 133 134 135 136 137
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="pwc.taxtech.atms.entitiy.OrganizationServiceTemplateGroup">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
138 139 140 141
    insert into organization_service_template_group (id, organization_id, service_type_id, 
      template_group_id)
    values (#{id,jdbcType=BIGINT}, #{organizationId,jdbcType=VARCHAR}, #{serviceTypeId,jdbcType=VARCHAR}, 
      #{templateGroupId,jdbcType=BIGINT})
eddie.woo's avatar
eddie.woo committed
142 143 144 145 146 147
  </insert>
  <insert id="insertSelective" parameterType="pwc.taxtech.atms.entitiy.OrganizationServiceTemplateGroup">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
148
    insert into organization_service_template_group
eddie.woo's avatar
eddie.woo committed
149
    <trim prefix="(" suffix=")" suffixOverrides=",">
150 151
      <if test="id != null">
        id,
eddie.woo's avatar
eddie.woo committed
152
      </if>
153 154
      <if test="organizationId != null">
        organization_id,
eddie.woo's avatar
eddie.woo committed
155
      </if>
156 157
      <if test="serviceTypeId != null">
        service_type_id,
eddie.woo's avatar
eddie.woo committed
158
      </if>
159 160
      <if test="templateGroupId != null">
        template_group_id,
eddie.woo's avatar
eddie.woo committed
161 162 163
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
164 165
      <if test="id != null">
        #{id,jdbcType=BIGINT},
eddie.woo's avatar
eddie.woo committed
166
      </if>
167 168
      <if test="organizationId != null">
        #{organizationId,jdbcType=VARCHAR},
eddie.woo's avatar
eddie.woo committed
169
      </if>
170 171
      <if test="serviceTypeId != null">
        #{serviceTypeId,jdbcType=VARCHAR},
eddie.woo's avatar
eddie.woo committed
172
      </if>
173 174
      <if test="templateGroupId != null">
        #{templateGroupId,jdbcType=BIGINT},
eddie.woo's avatar
eddie.woo committed
175 176 177 178 179 180 181 182
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="pwc.taxtech.atms.entitiy.OrganizationServiceTemplateGroupExample" resultType="java.lang.Long">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
183
    select count(*) from organization_service_template_group
eddie.woo's avatar
eddie.woo committed
184 185 186 187 188 189 190 191 192
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
193
    update organization_service_template_group
eddie.woo's avatar
eddie.woo committed
194
    <set>
195 196
      <if test="record.id != null">
        id = #{record.id,jdbcType=BIGINT},
eddie.woo's avatar
eddie.woo committed
197
      </if>
198 199
      <if test="record.organizationId != null">
        organization_id = #{record.organizationId,jdbcType=VARCHAR},
eddie.woo's avatar
eddie.woo committed
200
      </if>
201 202
      <if test="record.serviceTypeId != null">
        service_type_id = #{record.serviceTypeId,jdbcType=VARCHAR},
eddie.woo's avatar
eddie.woo committed
203
      </if>
204 205
      <if test="record.templateGroupId != null">
        template_group_id = #{record.templateGroupId,jdbcType=BIGINT},
eddie.woo's avatar
eddie.woo committed
206 207 208 209 210 211 212 213 214 215 216
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
217 218 219 220 221
    update organization_service_template_group
    set id = #{record.id,jdbcType=BIGINT},
      organization_id = #{record.organizationId,jdbcType=VARCHAR},
      service_type_id = #{record.serviceTypeId,jdbcType=VARCHAR},
      template_group_id = #{record.templateGroupId,jdbcType=BIGINT}
eddie.woo's avatar
eddie.woo committed
222 223 224 225 226 227 228 229 230
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="pwc.taxtech.atms.entitiy.OrganizationServiceTemplateGroup">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
231
    update organization_service_template_group
eddie.woo's avatar
eddie.woo committed
232
    <set>
233 234
      <if test="organizationId != null">
        organization_id = #{organizationId,jdbcType=VARCHAR},
eddie.woo's avatar
eddie.woo committed
235
      </if>
236 237
      <if test="serviceTypeId != null">
        service_type_id = #{serviceTypeId,jdbcType=VARCHAR},
eddie.woo's avatar
eddie.woo committed
238
      </if>
239 240
      <if test="templateGroupId != null">
        template_group_id = #{templateGroupId,jdbcType=BIGINT},
eddie.woo's avatar
eddie.woo committed
241 242
      </if>
    </set>
243
    where id = #{id,jdbcType=BIGINT}
eddie.woo's avatar
eddie.woo committed
244 245 246 247 248 249
  </update>
  <update id="updateByPrimaryKey" parameterType="pwc.taxtech.atms.entitiy.OrganizationServiceTemplateGroup">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
250 251 252 253 254
    update organization_service_template_group
    set organization_id = #{organizationId,jdbcType=VARCHAR},
      service_type_id = #{serviceTypeId,jdbcType=VARCHAR},
      template_group_id = #{templateGroupId,jdbcType=BIGINT}
    where id = #{id,jdbcType=BIGINT}
eddie.woo's avatar
eddie.woo committed
255 256 257 258 259 260 261 262 263 264 265
  </update>
  <select id="selectByExampleWithRowbounds" parameterType="pwc.taxtech.atms.entitiy.OrganizationServiceTemplateGroupExample" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
266
    from organization_service_template_group
eddie.woo's avatar
eddie.woo committed
267 268 269 270 271 272 273 274 275 276 277 278 279 280 281
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
  <resultMap id="OrganizationServiceTemplateGroupDto" type="pwc.taxtech.atms.dto.OrganizationServiceTemplateGroupDto">
    <id column="ID" jdbcType="VARCHAR" property="ID" />
 	<result column="ServiceTypeID" jdbcType="VARCHAR" property="serviceTypeID" />
 	<result column="OrganizationID" jdbcType="VARCHAR" property="organizationID" />
 	<result column="TemplateGroupID" jdbcType="VARCHAR" property="templateGroupID" />
 	<result column="TemplateGroupName" jdbcType="VARCHAR" property="templateGroupName" />
  </resultMap>
  <select id="getSingleOrgByOrgIDToOSTGDto" parameterType="map" resultMap="OrganizationServiceTemplateGroupDto">
282 283 284 285 286 287 288 289 290 291 292 293 294
    SELECT
    m.ID AS ID,
    m.service_type_id AS ServiceTypeID,
    m.organization_id AS OrganizationID,
    m.template_group_id AS TemplateGroupID,
    t.Name AS TemplateGroupName
    FROM
    organization_service_template_group AS m
    LEFT JOIN
    template_group AS t ON m.template_group_id = t.ID
    WHERE
    m.organization_id = #{orgId}
    order by m.service_type_id
eddie.woo's avatar
eddie.woo committed
295
  </select>
296
  <select id="getOrgnizationServiceTemplateGroupOrgNames" parameterType="java.lang.String" resultType="java.lang.String">
297 298 299 300 301 302 303 304
    SELECT
    q.Name
    FROM
    organization_service_template_group p
    LEFT JOIN
    Organization q ON p.organization_id = q.ID
    WHERE
    p.template_group_id = #{templateGroupDtoID,jdbcType=VARCHAR} AND q.IsActive = 1
305
  </select>
eddie.woo's avatar
eddie.woo committed
306
</mapper>