| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433 |
- <?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.goafanti.common.dao.AdminMapper" >
- <resultMap id="BaseResultMap" type="com.goafanti.common.model.Admin" >
- <id column="id" property="id" jdbcType="VARCHAR" />
- <result column="mobile" property="mobile" jdbcType="VARCHAR" />
- <result column="name" property="name" jdbcType="VARCHAR" />
- <result column="password" property="password" jdbcType="VARCHAR" />
- <result column="email" property="email" jdbcType="VARCHAR" />
- <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
- <result column="number" property="number" jdbcType="INTEGER" />
- <result column="province" property="province" jdbcType="INTEGER" />
- <result column="position" property="position" jdbcType="VARCHAR" />
- <result column="superior_id" property="superiorId" jdbcType="VARCHAR" />
- <result column="city" property="city" jdbcType="INTEGER" />
- </resultMap>
- <sql id="Base_Column_List" >
- id, mobile, name, password, email, create_time, number, province, position, superior_id,
- city
- </sql>
- <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
- select
- <include refid="Base_Column_List" />
- from admin
- where id = #{id,jdbcType=VARCHAR}
- </select>
- <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
- delete from admin
- where id = #{id,jdbcType=VARCHAR}
- </delete>
- <insert id="insert" parameterType="com.goafanti.common.model.Admin" >
- insert into admin (id, mobile, name,
- password, email, create_time,
- number, province, position, superior_id, city)
- values (#{id,jdbcType=VARCHAR}, #{mobile,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
- #{password,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
- #{number,jdbcType=INTEGER}, #{province,jdbcType=INTEGER}, #{position,jdbcType=VARCHAR},
- #{superiorId,jdbcType=VARCHAR}, #{city,jdbcType=INTEGER}
- )
- </insert>
- <insert id="insertSelective" parameterType="com.goafanti.common.model.Admin" >
- insert into admin
- <trim prefix="(" suffix=")" suffixOverrides="," >
- <if test="id != null" >
- id,
- </if>
- <if test="mobile != null" >
- mobile,
- </if>
- <if test="name != null" >
- name,
- </if>
- <if test="password != null" >
- password,
- </if>
- <if test="email != null" >
- email,
- </if>
- <if test="createTime != null" >
- create_time,
- </if>
- <if test="number != null" >
- number,
- </if>
- <if test="province != null" >
- province,
- </if>
- <if test="position != null" >
- position,
- </if>
- <if test="superiorId != null" >
- superior_id,
- </if>
- <if test="city != null" >
- city,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides="," >
- <if test="id != null" >
- #{id,jdbcType=VARCHAR},
- </if>
- <if test="mobile != null" >
- #{mobile,jdbcType=VARCHAR},
- </if>
- <if test="name != null" >
- #{name,jdbcType=VARCHAR},
- </if>
- <if test="password != null" >
- #{password,jdbcType=VARCHAR},
- </if>
- <if test="email != null" >
- #{email,jdbcType=VARCHAR},
- </if>
- <if test="createTime != null" >
- #{createTime,jdbcType=TIMESTAMP},
- </if>
- <if test="number != null" >
- #{number,jdbcType=INTEGER},
- </if>
- <if test="province != null" >
- #{province,jdbcType=INTEGER},
- </if>
- <if test="position != null" >
- #{position,jdbcType=VARCHAR},
- </if>
- <if test="superiorId != null" >
- #{superiorId,jdbcType=VARCHAR},
- </if>
- <if test="city != null" >
- #{city,jdbcType=INTEGER},
- </if>
- </trim>
- </insert>
- <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.Admin" >
- update admin
- <set >
- <if test="mobile != null" >
- mobile = #{mobile,jdbcType=VARCHAR},
- </if>
- <if test="name != null" >
- name = #{name,jdbcType=VARCHAR},
- </if>
- <if test="password != null" >
- password = #{password,jdbcType=VARCHAR},
- </if>
- <if test="email != null" >
- email = #{email,jdbcType=VARCHAR},
- </if>
- <if test="createTime != null" >
- create_time = #{createTime,jdbcType=TIMESTAMP},
- </if>
- <if test="number != null" >
- number = #{number,jdbcType=INTEGER},
- </if>
- <if test="province != null" >
- province = #{province,jdbcType=INTEGER},
- </if>
- <if test="position != null" >
- position = #{position,jdbcType=VARCHAR},
- </if>
- <if test="superiorId != null" >
- superior_id = #{superiorId,jdbcType=VARCHAR},
- </if>
- <if test="city != null" >
- city = #{city,jdbcType=INTEGER},
- </if>
- </set>
- where id = #{id,jdbcType=VARCHAR}
- </update>
- <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.Admin" >
- update admin
- set mobile = #{mobile,jdbcType=VARCHAR},
- name = #{name,jdbcType=VARCHAR},
- password = #{password,jdbcType=VARCHAR},
- email = #{email,jdbcType=VARCHAR},
- create_time = #{createTime,jdbcType=TIMESTAMP},
- number = #{number,jdbcType=INTEGER},
- province = #{province,jdbcType=INTEGER},
- position = #{position,jdbcType=VARCHAR},
- superior_id = #{superiorId,jdbcType=VARCHAR},
- city = #{city,jdbcType=INTEGER}
- where id = #{id,jdbcType=VARCHAR}
- </update>
-
- <select id="selectAllAdmin" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List" />
- from admin
- </select>
-
- <select id="selectByMobile" parameterType="java.lang.String" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List" />
- from admin
- where mobile = #{mobile,jdbcType=VARCHAR}
- </select>
-
- <select id= "findAdminListByPage" parameterType="java.lang.String" resultType="com.goafanti.admin.bo.AdminListBo" >
- select
- a.number, a.mobile, a.name,
- a.position, a.email, a.id,
- a.create_time as createTime, GROUP_CONCAT(DISTINCT(al.province)) AS province,
- aa.name as superior, a.superior_id as superiorId
- from admin a
- left join admin_location al on a.id = al.admin_id
- left join admin aa on aa.id = a.superior_id
- where a.id <![CDATA[ <> ]]> '1'
- <if test = "mobile != null">
- and a.mobile = #{mobile,jdbcType=VARCHAR}
- </if>
- <if test = "name != null">
- and a.name = #{name,jdbcType=VARCHAR}
- </if>
- <if test = "number != null">
- and a.number = #{number,jdbcType=INTEGER}
- </if>
- group by a.id
- order by a.number
- <if test="page_sql!=null">
- ${page_sql}
- </if>
- </select>
-
- <select id = "findAdminCount" parameterType="java.lang.String" resultType="java.lang.Integer">
- select count(1) from admin
- where id <![CDATA[ <> ]]> '1'
- <if test = "mobile != null">
- and mobile = #{mobile,jdbcType=VARCHAR}
- </if>
- <if test = "name != null">
- and name = #{name,jdbcType=VARCHAR}
- </if>
- <if test = "number != null">
- and number = #{number,jdbcType=INTEGER}
- </if>
- </select>
-
- <select id="selectRolesByPrimaryKey" parameterType="java.lang.String">
- select r.name, r.id, r.type
- from role r
- left join user_role ur on ur.rid=r.id
- where ur.uid = #{uid,jdbcType=VARCHAR}
- </select>
-
- <select id="selectCognizanceConsultant" resultMap="BaseResultMap" >
- select
- <include refid="Base_Column_List" />
- from admin
- where id <![CDATA[ <> ]]> '1'
- </select>
-
- <select id="selectCognizancePrincipal" resultMap="BaseResultMap" >
- select a.id, a.name, a.position from admin a
- INNER JOIN user_role ur on a.id = ur.uid
- where ur.rid not in('1','2','3','4')
- group by a.id
- </select>
-
- <select id="selectPatentAuthor" resultMap="BaseResultMap" >
- select a.id, a.name, a.position from admin a
- INNER JOIN user_role ur on a.id = ur.uid
- where ur.rid not in('1','2','3','4')
- group by a.id
- </select>
-
- <select id="selectPatentPrincipal" resultMap="BaseResultMap" >
- select a.id, a.name, a.position from admin a
- INNER JOIN user_role ur on a.id = ur.uid
- where ur.rid not in('1','2','3','4','5','6')
- group by a.id
- </select>
-
- <select id="selectCopyrightConsultant" resultMap="BaseResultMap" >
- select
- <include refid="Base_Column_List" />
- from admin
- where id <![CDATA[ <> ]]> '1'
- </select>
-
- <select id="selectCopyrightPrincipal" resultMap="BaseResultMap" >
- select a.id, a.name, a.position from admin a
- INNER JOIN user_role ur on a.id = ur.uid
- where ur.rid not in('1','2','3','4','5','6')
- group by a.id
- </select>
-
- <select id="selectTechprojectConsultant" resultMap="BaseResultMap" >
- select
- <include refid="Base_Column_List" />
- from admin
- where id <![CDATA[ <> ]]> '1'
- </select>
-
- <select id="selectTechprojectPrincipal" resultMap="BaseResultMap" >
- select a.id, a.name, a.position from admin a
- INNER JOIN user_role ur on a.id = ur.uid
- where ur.rid not in('1','2','3','4','5','6')
- group by a.id
- </select>
-
- <select id="selectRoleByPrimaryKey" parameterType="java.lang.String" resultType="String">
- SELECT rid FROM user_role
- where uid = #{uid,jdbcType=VARCHAR}
- </select>
-
- <select id="selectAccoutManager" resultMap="BaseResultMap">
- select a.id, a.name, a.position from admin a
- INNER JOIN user_role ur on a.id = ur.uid
- where ur.rid = '4'
- </select>
-
- <select id="selectTechnician" resultMap="BaseResultMap">
- select a.id, a.name, a.position from admin a
- INNER JOIN user_role ur on a.id = ur.uid
- where ur.rid not in('1','2','3','4','5','6')
- group by a.id
- </select>
-
- <select id="selectSalesman" resultMap="BaseResultMap">
- select a.id, a.name, a.position from admin a
- INNER JOIN user_role ur on a.id = ur.uid
- where ur.rid in ('5', '6')
- </select>
-
- <select id="selectContractManager" resultMap="BaseResultMap" >
- select a.id, a.name, a.position from admin a
- INNER JOIN user_role ur on a.id = ur.uid
- where ur.rid not in('1','2','3','4')
- group by a.id
- </select>
-
- <select id="selectTechBroder" resultMap="BaseResultMap">
- select a.id, a.name, a.position from admin a
- INNER JOIN user_role ur on a.id = ur.uid
- where ur.rid = 7
- </select>
-
- <select id="listAdminSelectBySuperAdmin" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List" />
- from admin
- where id <![CDATA[ <> ]]> '1'
- </select>
-
- <select id="listAdminSelectByAreaAdmin" resultMap="BaseResultMap">
- select
- a.id, a.name, a.mobile,
- a.create_time as createTime, a.number, aa.name as superior
- from admin a
- left join admin_location al on al.admin_id = a.id
- left join admin aa on aa.id = a.superior_id
- where 1 = 1
- <if test="provinceList != null">
- and al.province in
- <foreach collection="provinceList" item="plist" open="(" separator="," close=")">
- #{plist}
- </foreach>
- </if>
- <if test = "provinceList != null && cityList != null">
- or
- </if>
- <if test="cityList != null">
- <if test="provinceList == null">
- and
- </if>
- al.city in
- <foreach collection="cityList" item="clist" open="(" separator="," close=")">
- #{clist}
- </foreach>
- </if>
- </select>
-
- <select id= "findAreaAdminListByPage" parameterType="java.lang.String" resultType="com.goafanti.admin.bo.AdminListBo" >
- select
- a.number, a.mobile, a.name,
- a.position, a.email, a.id,
- a.create_time as createTime,
- aa.name as superior, GROUP_CONCAT(DISTINCT(al.province)) AS province,
- a.superior_id as superiorId
- from admin a
- left join admin_location al on a.id = al.admin_id
- left join admin aa on aa.id = a.superior_id
- where 1 =1
- <if test = "mobile != null">
- and a.mobile = #{mobile,jdbcType=VARCHAR}
- </if>
- <if test = "name != null">
- and a.name = #{name,jdbcType=VARCHAR}
- </if>
- <if test = "number != null">
- and a.number = #{number,jdbcType=INTEGER}
- </if>
- <if test="provinceList != null">
- and al.province in
- <foreach collection="provinceList" item="plist" open="(" separator="," close=")">
- #{plist}
- </foreach>
- </if>
- <if test = "provinceList != null && cityList != null">
- or
- </if>
- <if test="cityList != null">
- <if test="provinceList == null">
- and
- </if>
- al.city in
- <foreach collection="cityList" item="clist" open="(" separator="," close=")">
- #{clist}
- </foreach>
- </if>
- group by a.id
- order by a.number
- <if test="page_sql!=null">
- ${page_sql}
- </if>
- </select>
-
- <select id = "findAreaAdminCount" parameterType="java.lang.String" resultType="java.lang.Integer">
- select count(1) from ( select count(1)
- from admin a
- left join admin_location al on a.id = al.admin_id
- where 1 = 1
- <if test = "mobile != null">
- and a.mobile = #{mobile,jdbcType=VARCHAR}
- </if>
- <if test = "name != null">
- and a.name = #{name,jdbcType=VARCHAR}
- </if>
- <if test = "number != null">
- and a.number = #{number,jdbcType=INTEGER}
- </if>
- <if test="provinceList != null">
- and al.province in
- <foreach collection="provinceList" item="plist" open="(" separator="," close=")">
- #{plist}
- </foreach>
- </if>
- <if test = "provinceList != null && cityList != null">
- or
- </if>
- <if test="cityList != null">
- <if test="provinceList == null">
- and
- </if>
- al.city in
- <foreach collection="cityList" item="clist" open="(" separator="," close=")">
- #{clist}
- </foreach>
- </if>
- group by a.id
- ) tem
- </select>
- </mapper>
|