| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
- <?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.huaxu.dao.ThingSettingMapper">
- <resultMap type="ThingSettingEntity" id="ThingSettingResult">
- <result property="id" column="id"/>
- <result property="tenantId" column="tenant_id"/>
- <result property="companyOrgId" column="company_org_id"/>
- <result property="deptOrgId" column="dept_org_id"/>
- <result property="thingType" column="thing_type"/>
- <result property="thingObjectType" column="thing_object_type"/>
- <result property="thingBore" column="thing_bore"/>
- <result property="thingLength" column="thing_length"/>
- <result property="thingCount" column="thing_count"/>
- <result property="remark" column="remark"/>
- <result property="status" column="status"/>
- <result property="dateCreate" column="date_create"/>
- <result property="createBy" column="create_by"/>
- <result property="dateUpdate" column="date_update"/>
- <result property="updateBy" column="update_by"/>
- </resultMap>
- <!-- 实体栏位 -->
- <sql id="thingSettingColumns">
- a.id as "id" ,
- a.tenant_id as "tenantId" ,
- a.company_org_id as "companyOrgId" ,
- a.dept_org_id as "deptOrgId" ,
- a.thing_type as "thingType" ,
- a.thing_object_type as "thingObjectType" ,
- a.thing_bore as "thingBore" ,
- a.thing_length as "thingLength" ,
- a.thing_count as "thingCount" ,
- a.remark as "remark" ,
- a.status as "status" ,
- a.date_create as "dateCreate" ,
- a.create_by as "createBy" ,
- a.date_update as "dateUpdate" ,
- a.update_by as "updateBy"
- </sql>
- <!-- 根据主键获取实体 -->
- <select id="findThingSettingById" resultType="com.huaxu.entity.ThingSettingEntity">
- SELECT
- <include refid="thingSettingColumns"/>
- FROM sms_thing_setting a
- WHERE a.id = #{id} and a.status=1
- </select>
- <!-- 根据获取实体List -->
- <select id="findList" resultType="com.huaxu.entity.ThingSettingEntity">
- SELECT
- <include refid="thingSettingColumns"/>
- FROM sms_thing_setting a
- <where>
- a.status=1
- <if test="thingSetting.tenantId != null and thingSetting.tenantId != ''">and a.tenant_id = #{thingSetting.tenantId}</if>
- <if test="thingSetting.thingType != null ">and a.thing_type = #{thingSetting.thingType}</if>
- <if test="thingSetting.thingObjectType != null ">and a.thing_object_type = #{thingSetting.thingObjectType}</if>
- <if test="thingSetting.userType!=null and thingSetting.userType!=-999 and thingSetting.userType!=-9999 and thingSetting.programItems != null and thingSetting.programItems.size() > 0">
- <if test="thingSetting.permissonType == 5 or thingSetting.permissonType == 2">
- and ( a.DEPT_ORG_ID in
- <foreach collection="thingSetting.programItems" item="item" open="(" close=")" separator=",">
- #{item.orgId}
- </foreach>
- or
- a.COMPANY_ORG_ID in
- <foreach collection="thingSetting.programItems" item="item" open="(" close=")" separator=",">
- #{item.orgId}
- </foreach>
- )
- </if>
- <if test="thingSetting.permissonType == 4 or thingSetting.permissonType == 3">
- and a.DEPT_ORG_ID in
- <foreach collection="thingSetting.programItems" item="item" open="(" close=")" separator=",">
- #{item.orgId}
- </foreach>
- </if>
- <if test="thingSetting.permissonType == 1">
- and a.COMPANY_ORG_ID in
- <foreach collection="thingSetting.programItems" item="item" open="(" close=")" separator=",">
- #{item.orgId}
- </foreach>
- and (a.DEPT_ORG_ID is null or a.DEPT_ORG_ID =0)
- </if>
- </if>
- </where>
- </select>
- <!-- 根据获取实体List -->
- <select id="findTotalList" resultType="com.huaxu.entity.ThingSettingEntity">
- SELECT
- a.thing_type as "thingType",sum(a.thing_length) as "thingLength" , sum(a.thing_count) as "thingCount"
- FROM sms_thing_setting a
- <where>
- a.status=1
- <if test="thingSetting.tenantId != null and thingSetting.tenantId != ''">and a.tenant_id = #{thingSetting.tenantId}</if>
- <if test="thingSetting.thingType != null ">and a.thing_type = #{thingSetting.thingType}</if>
- <if test="thingSetting.thingObjectType != null ">and a.thing_object_type = #{thingSetting.thingObjectType}</if>
- <if test="thingSetting.userType!=null and thingSetting.userType!=-999 and thingSetting.userType!=-9999 and thingSetting.programItems != null and thingSetting.programItems.size() > 0">
- <if test="thingSetting.permissonType == 5 or thingSetting.permissonType == 2">
- and ( a.DEPT_ORG_ID in
- <foreach collection="thingSetting.programItems" item="item" open="(" close=")" separator=",">
- #{item.orgId}
- </foreach>
- or
- a.COMPANY_ORG_ID in
- <foreach collection="thingSetting.programItems" item="item" open="(" close=")" separator=",">
- #{item.orgId}
- </foreach>
- )
- </if>
- <if test="thingSetting.permissonType == 4 or thingSetting.permissonType == 3">
- and a.DEPT_ORG_ID in
- <foreach collection="thingSetting.programItems" item="item" open="(" close=")" separator=",">
- #{item.orgId}
- </foreach>
- </if>
- <if test="thingSetting.permissonType == 1">
- and a.COMPANY_ORG_ID in
- <foreach collection="thingSetting.programItems" item="item" open="(" close=")" separator=",">
- #{item.orgId}
- </foreach>
- and (a.DEPT_ORG_ID is null or a.DEPT_ORG_ID =0)
- </if>
- </if>
- </where>
- group by a.thing_type
- </select>
- <!-- 根据获取实体 page -->
- <select id="findPage" resultType="com.huaxu.entity.ThingSettingEntity">
- SELECT
- <include refid="thingSettingColumns"/>
- FROM sms_thing_setting a
- <where>
- a.status=1
- <if test="thingSetting.tenantId != null and thingSetting.tenantId != ''">and a.tenant_id =
- #{thingSetting.tenantId}
- </if>
- <if test="thingSetting.thingType != null ">and a.thing_type = #{thingSetting.thingType}</if>
- <if test="thingSetting.thingObjectType != null ">and a.thing_object_type = #{thingSetting.thingObjectType}
- </if>
- </where>
- </select>
- </mapper>
|