123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472 |
- <?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="accountSqlMapper">
- <!--mybatis ehcache缓存配置 -->
- <!-- 以下两个<cache>标签二选一,第一个可以输出日志,第二个不输出日志 <cache type="org.mybatis.caches.ehcache.LoggingEhcache"
- /> -->
- <!-- <cache type="org.mybatis.caches.ehcache.EhcacheCache"/> -->
- <!-- 以下与实体类的中字段一致 -->
- <sql id="selectId">
- id,
- name as accountName,
- (select group_concat(name) from t_ly_role
- where t_ly_role.id
- in (SELECT role_id FROM t_acc_role WHERE
- acc_id=t_account.id) ) roleName,
- password,
- description,
- state,
- create_time as createTime,
- real_name as realName,
- tel,
- type,
- operator_id as operatorId,
- agent_id as agentId,
- advertiser_id as advertiserId,
- sys_type as sysType
- </sql>
- <!--resultType="Account" 每返回一条结果封装到Account里 -->
- <select id="queryAll" resultType="com.cloudcross.ssp.model.Account" parameterType="com.cloudcross.ssp.model.Account">
- select
- <include refid="selectId" />
- from t_account
- <where>
- <if test="accountName != null and accountName != ''">
- name like '%${accountName}%'
- </if>
- </where>
- </select>
-
- <select id="selectByParams" parameterType="map" resultType="com.cloudcross.ssp.model.Account">
- select id,
- name as accountName,
- real_name as realName,tel,state,create_time as createTime
- from t_account
- where deletestatus != -1
- and operator_id = 0
- and agent_id = 0
- and advertiser_id = 0
- <if test="value!=null">
- and ( t_account.name like #{value}
- or t_account.real_name like #{value} )
- </if>
- and id != #{loginAccount.id}
- and sys_type = #{loginAccount.sysType}
- order by id desc
- limit #{pager.offset}, #{pager.limit}
- </select>
- <select id="selectByParamsOperator" parameterType="map" resultType="com.cloudcross.ssp.model.Account">
- select id,
- name as accountName,
- real_name as realName,tel,state,create_time as createTime
- from t_account
- where deletestatus != -1
- and operator_id = #{loginAccount.operatorId}
- and id != #{loginAccount.id}
- <if test="value!=null">
- and ( t_account.name like #{value}
- or t_account.real_name like #{value} )
- </if>
- and sys_type = #{loginAccount.sysType}
- order by id desc
- limit #{pager.offset}, #{pager.limit}
- </select>
- <select id="selectByParamsAdvertiser" parameterType="map" resultType="com.cloudcross.ssp.model.Account">
- select id,
- name as accountName,
- real_name as realName,tel,state,create_time as createTime
- from t_account
- where deletestatus != -1
- and agent_id = #{loginAccount.agentId}
- <if test="value!=null">
- and ( t_account.name like #{value}
- or t_account.real_name like #{value} )
- </if>
- and id != #{loginAccount.id}
- and sys_type = #{loginAccount.sysType}
- <if test="loginAccount.advertiserId != 0 ">
- and advertiser_id = #{loginAccount.advertiserId}
- </if>
- order by id desc
- limit #{pager.offset}, #{pager.limit}
- </select>
- <select id="countByParams" parameterType="map" resultType="int">
- select count(id)
- from t_account
- where deletestatus != -1
- and operator_id = 0
- and agent_id = 0
- and advertiser_id = 0
- <if test="value!=null">
- and ( t_account.name like #{value}
- or t_account.real_name like #{value} )
- </if>
- and id != #{loginAccount.id}
- and sys_type = #{loginAccount.sysType}
- </select>
-
- <select id="countByParamsOperator" parameterType="map" resultType="int">
- select count(id)
- from t_account
- where deletestatus != -1
- and operator_id = #{loginAccount.operatorId}
- <if test="value!=null">
- and ( t_account.name like #{value}
- or t_account.real_name like #{value} )
- </if>
- and id != #{loginAccount.id}
- and sys_type = #{loginAccount.sysType}
- </select>
- <select id="countByParamsAdvertiser" parameterType="map" resultType="int">
- select count(id)
- from t_account
- where deletestatus != -1
- and agent_id = #{loginAccount.agentId}
- <if test="value!=null">
- and ( t_account.name like #{value}
- or t_account.real_name like #{value} )
- </if>
- and id != #{loginAccount.id}
- and sys_type = #{loginAccount.sysType}
- <if test="loginAccount.advertiserId != 0 ">
- and advertiser_id = #{loginAccount.advertiserId}
- </if>
- </select>
- <select id="isExist" resultType="com.cloudcross.ssp.model.Account" parameterType="String">
- select
- <include refid="selectId" />
- from t_account
- where name = #{accountName}
- </select>
- <!--resultType="Account" 每返回一条结果封装到Account里 -->
- <select id="query" resultType="com.cloudcross.ssp.model.Account" parameterType="java.util.HashMap">
- select
- <include refid="selectId" />
- from t_account
- <where>
- <if test="t.accountName != null and t.accountName != ''">
- name like '%${t.accountName}%'
- </if>
- </where>
- </select>
- <select id="queryNoMatch" resultType="com.cloudcross.ssp.model.Account" parameterType="java.util.HashMap">
- select
- a.id,
- a.name,
- a.password,
- a.accountType,
- a.description,
- a.state,
- a.createTime,
- (SELECT dp.name from department dp where dp.id =
- d.subdep_id) depName
- from account a LEFT JOIN dep_account d on
- a.id=d.account_id
- <where>
- <if test="t.accountName != null and t.accountName != ''">
- name like '%${t.accountName}%'
- </if>
- </where>
- </select>
-
- <!-- 增加用户 -->
- <insert id="add" parameterType="com.cloudcross.ssp.model.Account">
- insert into t_account (
- name,
- password,
- description,
- state )
- values (#{accountName},
- #{password}, #{description},
- #{state})
- </insert>
- <!-- 增加用户 -->
- <insert id="addAccount" parameterType="com.cloudcross.ssp.model.Account" useGeneratedKeys="true" keyProperty="id">
- insert into t_account
- (name,
- password,
- real_name,
- tel,
- description,
- state,
- sys_type,
- type) values (#{accountName}, #{password},#{realName},
- #{tel},#{description},#{state},#{sysType},#{type})
- </insert>
- <!-- 增加用户 -->
- <insert id="addAccountOperator" parameterType="com.cloudcross.ssp.model.Account">
- insert into t_account
- (name,
- password,
- real_name,
- tel,
- operator_id,
- description,
- state,
- sys_type ) values (#{accountName}, #{password},#{realName},
- #{tel},#{operatorId},#{description},#{state},#{sysType})
- </insert>
- <!-- 增加用户 -->
- <insert id="addAccountAdvertiser" parameterType="com.cloudcross.ssp.model.Account" useGeneratedKeys="true" keyProperty="id">
- insert into t_account
- (name,
- password,
- real_name,
- tel,
- agent_id,
- advertiser_id,
- operator_id,
- description,
- state,
- sys_type ) values (#{accountName}, #{password},#{realName},
- #{tel},#{agentId},#{advertiserId},#{operatorId},#{description},#{state},#{sysType})
- </insert>
- <delete id="delete" parameterType="String">
- delete from t_account where
- id=#{id}
- </delete>
- <select id="getById" parameterType="String" resultType="com.cloudcross.ssp.model.Account">
- select
- id,
- name as accountName,
- (select group_concat(name) from t_ly_role
- where t_ly_role.id
- in (SELECT role_id FROM t_acc_role WHERE
- acc_id=t_account.id) ) roleName,
- password,
- real_name as realName,
- tel,
- description,
- state,
- create_time as createTime,
- type,
- operator_id as operatorId,
- agent_id as agentId,
- advertiser_id as advertiserId,
- sys_type as sysType
- from t_account where id=#{id}
- </select>
- <update id="updateAccountStatus" parameterType="HashMap">
- update t_account
- set state=#{state}
- where t_account.id in
- <foreach item="accountId" collection="accountIdList"
- open="(" separator="," close=")">
- #{accountId}
- </foreach>
- </update>
-
- <update id="editAccount" parameterType="com.cloudcross.ssp.model.Account">
- update t_account
- <set>
- <if test="accountName != null and accountName != ''">
- name=#{accountName},
- </if>
- <if test="password != null and password != ''">
- password=#{password},
- </if>
- <if test="description != null and description != ''">
- description=#{description},
- </if>
- <if test="state != null and state != ''">
- state=#{state},
- </if>
- <if test="createTime != null and createTime != ''">
- create_time=#{createTime},
- </if>
- <if test="realName != null and realName != ''">
- real_name=#{realName},
- </if>
- <if test="tel != null and tel != ''">
- tel=#{tel},
- </if>
- <if test="operatorId != null and operatorId != 0">
- operator_id=#{operatorId},
- </if>
- <if test="agentId != null and agentId !=0">
- agent_id=#{agentId},
- </if>
- <if test="advertiserId != null and advertiserId !=0">
- advertiser_id=#{advertiserId},
- </if>
- </set>
- where id=#{id}
- </update>
-
-
- <update id="editAccountOperator" parameterType="com.cloudcross.ssp.model.Account">
- update t_account
- <set>
- <if test="accountName != null and accountName != ''">
- name=#{accountName},
- </if>
- <if test="password != null and password != ''">
- password=#{password},
- </if>
- <if test="description != null and description != ''">
- description=#{description},
- </if>
- <if test="state != null and state != ''">
- state=#{state},
- </if>
- <if test="createTime != null and createTime != ''">
- createTime=#{createTime},
- </if>
- <if test="realName != null and realName != ''">
- real_name=#{realName},
- </if>
- <if test="tel != null and tel != ''">
- tel=#{tel}
- </if>
- </set>
- where id=#{id}
- </update>
-
- <update id="editAccountAdvertiser" parameterType="com.cloudcross.ssp.model.Account">
- update t_account
- <set>
- <if test="accountName != null and accountName != ''">
- name=#{accountName},
- </if>
- <if test="password != null and password != ''">
- password=#{password},
- </if>
- <if test="description != null and description != ''">
- description=#{description},
- </if>
- <if test="state != null and state != ''">
- state=#{state},
- </if>
- <if test="createTime != null and createTime != ''">
- createTime=#{createTime},
- </if>
- <if test="realName != null and realName != ''">
- real_name=#{realName},
- </if>
- <if test="tel != null and tel != ''">
- tel=#{tel},
- </if>
- <if test="advertiserId != null">
- advertiser_id=#{advertiserId}
- </if>
- </set>
- where id=#{id}
- </update>
-
-
- <update id="update" parameterType="com.cloudcross.ssp.model.Account">
- update t_account
- <set>
- <if test="accountName != null and accountName != ''">
- name=#{accountName},
- </if>
- <if test="password != null and password != ''">
- password=#{password},
- </if>
- <if test="description != null and description != ''">
- description=#{description},
- </if>
- <if test="state != null and state != ''">
- state=#{state},
- </if>
- <if test="createTime != null and createTime != ''">
- create_time=#{createTime},
- </if>
- <if test="realName != null and realName != ''">
- real_name=#{realName},
- </if>
- <if test="tel != null and tel != ''">
- tel=#{tel}
- </if>
- </set>
- where id=#{id}
- </update>
- <!-- 验证用户登陆 -->
- <select id="countAccount" parameterType="com.cloudcross.ssp.model.Account" resultType="com.cloudcross.ssp.model.Account">
- select
- <include refid="selectId" />
- from t_account where
- name=#{accountName} and password=#{password}
- </select>
- <!-- 根据用户名查出id -->
- <select id="querySingleAccount" parameterType="String"
- resultType="com.cloudcross.ssp.model.Account">
- select
- <include refid="selectId" />
- from t_account where name=#{accountName}
- </select>
-
- <select id="findExcelAccount" parameterType="map" resultType="com.cloudcross.ssp.model.Account">
- select id,
- name as accountName,
- real_name as realName,tel,state,create_time as createTime
- from t_account
- where deletestatus != -1
- and operator_id = 0
- and agent_id = 0
- and advertiser_id = 0
- <if test="value!=null">
- and ( t_account.name like #{value}
- or t_account.real_name like #{value} )
- </if>
- and id != #{loginAccount.id}
- and sys_type = #{loginAccount.sysType}
- order by id desc
- </select>
-
-
- <select id="findExcelAccountsOperator" parameterType="map" resultType="com.cloudcross.ssp.model.Account">
- select id,
- name as accountName,
- real_name as realName,tel,state,create_time as createTime
- from t_account
- where deletestatus != -1
- and operator_id = #{loginAccount.operatorId}
- and id != #{loginAccount.id}
- <if test="value!=null">
- and ( t_account.name like #{value}
- or t_account.real_name like #{value} )
- </if>
- and sys_type = #{loginAccount.sysType}
- order by id desc
- </select>
-
-
- <select id="findExcelAccountsAdvertiser" parameterType="map" resultType="com.cloudcross.ssp.model.Account">
- select id,
- name as accountName,
- real_name as realName,tel,state,create_time as createTime
- from t_account
- where deletestatus != -1
- and agent_id = #{loginAccount.agentId}
- and id != #{loginAccount.id}
- <if test="value!=null">
- and ( t_account.name like #{value}
- or t_account.real_name like #{value} )
- </if>
- and sys_type = #{loginAccount.sysType}
- <if test="loginAccount.advertiserId != 0 ">
- and advertiser_id = #{loginAccount.advertiserId}
- </if>
- order by id desc
- </select>
- </mapper>
|