| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037 |
- <?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" jdbcType="VARCHAR" property="id" />
- <result column="mobile" jdbcType="VARCHAR" property="mobile" />
- <result column="name" jdbcType="VARCHAR" property="name" />
- <result column="password" jdbcType="VARCHAR" property="password" />
- <result column="email" jdbcType="VARCHAR" property="email" />
- <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
- <result column="number" jdbcType="INTEGER" property="number" />
- <result column="province" jdbcType="VARCHAR" property="province" />
- <result column="position" jdbcType="VARCHAR" property="position" />
- <result column="superior_id" jdbcType="VARCHAR" property="superiorId" />
- <result column="city" jdbcType="VARCHAR" property="city" />
- <result column="department_id" jdbcType="VARCHAR" property="departmentId" />
- <result column="status" jdbcType="VARCHAR" property="status" />
- <result column="user_no" jdbcType="VARCHAR" property="userNo" />
- <result column="duty" jdbcType="VARCHAR" property="duty" />
- <result column="district" jdbcType="VARCHAR" property="district" />
- <result column="head_portrait_url" jdbcType="VARCHAR" property="headPortraitUrl" />
- <result column="contact_mobile" jdbcType="VARCHAR" property="contactMobile" />
- <result column="last_login_time" jdbcType="TIMESTAMP" property="lastLoginTime" />
- <result column="open_id" jdbcType="VARCHAR" property="openId" />
- <result column="type" jdbcType="INTEGER" property="type" />
- <result column="reviewer" jdbcType="VARCHAR" property="reviewer" />
- </resultMap>
- <sql id="Base_Column_List">
- id, mobile, `name`, `password`, email, create_time, `number`, province, `position`,
- superior_id, city, department_id, `status`, user_no, duty, district, head_portrait_url,
- contact_mobile, last_login_time, open_id, `type`, reviewer
- </sql>
- <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
- 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, department_id,
- `status`, user_no, duty,
- district, head_portrait_url, contact_mobile,
- last_login_time, open_id, `type`,
- reviewer)
- values (#{id,jdbcType=VARCHAR}, #{mobile,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
- #{password,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
- #{number,jdbcType=INTEGER}, #{province,jdbcType=VARCHAR}, #{position,jdbcType=VARCHAR},
- #{superiorId,jdbcType=VARCHAR}, #{city,jdbcType=VARCHAR}, #{departmentId,jdbcType=VARCHAR},
- #{status,jdbcType=VARCHAR}, #{userNo,jdbcType=VARCHAR}, #{duty,jdbcType=VARCHAR},
- #{district,jdbcType=VARCHAR}, #{headPortraitUrl,jdbcType=VARCHAR}, #{contactMobile,jdbcType=VARCHAR},
- #{lastLoginTime,jdbcType=TIMESTAMP}, #{openId,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER},
- #{reviewer,jdbcType=VARCHAR})
- </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>
- <if test="departmentId != null">
- department_id,
- </if>
- <if test="status != null">
- `status`,
- </if>
- <if test="userNo != null">
- user_no,
- </if>
- <if test="duty != null">
- duty,
- </if>
- <if test="district != null">
- district,
- </if>
- <if test="headPortraitUrl != null">
- head_portrait_url,
- </if>
- <if test="contactMobile != null">
- contact_mobile,
- </if>
- <if test="lastLoginTime != null">
- last_login_time,
- </if>
- <if test="openId != null">
- open_id,
- </if>
- <if test="type != null">
- `type`,
- </if>
- <if test="reviewer != null">
- reviewer,
- </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=VARCHAR},
- </if>
- <if test="position != null">
- #{position,jdbcType=VARCHAR},
- </if>
- <if test="superiorId != null">
- #{superiorId,jdbcType=VARCHAR},
- </if>
- <if test="city != null">
- #{city,jdbcType=VARCHAR},
- </if>
- <if test="departmentId != null">
- #{departmentId,jdbcType=VARCHAR},
- </if>
- <if test="status != null">
- #{status,jdbcType=VARCHAR},
- </if>
- <if test="userNo != null">
- #{userNo,jdbcType=VARCHAR},
- </if>
- <if test="duty != null">
- #{duty,jdbcType=VARCHAR},
- </if>
- <if test="district != null">
- #{district,jdbcType=VARCHAR},
- </if>
- <if test="headPortraitUrl != null">
- #{headPortraitUrl,jdbcType=VARCHAR},
- </if>
- <if test="contactMobile != null">
- #{contactMobile,jdbcType=VARCHAR},
- </if>
- <if test="lastLoginTime != null">
- #{lastLoginTime,jdbcType=TIMESTAMP},
- </if>
- <if test="openId != null">
- #{openId,jdbcType=VARCHAR},
- </if>
- <if test="type != null">
- #{type,jdbcType=INTEGER},
- </if>
- <if test="reviewer != null">
- #{reviewer,jdbcType=VARCHAR},
- </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=VARCHAR},
- </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=VARCHAR},
- </if>
- <if test="departmentId != null">
- department_id = #{departmentId,jdbcType=VARCHAR},
- </if>
- <if test="status != null">
- `status` = #{status,jdbcType=VARCHAR},
- </if>
- <if test="userNo != null">
- user_no = #{userNo,jdbcType=VARCHAR},
- </if>
- <if test="duty != null">
- duty = #{duty,jdbcType=VARCHAR},
- </if>
- <if test="district != null">
- district = #{district,jdbcType=VARCHAR},
- </if>
- <if test="headPortraitUrl != null">
- head_portrait_url = #{headPortraitUrl,jdbcType=VARCHAR},
- </if>
- <if test="contactMobile != null">
- contact_mobile = #{contactMobile,jdbcType=VARCHAR},
- </if>
- <if test="lastLoginTime != null">
- last_login_time = #{lastLoginTime,jdbcType=TIMESTAMP},
- </if>
- <if test="openId != null">
- open_id = #{openId,jdbcType=VARCHAR},
- </if>
- <if test="type != null">
- `type` = #{type,jdbcType=INTEGER},
- </if>
- <if test="reviewer != null">
- reviewer = #{reviewer,jdbcType=VARCHAR},
- </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=VARCHAR},
- `position` = #{position,jdbcType=VARCHAR},
- superior_id = #{superiorId,jdbcType=VARCHAR},
- city = #{city,jdbcType=VARCHAR},
- department_id = #{departmentId,jdbcType=VARCHAR},
- `status` = #{status,jdbcType=VARCHAR},
- user_no = #{userNo,jdbcType=VARCHAR},
- duty = #{duty,jdbcType=VARCHAR},
- district = #{district,jdbcType=VARCHAR},
- head_portrait_url = #{headPortraitUrl,jdbcType=VARCHAR},
- contact_mobile = #{contactMobile,jdbcType=VARCHAR},
- last_login_time = #{lastLoginTime,jdbcType=TIMESTAMP},
- open_id = #{openId,jdbcType=VARCHAR},
- `type` = #{type,jdbcType=INTEGER},
- reviewer = #{reviewer,jdbcType=VARCHAR}
- where id = #{id,jdbcType=VARCHAR}
- </update>
- <select id="selectAllAdmin" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List" />
- from admin
- where status !='锁定'
- <if test="depId != null">
- and department_id = #{depId,jdbcType=VARCHAR}
- </if>
- </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="selectRolesByPrimaryKey" parameterType="java.lang.String" resultType="com.goafanti.common.model.Role">
- 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','5','6')
- 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','5','6')
- 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')
- 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
- u.rid as rolesId, a.name,a.id, a.position
- from user_role u
- left join admin a on a.id =u.uid
- left join role r on r.id =u.rid
- where
- r.role_name='技术经纪专员'
- </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 provinceList.size > 0">
- and al.province in
- <foreach close=")" collection="provinceList" item="plist" open="(" separator=",">
- #{plist}
- </foreach>
- </if>
- <if test="cityList != null and cityList.size > 0">
- and al.city in
- <foreach close=")" collection="cityList" item="clist" open="(" separator=",">
- #{clist}
- </foreach>
- </if>
- </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.province,
- a.city,
- a.create_time as createTime,
- aa.name as superior,
- a.superior_id as superiorId,
- a.department_id as departmentId,
- date_format(a.last_login_time,'%Y-%m-%d %H:%i:%S') as lastLoginTime,
- dm.name as departmentName
- from admin a
- left join admin_location al on a.id = al.admin_id
- left join admin aa on aa.id = a.superior_id
- left join department dm on a.department_id = dm.id
- left join user_role x on x.uid=a.id
- left join `role` y on x.rid=y.id
- where a.id <![CDATA[ <> ]]> '1'
- <if test="roleName != null">
- where y.role_name= #{roleName,jdbcType=VARCHAR}
- </if>
- <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="province != null">
- and a.province = #{province,jdbcType=VARCHAR}
- </if>
- order by a.last_login_time ,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'
- left join `role` y on x.rid=y.id
- where a.id <![CDATA[ <> ]]> '1'
- <if test="roleName != null">
- where y.role_name= #{roleName,jdbcType=VARCHAR}
- </if>
- <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>
- <if test="province != null">
- and a.province = #{province,jdbcType=VARCHAR}
- </if>
- </select>
- <select id="listAdminByName" parameterType="java.lang.String" resultMap="BaseResultMap">
- select id,name from admin where status='正常' and name like concat('%',#{name},'%')
- </select>
- <!--*************************************************************************-->
- <select id="selectAdminListByPage" parameterType="java.lang.String" resultType="com.goafanti.admin.bo.AdminListBo">
- select x.*,y.name as departmentName from(select
- <!-- a.user_no as userNo, -->
- a.mobile, a.name,
- a.position, a.email, a.id,
- a.province,
- a.city,
- a.create_time as createTime,
- aa.name as superior,
- a.superior_id as superiorId,
- a.department_id as departmentId,
- a.last_login_time as lastLoginTime,
- a.contact_mobile as contactMobile,
- a.duty,a.status
- from admin a
- left join admin_location al on a.id = al.admin_id
- left join admin aa on aa.id = a.superior_id
- left join user_role ur on a.id=ur.uid
- left join `role` y on ur.rid=y.id
- where a.id <![CDATA[ <> ]]> '1'
- <if test="roleName != null">
- and y.role_name= #{roleName,jdbcType=VARCHAR}
- </if>
- <if test="name != null">
- and a.name like concat('%',#{name,jdbcType=VARCHAR},'%')
- </if>
- <if test="departmentId != null">
- and a.department_id = #{departmentId,jdbcType=VARCHAR}
- </if>
- <if test="rid != null">
- and ur.rid = #{rid,jdbcType=VARCHAR}
- </if>
- <if test="duty != null">
- and a.duty = #{duty,jdbcType=VARCHAR}
- </if>
- <if test="position != null">
- and a.position = #{position,jdbcType=VARCHAR}
- </if>
- <if test="status != null">
- and a.status = #{status,jdbcType=VARCHAR}
- </if>
- <if test="mobile != null">
- and a.mobile = #{mobile,jdbcType=VARCHAR}
- </if>
- <if test="superiorId != null">
- and a.superior_id = #{superiorId,jdbcType=VARCHAR}
- </if>
- group by a.id
- order by a.last_login_time,a.number )x left join department y on x.departmentId = y.id
- <if test="page_sql!=null">
- ${page_sql}
- </if>
- </select>
- <select id="selectAdminCount" parameterType="java.lang.String" resultType="java.lang.Integer">
- select count(t.counts)
- from(select a.id counts from (select a.id from admin a
- left join user_role ur on a.id=ur.uid
- left join `role` y on ur.rid=y.id
- where a.id <![CDATA[ <> ]]> '1'
- <if test="roleName != null">
- and y.role_name= #{roleName,jdbcType=VARCHAR}
- </if>
- <if test="name != null">
- and a.name like concat('%',#{name,jdbcType=VARCHAR},'%')
- </if>
- <if test="departmentId != null">
- and a.department_id = #{departmentId,jdbcType=VARCHAR}
- </if>
- <if test="rid != null">
- and ur.rid = #{rid,jdbcType=VARCHAR}
- </if>
- <if test="duty != null">
- and a.duty = #{duty,jdbcType=VARCHAR}
- </if>
- <if test="position != null">
- and a.position = #{position,jdbcType=VARCHAR}
- </if>
- <if test="status != null">
- and a.status = #{status,jdbcType=VARCHAR}
- </if>
- <if test="mobile != null">
- and a.mobile = #{mobile,jdbcType=VARCHAR}
- </if>
- <if test="superiorId != null">
- and a.superior_id = #{superiorId,jdbcType=VARCHAR}
- </if>
- )a
- group by a.id)t
- </select>
- <insert id="insertn" parameterType="com.goafanti.common.model.Admin">
- insert into admin (id, mobile, name,
- password, email, create_time,
- number, province, position, superior_id, city,department_id,status,user_no,duty,district,head_portrait_url,contact_mobile,type)
- 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},#{departmentId,jdbcType=VARCHAR},
- #{status,jdbcType=VARCHAR},#{userNo,jdbcType=VARCHAR},#{duty,jdbcType=VARCHAR},#{district,jdbcType=VARCHAR},#{headPortraitUrl,jdbcType=VARCHAR},#{contactMobile,jdbcType=VARCHAR},
- #{type})
- </insert>
- <select id="selectUserNoBySuperiorId" parameterType="java.lang.String" resultType="java.lang.String">
- select
- user_no as userNo
- from admin
- where
- id=#{superiorId,jdbcType=VARCHAR}
- </select>
- <select id="selectCountBySuperiorId" parameterType="java.lang.String" resultType="java.lang.Integer">
- select
- count(1)
- from admin
- where
- superior_id=#{superiorId,jdbcType=VARCHAR}
- </select>
- <select id="selectIdByUserNo" parameterType="java.lang.String" resultType="java.lang.String">
- select
- id
- from admin
- where
- user_no=#{UserNo,jdbcType=VARCHAR}
- </select>
- <select id="selectAllByid" parameterType="java.lang.String" resultType="com.goafanti.common.model.Admin">
- select a.id, a.mobile, a.name, a.`password`, a.email, a.create_time as createTime,
- a.province, a.`position`,a.reviewer , a.superior_id as superiorId,
- a.department_id as departmentId, a.status,a.user_no as userNo,a.duty,a.district,
- a.head_portrait_url as headPortraitUrl, a.contact_mobile as contactMobile,
- b.name superior,c.name reviewerName
- from admin a left join admin b on a.superior_id =b.id left join admin c on a.reviewer =c.id
- where a.id= #{id,jdbcType=VARCHAR}
- </select>
- <select id="selectNameByid" parameterType="java.lang.String" resultType="java.lang.String">
- select
- name
- from admin
- where
- id=#{id,jdbcType=VARCHAR}
- </select>
- <select id="selectRolesByUid" parameterType="java.lang.String" resultType="java.lang.String">
- select
- r.role_name as roles
- from user_role ur
- left join role r on r.id = ur.rid
- where
- uid=#{id,jdbcType=VARCHAR}
- </select>
- <select id="selectRolesIdByUid" parameterType="java.lang.String" resultType="java.lang.String">
- select
- rid as rolesId
- from user_role
- where
- uid=#{id,jdbcType=VARCHAR}
- </select>
- <select id="selectStatusByMobile" parameterType="java.lang.String" resultType="java.lang.String">
- select
- status
- from admin
- where
- mobile= #{mobile,jdbcType=VARCHAR}
- </select>
- <delete id="deleteById" parameterType="java.lang.String">
- delete from admin
- where id = #{id,jdbcType=VARCHAR}
- </delete>
- <select id="selectIDNBySuperiorId" parameterType="java.lang.String" resultType="com.goafanti.common.model.Admin">
- select id, mobile, name,
- password, email, create_time as createTime,
- province, position,
- superior_id as superiorId,department_id as departmentId,
- status,user_no as userNo,duty,district,head_portrait_url as headPortraitUrl
- from admin
- where
- superior_id=#{superiorId,jdbcType=VARCHAR}
- </select>
- <select id="selectUserNoById" resultType="java.lang.String">
- select user_no as userNo
- from admin
- where
- id=#{superiorId,jdbcType=VARCHAR}
- </select>
- <update id="updateByUserNo" parameterType="com.goafanti.common.model.Admin">
- update admin
- set user_no = #{userNo,jdbcType=VARCHAR}
- where
- id=#{id,jdbcType=VARCHAR}
- </update>
- <select id="selectIdBySuperiorId" parameterType="java.lang.String" resultType="java.lang.String">
- select id
- from admin
- where
- superior_id=#{superiorId,jdbcType=VARCHAR}
- </select>
- <select id="selectSubList" parameterType="java.lang.String" resultType="com.goafanti.admin.bo.AdminListBo">
- select
- a.id,
- a.user_no as userNo,
- a.mobile,
- a.name,
- a.position,
- b.name as departmentName
- from
- admin a left join department b on
- a.department_id = b.id
- where
- a.department_id =(
- select
- department_id
- from
- admin
- where
- id = #{adminId,jdbcType=VARCHAR}
- )
- and a.id <![CDATA[ <> ]]> #{adminId,jdbcType=VARCHAR}
- </select>
- <select id="selectAdminByRoleId" parameterType="java.lang.String" resultMap="BaseResultMap">
- select a.id,a.name from admin a left join user_role b on a.id = b.uid left join role c on b.rid = c.id where c.id = #{roleId,jdbcType=VARCHAR} limit 1
- </select>
- <select id="selectDepartmentStaff" parameterType="java.lang.String" resultType="com.goafanti.admin.bo.AdminListBo">
- select a.id ,a.name,a.password,a.department_id,b.name
- from admin a left join department b
- on a.department_id= b.id
- where 1=1
- <if test="departmentId != null and departmentId !='' ">
- and a.department_id = #{departmentId,jdbcType=VARCHAR}
- </if>
- <if test="name != null">
- and a.name like concat('%',#{name,jdbcType=VARCHAR},'%')
- </if>
- </select>
- <select id="selectAdminName" parameterType="java.lang.String" resultMap="BaseResultMap">
- select a.id, a.name from admin a left join user_role b on a.id=b.uid
- left join `role` c on b.rid=c.id
- where c.role_name = #{name,jdbcType=VARCHAR}
- </select>
- <update id="updateLockIds" parameterType="java.lang.String">
- update admin set status = '锁定' where id in (${lockIds})
- </update>
- <!-- 用户是为正常的 -->
- <select id="getCountById" parameterType="java.lang.String" resultType="java.lang.Integer">
- select count(a.id) from admin a
- inner join user_role ur on a.id=ur.uid
- where a.id= #{_parameter,jdbcType=VARCHAR} and ( a.status != '注销' or a.status is null)
- </select>
- <select id="getAdminRoleList" parameterType="java.lang.String" resultMap="BaseResultMap">
- select a.id, a.name from admin a left join user_role b on a.id=b.uid
- left join `role` c on b.rid=c.id
- where c.role_name = #{name,jdbcType=VARCHAR} and a.status='正常'
- </select>
- <select id="getDeptNameByAid" parameterType="java.lang.String" resultType="com.goafanti.admin.bo.AdminListBo">
- select a.id,a.name, d.name as departmentName,a.department_id departmentId,a.email,a.superior_id superiorId,a.open_id openId,
- a.reviewer,d.manager_id depManager
- from admin a left join department d on a.department_id = d.id
- where a.id = #{_parameter,jdbcType=VARCHAR}
- </select>
- <insert id="addAdminContacts" parameterType="com.goafanti.admin.bo.AdminContacts">
- insert into admin_contacts (id,aid,contacts_id)values
- (#{id,jdbcType=VARCHAR},#{aid,jdbcType=VARCHAR},#{contactsId,jdbcType=VARCHAR})
- </insert>
- <select id="frequentContactsList" parameterType="java.lang.String" resultType="com.goafanti.admin.bo.AdminListBo">
- select a.id,b.id as contactId,b.name,b.position,b.contact_mobile as contactMobile,c.name as departmentName,y.role_name as roleName
- from admin_contacts a left join admin b
- on a.contacts_id=b.id left join department c
- on c.id=b.department_id left join user_role x on x.uid=b.id
- left join `role` y on x.rid=y.id
- where b.status ='正常'
- <if test="roleName != null">
- and y.role_name= #{roleName,jdbcType=VARCHAR}
- </if>
- <if test="aid != null">
- and a.aid= #{aid,jdbcType=VARCHAR}
- </if>
- <if test="name != null">
- and b.name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
- </if>
- <if test="depId != null">
- and b.department_id= #{depId,jdbcType=VARCHAR}
- </if>
- <if test="page_sql!=null">
- ${page_sql}
- </if>
- </select>
- <select id="frequentContactsCount" parameterType="java.lang.String" resultType="java.lang.Integer">
- select count(*)
- from admin_contacts a left join admin b
- on a.contacts_id=b.id
- left join user_role x on x.uid=b.id
- left join `role` y on x.rid=y.id
- where b.status ='正常'
- <if test="roleName != null">
- and y.role_name= #{roleName,jdbcType=VARCHAR}
- </if>
- <if test="aid != null">
- and a.aid= #{aid,jdbcType=VARCHAR}
- </if>
- <if test="name != null">
- and b.name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
- </if>
- <if test="depId != null">
- and b.department_id= #{depId,jdbcType=VARCHAR}
- </if>
- </select>
- <delete id="deleteFrequentContacts" parameterType="java.lang.String">
- delete from admin_contacts
- where id = #{id,jdbcType=VARCHAR}
- </delete>
- <select id="getaidFrequentContacts" resultType="java.lang.String">
- select b.id from admin_contacts a left join admin b on a.contacts_id = b.id
- where b.status = '正常' and a.aid= #{id,jdbcType=VARCHAR}
- </select>
- <select id="selectAdminCustomerList" resultType="com.goafanti.admin.bo.AdminCustomerBo">
- select a.id as aid,a.name as aName,d.name as depName,ifnull(b.userCount,0) as userCount,ifnull(c.timeCount,0) as inputCount,
- ifnull(d.timeCount,0) as receiveCount,ifnull(g.timeCount,0) as signCount from admin a
- left join (select aid,count(aid) as userCount from user where aid is not null
- and share_type=0 and source !=0 and type=1
- group by aid) b on a.id=b.aid
- left join (select aid,count(aid) as timeCount from `user` where aid is not null
- and share_type in (0,2) and source =1 and type=1
- <if test="startTime != null and endTime != null">
- and transfer_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
- </if>
- group by aid) c on a.id=c.aid
- left join (select aid,count(aid) as timeCount from `user` where aid is not null
- and share_type in (0,2) and source =2 and type=1
- <if test="startTime != null and endTime != null">
- and transfer_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
- </if>
- group by aid) d on a.id=d.aid
- left join (select aid,count(aid) as timeCount from `user` where aid is not null
- and share_type =2 and type=1
- <if test="startTime != null and endTime != null">
- and transfer_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
- </if>
- group by aid) g on a.id=g.aid
- left join department d on a.department_id=d.id
- left join user_role e on a.id=e.uid
- left join `role` f on e.rid=f.id
- where f.role_name in ('营销员','营销经理')
- and a.status='正常'
- <if test="depId != null">
- and a.department_id = #{depId,jdbcType=VARCHAR}
- </if>
- <if test="page_sql!=null">
- ${page_sql}
- </if>
- </select>
- <select id="selectAdminCustomerCount" parameterType="java.lang.String" resultType="java.lang.Integer">
- select count(*) from admin a
- left join department d on a.department_id=d.id
- left join user_role e on a.id=e.uid
- left join `role` f on e.rid=f.id
- where f.role_name in ('营销员','营销经理')
- and a.status='正常'
- <if test="depId != null">
- and a.department_id = #{depId,jdbcType=VARCHAR}
- </if>
- </select>
- <select id="selectAdminCustomerDetailList" resultType="com.goafanti.admin.bo.AdminCustomerDetailBo">
- select a.id,a.nickname as name,a.source,c.contacts contacts,c.contact_mobile as contactMobile,c.contacts_dep contactsDep,
- c.contacts_position contactsPosition, a.create_time as createTime,b.last_follow_time as followTime,c.location_province locationProvince,
- c.location_city locationCity,c.location_area locationArea,c.business_scope businessScope , c.intended_project intendedProject
- from user a left join (select uid,last_follow_time from user_mid where aid= #{aid}) b on a.id=b.uid
- left join organization_identity c on a.id=c.uid
- <if test="type==5 or type==6">
- left join (select aid,uid from public_release where clock_in =1
- and aid= #{aid,jdbcType=VARCHAR}
- <if test="startTime != null and endTime != null">
- and clock_in_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
- </if>
- )e on a.id=e.uid
- </if>
- where a.type=1
- <if test="type != 5 and type !=6">
- and a.aid= #{aid,jdbcType=VARCHAR}
- </if>
- <if test="type == 5 or type ==6">
- and e.aid= #{aid,jdbcType=VARCHAR}
- </if>
- <if test="type == 0">
- and a.share_type = 0
- </if>
- <if test="type == 1">
- and a.share_type = 3
- </if>
- <if test="type ==0 or type==3 or type==5 or type==7">
- and a.channel=0
- </if>
- <if test="type == 1 or type==4 or type==6">
- and a.channel=1
- </if>
- <if test="type == 2">
- and a.share_type=2
- </if>
- <if test="type == 3 or type==4">
- and a.source=1
- and a.share_type = 0
- </if>
- <if test="type==7 ">
- and a.share_type = 0
- and a.source=2
- </if>
- <if test="type!=5 and type!=6">
- <if test="startTime != null and endTime != null">
- and a.transfer_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
- </if>
- </if>
- <if test="page_sql!=null">
- ${page_sql}
- </if>
- </select>
- <select id="selectAdminCustomerDetailCount" parameterType="java.lang.String" resultType="java.lang.Integer">
- select count(*)
- from user a
- <if test="type==5 or type==6">
- left join (select aid,uid from public_release where clock_in =1
- and aid= #{aid,jdbcType=VARCHAR}
- <if test="startTime != null and endTime != null">
- and clock_in_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
- </if>
- )e on a.id=e.uid
- </if>
- where a.type=1
- <if test="type != 5 and type !=6">
- and a.aid= #{aid,jdbcType=VARCHAR}
- </if>
- <if test="type == 5 or type ==6">
- and e.aid= #{aid,jdbcType=VARCHAR}
- </if>
- <if test="type == 0">
- and a.share_type = 0
- </if>
- <if test="type == 1">
- and a.share_type = 3
- </if>
- <if test="type ==0 or type==3 or type==5 or type==7">
- and a.channel=0
- </if>
- <if test="type == 1 or type==4 or type==6">
- and a.channel=1
- </if>
- <if test="type == 2">
- and a.share_type=2
- </if>
- <if test="type == 3 or type==4">
- and a.source=1
- and a.share_type = 0
- </if>
- <if test="type==7 ">
- and a.share_type = 0
- and a.source=2
- </if>
- <if test="type!=5 and type!=6">
- <if test="startTime != null and endTime != null">
- and a.transfer_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
- </if>
- </if>
- </select>
- <select id="listNameByDepAndName" resultType="java.lang.String">
- select a.id from admin a left join user_role b on a.id =b.uid
- left join `role` c on b.rid=c.id
- where department_id= #{depId}
- and c.role_name= #{roleName}
- </select>
- <select id="selectBySuperId" resultType="java.lang.String">
- select id from admin where superior_id= #{aid}
- </select>
- <select id="selectGetSuper" parameterType="java.lang.String" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List" />
- from admin
- where superior_id= #{aid}
- </select>
- <select id="selectFinanceAdminByOrderDep" resultType="com.goafanti.common.model.Admin">
- select a.finance_id id,b.name from department a left join admin b on a.finance_id=b.id
- where a.id= #{orderDep}
- </select>
- <select id="getPermission" resultType="java.lang.String">
- select c.role_type from admin a left join user_role b on a.id=b.uid left join `role` c on b.rid=c.id
- where a.id= #{transferId}
- </select>
- <select id="selectDepIdWithSpuerId" resultType="java.lang.String">
- select b.id from admin a right join department b on a.id=b.finance_id
- where a.superior_id= #{superId}
- </select>
- <select id="getAdminRoleListByAid" resultType="java.lang.String">
- select c.role_type from admin a left join user_role b on a.id=b.uid
- left join role c on b.rid =c.id
- where a.id= #{id}
- </select>
- <select id="selectByOpeid" parameterType="java.lang.String" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List" />
- from admin
- where open_id= #{openid}
- </select>
- <select id="getFinanceDep" resultType="java.lang.String">
- select id from department where finance_id = #{aid}
- </select>
- <select id="getLowerFinanceDep" resultType="java.lang.String">
- select b.id from admin a left join department b on a.id=b.finance_id
- where a.superior_id = #{aid}
- </select>
- </mapper>
|