Explorar o código

Accept Merge Request #202 mg : (test -> master)

Merge Request: mg
Created By: @Antiloveg
Accepted By: @Antiloveg
URL: https://coding.net/t/aft/p/AFT/git/merge/202
Antiloveg %!s(int64=8) %!d(string=hai) anos
pai
achega
3fe82d03bd

+ 9 - 0
schema/201707011-star.sql

@@ -0,0 +1,9 @@
+CREATE TABLE `star` (
+  `id` VARCHAR(36) NOT NULL,
+  `uid` VARCHAR(36) NOT NULL COMMENT '明星用户ID',
+  `hot` INT(1) NOT NULL DEFAULT 0 COMMENT '是否在首页显示(0--否,1--是)',
+  `star` INT(1) NOT NULL DEFAULT 0 COMMENT '是否在科技明星页显示(0--不显示,1--显示)',
+  `portal_url` VARCHAR(255) NULL COMMENT '个人主页URL',
+  PRIMARY KEY (`id`))
+ENGINE = InnoDB
+COMMENT = '科技明星';

+ 22 - 1
src/main/java/com/goafanti/common/mapper/UserMapper.xml

@@ -832,6 +832,27 @@
   </select>
   
   <select id="findStarCount" parameterType="String" resultType="java.lang.Integer">
-  
+  	select 
+  		count(1)
+  	from user u
+  	left join user_identity ui on ui.uid = u.id
+  	left join user_career uc on uc.uid = u.id
+  	where 
+  		ui.celebrity = 1
+  	<if test="number != null">
+  		and u.number = #{number,jdbcType=INTEGER}
+  	</if>
+  	<if test="engagedField != null">
+  		and uc.engaged_field like CONCAT(#{engagedField,jdbcType=VARCHAR},'%')
+  	</if>
+  	<if test="username != null">
+  		and ui.username like CONCAT('%',#{username,jdbcType=VARCHAR},'%')
+  	</if>
+  	<if test="professionalTitle != null">
+  		and uc.professional_title like CONCAT('%',#{professionalTitle,jdbcType=VARCHAR},'%')
+  	</if>
+  	<if test="workUnit != null">
+  		and uc.work_unit like CONCAT('%',#{workUnit,jdbcType=VARCHAR},'%')
+  	</if>
   </select>
 </mapper>