You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
97 lines
3.4 KiB
97 lines
3.4 KiB
package com.example.demo.mapper;
|
|
|
|
|
|
import com.example.demo.domain.entity.User;
|
|
import com.example.demo.domain.vo.UserVo;
|
|
import org.apache.ibatis.annotations.Mapper;
|
|
import org.apache.ibatis.annotations.Select;
|
|
import org.apache.ibatis.annotations.Update;
|
|
|
|
import java.math.BigDecimal;
|
|
import java.util.List;
|
|
|
|
@Mapper
|
|
public interface UserMapper {
|
|
@Select({
|
|
"<script>",
|
|
"select * from user",
|
|
"<where>",
|
|
"<if test='jwcode!=null and jwcode.length>0'>and jwcode=#{jwcode}</if>",
|
|
"</where>",
|
|
"</script>"
|
|
})
|
|
User select(String user);
|
|
@Select({
|
|
"<script>",
|
|
"select * from user",
|
|
"<where>",
|
|
"<if test='jwcode!=null and jwcode.length>0'>and jwcode=#{jwcode}</if>",
|
|
"</where>",
|
|
"</script>"
|
|
})
|
|
User get(String jwcode);
|
|
|
|
@Select({
|
|
"SELECT\n" +
|
|
" u.*,\n" +
|
|
" MIN(d.create_time) AS first_recharge_date, \n" +
|
|
" SUM(CASE WHEN d.update_type = '充值' THEN d.recharge_coin ELSE 0 END) AS total_recharge_gold, \n" +
|
|
" SUM(CASE WHEN d.update_type = '消费' THEN d.recharge_coin ELSE 0 END) AS total_spend_gold, \n" +
|
|
" COUNT(CASE WHEN d.update_type = '充值' THEN 1 END) AS recharge_times, \n" +
|
|
" COUNT(CASE WHEN d.update_type = '消费' THEN 1 END) AS spend_times, \n" +
|
|
" COUNT(CASE WHEN a.status = 0 AND d.update_type = '充值' THEN 1 END) AS pending_recharge_times, \n" +
|
|
" COUNT(CASE WHEN a.status = 0 AND d.update_type = '消费' THEN 1 END) AS pending_spend_times \n" +
|
|
"FROM\n" +
|
|
" user u\n" +
|
|
"LEFT JOIN\n" +
|
|
" detail d ON u.jwcode = d.jwcode\n" +
|
|
"LEFT JOIN\n" +
|
|
" audit a ON d.detail_id = a.detail_id AND a.audit_flag = 1\n" +
|
|
"WHERE\n" +
|
|
" d.detail_flag = 1 AND u.jwcode =#{jwcode}\n" +
|
|
"GROUP BY\n" +
|
|
" u.jwcode, u.name"
|
|
})
|
|
List<UserVo> selectA(UserVo userVo);
|
|
|
|
@Select({
|
|
"<script>",
|
|
"select * from user",
|
|
"<where>",
|
|
"<if test='jwcode!=null and jwcode.length>0'>and jwcode=#{jwcode}</if>",
|
|
"</where>",
|
|
"</script>"
|
|
})
|
|
List<User> selectAll(User user);
|
|
@Select({
|
|
"select * from user where name=#{name}"
|
|
})
|
|
User selectByName(String name);
|
|
|
|
@Update({
|
|
"<script>",
|
|
"update user",
|
|
"<set>",
|
|
"<if test='buyJb!=null'>buy_jb=#{buyJb},</if>",
|
|
"<if test='coreJb!=null'>core_jb=#{coreJb},</if>",
|
|
"<if test='free6!=null'>free_6=#{free6},</if>",
|
|
"<if test='free12!=null'>free_12=#{free12},</if>",
|
|
"</set>",
|
|
"where jwcode=#{jwcode}",
|
|
"</script>",
|
|
})
|
|
int update(User user);
|
|
|
|
// //去掉免费金币,先去6个月,再去12月
|
|
// @Update({
|
|
// "<script>",
|
|
// "update user",
|
|
// "<set>",
|
|
// "<if test='Free6!=null'>free_6=#{Free6},</if>",
|
|
// "<if test='Free12!=null'>free_12=#{Free12},</if>",
|
|
// "</set>",
|
|
// "where jwcode=#{jwcode}",
|
|
// "</script>",
|
|
// })
|
|
// int updatecoin();
|
|
}
|