Browse Source

更新sql

Signed-off-by: jiapeng.dong <jiapeng.dong@cloudcross.com>
jiapeng.dong 9 years ago
parent
commit
43a12b6ebc

+ 0 - 155
src/main/java/com/cloudcross/ssp/model/User.java

@@ -1,155 +0,0 @@
-package com.cloudcross.ssp.model;
-
-import java.util.Date;
-
-import com.cloudcross.ssp.web.widget.SelectorController.ISelector;
-
-
-/**
- * 用户表
- * <p/>
- * 与rv_users表相关。
- */
-public final class User implements ISelector {
-	// 主键
-	private Long id;
-	// 邮箱地址
-	private String email;
-	// 用户组ID
-	private Long userGroupId;
-	// 登录用户
-	private String username;
-	// 登录密码
-	private String password;
-	// 联系姓名
-	private String contactName;
-	// 联系电话
-	private String phone;
-	// 状态:活跃还是不活跃
-	private Integer status;
-	// 创建日期
-	private Date createDate;
-	// 更新日期
-	private Date modifyDate;
-	
-	/**
-	 * @return the id
-	 */
-	public Long getId() {
-		return id;
-	}
-	/**
-	 * @param id the id to set
-	 */
-	public void setId(Long id) {
-		this.id = id;
-	}
-	/**
-	 * @return the email
-	 */
-	public String getEmail() {
-		return email;
-	}
-	/**
-	 * @param email the email to set
-	 */
-	public void setEmail(String email) {
-		this.email = email;
-	}
-	/**
-	 * @return the username
-	 */
-	public String getUsername() {
-		return username;
-	}
-	/**
-	 * @param username the username to set
-	 */
-	public void setUsername(String username) {
-		this.username = username;
-	}
-	/**
-	 * @return the password
-	 */
-	public String getPassword() {
-		return password;
-	}
-	/**
-	 * @param password the password to set
-	 */
-	public void setPassword(String password) {
-		this.password = password;
-	}
-	/**
-	 * @return the status
-	 */
-	public Integer getStatus() {
-		return status;
-	}
-	/**
-	 * @param status the status to set
-	 */
-	public void setStatus(Integer status) {
-		this.status = status;
-	}
-	/**
-	 * @return the createDate
-	 */
-	public Date getCreateDate() {
-		return createDate;
-	}
-	/**
-	 * @param createDate the createDate to set
-	 */
-	public void setCreateDate(Date createDate) {
-		this.createDate = createDate;
-	}
-	/**
-	 * @return the modifyDate
-	 */
-	public Date getModifyDate() {
-		return modifyDate;
-	}
-	/**
-	 * @param modifyDate the modifyDate to set
-	 */
-	public void setModifyDate(Date modifyDate) {
-		this.modifyDate = modifyDate;
-	}
-	
-	public Long getUserGroupId() {
-		return userGroupId;
-	}
-	public void setUserGroupId(Long userGroupId) {
-		this.userGroupId = userGroupId;
-	}
-	public String getPhone() {
-		return phone;
-	}
-	public void setPhone(String phone) {
-		this.phone = phone;
-	}
-	public String getContactName() {
-		return contactName;
-	}
-	public void setContactName(String contactName) {
-		this.contactName = contactName;
-	}
-	@Override
-	public String toString() {
-		return "User [id=" + id + ", email=" + email + ", userGroupId="
-				+ userGroupId + ", username=" + username + ", password="
-				+ password + ", phone=" + phone + ", status=" + status
-				+ ", createDate=" + createDate + ", modifyDate=" + modifyDate
-				+ "]";
-	}
-	@Override
-	public String getLabel() {
-		return this.username;
-	}
-	@Override
-	public String getValue() {
-		return String.valueOf(this.id);
-	}
-	
-}

+ 1 - 1
src/main/java/com/cloudcross/ssp/model/mapper/rpt-zone-hour.sql.xml

@@ -2,7 +2,7 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
 <mapper namespace="rptZoneHourSqlMapper">
 	
-	<select id="findEveryHourData" parameterType="map" resultType="com.cloudcross.ssp.model.RptZoneHour">
+	<select id="findEveryHourDataBack" parameterType="map" resultType="com.cloudcross.ssp.model.RptZoneHour">
 		select hour,sum(pv) as pv,sum(uv) as uv, sum(impression) as impression, 
 		sum(uimpression) as uImpression,sum(uclick) as uClick,
 		sum(click) as click, sum(income) as income

+ 0 - 123
src/main/java/com/cloudcross/ssp/model/mapper/user.sql.xml

@@ -1,123 +0,0 @@
-<?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="userSqlMapper">
-	
-	<sql id="base_column">
-		user_id as id,
-		email_address as email,
-		username,
-		password,
-		default_account_id as userGroupId,
-		contact_name as contactName,
-		contact_phone as phone,
-		active as status,
-		date_created as createDate,
-		updated as modifyDate
-	</sql>
-	
-	<select id="selectByUsername"  parameterType="string" resultType="com.cloudcross.ssp.model.User">
-		select 
-		<include refid="base_column" />
-		from rv_users
-		<where>
-			username = #{username}
-		</where>
-		order by user_id  desc
-	</select>
-	
-	<select id="selectById" parameterType="int" resultType="com.cloudcross.ssp.model.User">
-		select 
-		<include refid="base_column" />
-		from rv_users
-		<where>
-			user_id = #{id} and
-			active != -1
-		</where>
-	</select>
-	
-	<select id="selectByUserGroupType" parameterType="string" resultType="com.cloudcross.ssp.model.User">
-		select
-		<include refid="base_column" />
-		from rv_users
-		<where>
-			exists(select account_id from rv_accounts where account_type=#{userGroupType} and
-			account_id=default_account_id) and
-			active != -1
-		</where>
-	</select>
-	
-	<select id="selectByParams"  parameterType="map" resultType="com.cloudcross.ssp.model.User">
-		select 
-		<include refid="base_column" />
-		from rv_users where active != -1
-		<if test="key!=null and value!=null">
-			<choose>
-				<when test="key=='username'">
-					and username like #{value}
-				</when>
-				<when test="key=='contactName'">
-					and contact_name like #{value}
-				</when>
-			</choose>	
-		</if>
-		<if test="userGroupType!=null">
-			and exists(
-				select account_id from rv_accounts 
-					where account_id=default_account_id and 
-					account_type=#{userGroupType})
-		</if>
-		order by  user_id   desc
-		limit #{pager.offset}, #{pager.limit}
-	</select>
-	
-	<select id="countByParams" parameterType="map" resultType="int">
-		select count(user_id)
-		from rv_users where active != -1
-		<if test="key!=null and value!=null">
-			<choose>
-				<when test="key=='username'">
-					and username like #{value}
-				</when>
-				<when test="key=='contactName'">
-					and contact_name like #{value}
-				</when>
-			</choose>	
-		</if>
-		<if test="userGroupType!=null">
-			and exists(
-				select account_id from rv_accounts 
-					where account_id=default_account_id and 
-					account_type=#{userGroupType})
-		</if>
-	</select>
-	
-	<insert id="addUser" parameterType="com.cloudcross.ssp.model.User">
-		insert into rv_users(username,password,contact_name,contact_phone,active,default_account_id,updated,date_created)
-		values(#{username},#{password},#{contactName},#{phone},#{status},#{userGroupId}, #{createDate},#{createDate})
-	</insert>
-	
-	<update id="editUser" parameterType="com.cloudcross.ssp.model.User">
-		update rv_users 
-		set username=#{username},
-		<if test="password !=null ">
-			password=#{password},
-		</if>
-			contact_name=IFNULL(#{contactName},default(contact_name)),
-			contact_phone=IFNULL(#{phone},default(contact_phone)),
-		  <if test="status !=null">
-			active=#{status},
-			</if>
-			updated=#{modifyDate} 
-		where user_id=#{id}
-	</update>
-	
-	<update id="updateUserStatus" parameterType="HashMap">
-		update rv_users 
-			set active = #{status},updated = #{modifyDate}
-			where user_id in
-			<foreach item="userId" collection="userIdList"
-		      open="(" separator="," close=")">
-		        #{userId}
-			</foreach>
-	</update>
-</mapper>

+ 8 - 8
src/main/java/com/cloudcross/ssp/model/mapper/wifi.sql.xml

@@ -25,7 +25,7 @@
 		latitude
 	</sql>
 	
-	<select id="countByParams" parameterType="map" resultType="int">
+	<select id="countByParamsOperator" parameterType="map" resultType="int">
 		select count(w.id) from t_wifi w, t_location l
 		<where>
 			w.location = l.location and w.status != -1 and w.operator_id = #{operatorId}
@@ -137,7 +137,7 @@
 	</insert>
 	
 
-	<select id="findAddressAdvertiser" parameterType="map" resultType="com.cloudcross.ssp.advertiser.model.Wifi">
+	<select id="findAddress" parameterType="map" resultType="com.cloudcross.ssp.advertiser.model.Wifi">
        select 
 		<include refid="base_column2" />
 		from t_wifi where 1 = 1
@@ -151,7 +151,7 @@
 		order by  id				
 	</select>
 	
-  	<select id="findWifiAdvertiser" parameterType="map" resultType="com.cloudcross.ssp.advertiser.model.Wifi">
+  	<select id="findWifi" parameterType="map" resultType="com.cloudcross.ssp.advertiser.model.Wifi">
        select 
        <include refid="base_column2" />
        from t_wifi where location in (select location from t_wifi where location = #{location})
@@ -159,13 +159,13 @@
        and longitude &lt;= #{maxlng}	and longitude &gt;= #{minlng}			
 	</select>
 	
-	<select id="findLocationAdvertiser" parameterType="String" resultType="com.cloudcross.ssp.advertiser.model.Wifi">
+	<select id="findLocation" parameterType="String" resultType="com.cloudcross.ssp.advertiser.model.Wifi">
        select 
        <include refid="base_column2" />
        from t_wifi where location = #{location}			
 	</select>
 	
-	<select id="findAllAdgroupWifiAdvertiser" parameterType="Long" resultType="com.cloudcross.ssp.advertiser.model.Wifi">
+	<select id="findAllAdgroupWifi" parameterType="Long" resultType="com.cloudcross.ssp.advertiser.model.Wifi">
        select 
        <include refid="base_column2" />
        from t_wifi where id in (select wifi_id from t_adgroup_wifi where adgroup_id = #{adGroupId})
@@ -173,17 +173,17 @@
 	</select>
 	
 	
-	<insert id="addAdgroupWifiAdvertiser" parameterType="map">
+	<insert id="addAdgroupWifi" parameterType="map">
 		insert into
 		t_adgroup_wifi (adgroup_id,wifi_id)
 		values (#{adGroupId},#{wifiId})
 	</insert>
 	
-	<delete id="deleteAdgroupWifiAdvertiser" parameterType="long"> 
+	<delete id="deleteAdgroupWifi" parameterType="long"> 
 	delete from t_adgroup_wifi where adgroup_id = #{adGroupId} 
 	</delete>
 	
-	<select id="selectByParamsAdvertiser"  parameterType="map" resultType="com.cloudcross.ssp.advertiser.model.Wifi">
+	<select id="selectByParams"  parameterType="map" resultType="com.cloudcross.ssp.advertiser.model.Wifi">
 		select 
 		<include refid="base_column2" />
 		from t_wifi where 1 = 1

+ 2 - 2
src/main/java/com/cloudcross/ssp/model/mapper/zone.sql.xml

@@ -22,7 +22,7 @@
 		select * from t_zone where id=#{zoneId}
 	</select>
 	
-	 <select id="selectById"  parameterType="int" resultType="com.cloudcross.ssp.model.Zone">
+	 <select id="selectByIdOperator"  parameterType="int" resultType="com.cloudcross.ssp.model.Zone">
 		select *
 		from t_zone 
 		<where>
@@ -193,7 +193,7 @@
       </select>
       
       <!-- add by Wanfu for banner-audit -->
-      <select id="findByOperatorId" resultType="com.cloudcross.ssp.model.Zone" parameterType="int">
+      <select id="findByOperatorIdOperator" resultType="com.cloudcross.ssp.model.Zone" parameterType="int">
            select * from t_zone where operator_id = #{operatorId} and recheck = 1 and status=0
       </select>
       

+ 0 - 22
src/main/java/com/cloudcross/ssp/service/IUserService.java

@@ -1,22 +0,0 @@
-package com.cloudcross.ssp.service;
-
-import java.util.List;
-
-import com.cloudcross.ssp.base.service.IGenericService;
-import com.cloudcross.ssp.model.User;
-import com.cloudcross.ssp.model.UserGroup;
-
-/**
- * 用户服务接口定义。
- * 
- * @author qaohao
- */
-public interface IUserService extends IGenericService<User> {
-	User findByUsername(String username);
-
-	boolean add(String userGroupType, User user);
-	
-	List<User> findByUserGroupType(String userGroupType);
-	
-	UserGroup findUserGroupById(Long userGroupId);
-}