123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286 |
- <?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.zhyc.xps.sys.mapper.OrgMapper">
- <resultMap id="BaseResultMap" type="com.zhyc.xps.sys.entity.Org">
- <result column="oc_id" property="ocId" jdbcType="BIGINT" />
- <result column="org_name" property="orgName" jdbcType="VARCHAR" />
- <result column="org_code" property="orgCode" jdbcType="VARCHAR" />
- <result column="org_cat_id" property="orgCatId" jdbcType="BIGINT" />
- <result column="org_area_code" property="orgAreaCode" jdbcType="VARCHAR" />
- <result column="org_area_name" property="orgAreaName" jdbcType="VARCHAR" />
- <result column="org_lxr" property="orgLxr" jdbcType="VARCHAR" />
- <result column="org_lxdh" property="orgLxdh" jdbcType="VARCHAR" />
- <result column="org_dzyx" property="orgDzyx" jdbcType="VARCHAR" />
- <result column="org_address" property="orgAddress" jdbcType="VARCHAR" />
- <result column="org_wzjd" property="orgWzjd" jdbcType="DECIMAL" /><!--位置经度-->
- <result column="org_wzwd" property="orgWzwd" jdbcType="DECIMAL" /><!--位置纬度-->
- <result column="org_desc" property="orgDesc" jdbcType="VARCHAR" />
- </resultMap>
-
- <resultMap id="OrgDtoMap" type="com.zhyc.xps.sys.dto.OrgDto" extends="BaseResultMap">
- <result column="org_cat_title" property="orgCatTitle" jdbcType="VARCHAR" />
- <result column="root_id" property="rootId" jdbcType="BIGINT" />
- <result column="parent_id" property="parentId" jdbcType="BIGINT" />
- <result column="admin_id" property="adminId" jdbcType="BIGINT" />
- <result column="group_id" property="groupId" jdbcType="BIGINT" />
- <result column="node_left" property="nodeLeft" jdbcType="BIGINT" />
- <result column="node_right" property="nodeRight" jdbcType="BIGINT" />
- <result column="node_level" property="nodeLevel" jdbcType="BIGINT" />
- <result column="is_leaf" property="isLeaf" jdbcType="BIGINT" />
- <result column="status" property="status" jdbcType="BIGINT" />
- <result column="admin_name" property="adminName" jdbcType="VARCHAR" />
- </resultMap>
- <sql id="OrgDto_Cols" >
- A.oc_id,
- A.org_name,
- A.org_code,
- A.org_cat_id,
- A.org_lxr,
- A.org_lxdh,
- A.org_dzyx,
- D.org_cat_title,
- A.org_area_code,
- A.org_area_name,
- A.org_address,
- A.org_wzjd,
- A.org_wzwd,
- A.org_desc,
- B.parent_id,
- B.root_id,
- B.admin_id,
- C.account_name AS admin_name,
- B.group_id,
- B.node_left,
- B.node_right,
- B.node_level,
- B.is_leaf,
- B.status
- </sql>
-
- <!-- 分页查询 -->
- <select id="getByPage" parameterType="java.util.Map" resultMap="OrgDtoMap">
- SELECT
- <include refid="OrgDto_Cols"/>
- FROM org AS A
- LEFT JOIN oc AS B ON (A.oc_id = B.oc_id)
- LEFT JOIN account AS C ON (B.oc_id = C.oc_id AND B.admin_id = C.account_id)
- LEFT JOIN org_cat AS D ON (A.org_cat_id = D.org_cat_id)
- WHERE 1=1 AND A.deleted_flag=0
- <if test="ocId != null">
- AND A.oc_id = #{ocId}
- </if>
- <if test="keywords != null and keywords != ''">
- AND ( A.org_name LIKE "%"#{keywords}"%"
- </if>
- <if test="orgDzyx != null">
- AND A.org_dzyx = #{orgDzyx ,jdbcType=VARCHAR}
- </if>
- ORDER BY A.oc_id DESC
- </select>
- <!-- 列表查询 -->
- <select id="getByList" parameterType="java.util.Map" resultMap="OrgDtoMap">
- SELECT
- <include refid="OrgDto_Cols"/>
- FROM org AS A
- LEFT JOIN oc AS B ON (A.oc_id = B.oc_id)
- LEFT JOIN account AS C ON (B.oc_id = C.oc_id AND B.admin_id = C.account_id)
- LEFT JOIN org_cat AS D ON (A.org_cat_id = D.org_cat_id)
- WHERE 1 = 1 AND A.deleted_flag = 0
- <if test="ocId != null">
- AND A.oc_id = #{ocId}
- </if>
- <if test="orgDzyx != null">
- AND A.org_dzyx = #{orgDzyx ,jdbcType=VARCHAR}
- </if>
- <if test="keywords != null and keywords != ''">
- AND ( A.org_name LIKE "%"#{keywords}"%"
- </if>
- ORDER BY A.oc_id DESC
- </select>
- <!--基于ID查询-->
- <select id="getById" resultMap="OrgDtoMap" >
- SELECT
- <include refid="OrgDto_Cols"/>
- FROM org AS A
- LEFT JOIN oc AS B ON (A.oc_id = B.oc_id)
- LEFT JOIN account AS C ON (B.oc_id = C.oc_id AND B.admin_id = C.account_id)
- LEFT JOIN org_cat AS D ON (A.org_cat_id = D.org_cat_id)
- WHERE 1=1 AND A.deleted_flag=0
- AND A.oc_id = #{ocId, jdbcType=BIGINT}
- </select>
- <!--新增Insert-->
- <insert id="create" useGeneratedKeys="true" keyProperty="ocId" parameterType="com.zhyc.xps.sys.entity.Org">
- INSERT INTO org
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="ocId != null">
- oc_id,
- </if>
- <if test="orgName != null and orgName != ''">
- org_name,
- </if>
- <if test="orgCode != null and orgCode != ''">
- org_code,
- </if>
- <if test="orgCatId != null">
- org_cat_id,
- </if>
- <if test="orgLxr != null and orgLxr != ''">
- org_lxr,
- </if>
- <if test="orgLxdh != null and orgLxdh != ''">
- orgLxdh,
- </if>
- <if test="orgDzyx != null and orgDzyx != ''">
- org_dzyx,
- </if>
- <if test="orgAreaCode != null and orgAreaCode != ''">
- org_area_code,
- </if>
- <if test="orgAreaName != null and orgAreaName != ''">
- org_area_name,
- </if>
- <if test="orgAddress != null and orgAddress != ''">
- org_address,
- </if>
- <if test="orgWzjd != null">
- org_wzjd,
- </if>
- <if test="orgWzwd != null">
- org_wzwd,
- </if>
- <if test="orgDesc != null and orgDesc != ''">
- org_desc,
- </if>
- <if test="createdBy != null">
- created_by,
- </if>
- <if test="createdAt != null">
- created_at,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="ocId != null">
- #{ocId, jdbcType=BIGINT},
- </if>
- <if test="orgName != null and orgName != ''">
- #{orgName,jdbcType=VARCHAR},
- </if>
- <if test="orgCode != null and orgCode != ''">
- #{orgCode,jdbcType=VARCHAR},
- </if>
- <if test="orgCatId != null">
- #{orgCatId,jdbcType=BIGINT},
- </if>
- <if test="orgLxr != null and orgLxr != ''">
- #{orgLxr , jdbcType=VARCHAR},
- </if>
- <if test="orgLxdh != null and orgLxdh != ''">
- #{orgLxdh , jdbcType=VARCHAR},
- </if>
- <if test="orgDzyx != null and orgDzyx != ''">
- #{orgDzyx , jdbcType=VARCHAR},
- </if>
- <if test="orgAreaCode != null and orgAreaCode != ''">
- #{orgAreaCode , jdbcType=VARCHAR},
- </if>
- <if test="orgAreaName != null and orgAreaName != ''">
- #{orgAreaName , jdbcType=VARCHAR},
- </if>
- <if test="orgAddress != null and orgAddress != ''">
- #{orgAddress , jdbcType=VARCHAR},
- </if>
- <if test="orgWzjd != null">
- #{orgWzjd, jdbcType=DECIMAL},
- </if>
- <if test="orgWzwd != null">
- #{orgWzwd, jdbcType=DECIMAL},
- </if>
- <if test="orgDesc != null and orgDesc != ''">
- #{orgDesc , jdbcType=VARCHAR},
- </if>
- <if test="createdBy != null">
- #{createdBy , jdbcType=BIGINT},
- </if>
- <if test="createdAt != null">
- #{createdAt, jdbcType=TIMESTAMP},
- </if>
-
- </trim>
- </insert>
-
- <!--Update更新-->
- <update id="update" parameterType="com.zhyc.xps.sys.entity.Org">
- UPDATE org
- <trim suffixOverrides=",">
- <set>
- <if test="orgName != null and orgName != ''">
- org_name = #{orgName,jdbcType=VARCHAR},
- </if>
- <if test="orgCode != null and orgCode != ''">
- org_code = #{orgCode,jdbcType=VARCHAR},
- </if>
- <if test="orgCatId != null">
- org_cat_id = #{orgCatId,jdbcType=BIGINT},
- </if>
- <if test="orgLxr != null">
- org_lxr = #{orgLxr,jdbcType=VARCHAR},
- </if>
- <if test="orgLxdh != null">
- org_lxdh = #{orgLxdh,jdbcType=VARCHAR},
- </if>
- <if test="orgDzyx != null ">
- org_dzyx = #{orgDzyx , jdbcType=VARCHAR},
- </if>
- <if test="orgAreaCode != null">
- org_area_code = #{orgAreaCode , jdbcType=VARCHAR},
- </if>
- <if test="orgAreaName != null">
- org_area_name = #{orgAreaName , jdbcType=VARCHAR},
- </if>
- <if test="orgAddress != null">
- org_address = #{orgAddress , jdbcType=VARCHAR},
- </if>
- <if test="orgWzjd != null">
- org_wzjd = #{orgWzjd, jdbcType=DECIMAL},
- </if>
- <if test="orgWzwd != null">
- org_wzwd = #{orgWzwd, jdbcType=DECIMAL},
- </if>
- <if test="orgDesc != null">
- org_desc = #{orgDesc , jdbcType=VARCHAR},
- </if>
- <if test="updatedBy != null">
- updated_by = #{updatedBy,jdbcType=BIGINT},
- </if>
- <if test="updatedAt != null">
- updated_at = #{updatedAt,jdbcType=TIMESTAMP},
- </if>
- </set>
- </trim>
- WHERE oc_id = #{ocId, jdbcType=BIGINT}
- </update>
- <!--删除-->
- <update id="delete" parameterType="java.util.Map">
- UPDATE org
- <trim suffixOverrides=",">
- <set>
- <if test="deletedFlag != null">
- deleted_flag = #{deletedFlag,jdbcType=BIGINT},
- </if>
- <if test="deletedAt != null">
- deleted_at = #{deletedAt ,jdbcType=DATE},
- </if>
- <if test="deletedBy != null">
- deleted_by = #{deletedBy,jdbcType=BIGINT},
- </if>
- </set>
- </trim>
- WHERE oc_id = #{ocId ,jdbcType = BIGINT}
- </update>
- </mapper>
|