| | |
| | | @Table("announcement") |
| | | public class Announcement { |
| | | public enum AnnouncementType { |
| | | |
| | | home; |
| | | } |
| | | |
| | | |
| | |
| | | <id column="id" property="id" jdbcType="BIGINT"/> |
| | | <result column="identity_code" property="identityCode" jdbcType="VARCHAR"/> |
| | | <result column="app_id" property="appId" jdbcType="BIGINT"/> |
| | | <result column="type" property="type" jdbcType="VARCHAR"/> |
| | | <result column="name" property="name" jdbcType="VARCHAR"/> |
| | | <result column="`type`" property="type" jdbcType="VARCHAR"/> |
| | | <result column="`name`" property="name" jdbcType="VARCHAR"/> |
| | | <result column="content" property="content" jdbcType="VARCHAR"/> |
| | | <result column="link" property="link" jdbcType="VARCHAR"/> |
| | | <result column="close" property="close" jdbcType="BOOLEAN"/> |
| | | <result column="show" property="show" jdbcType="BOOLEAN"/> |
| | | <result column="`close`" property="close" jdbcType="BOOLEAN"/> |
| | | <result column="`show`" property="show" jdbcType="BOOLEAN"/> |
| | | <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/> |
| | | <result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">id,identity_code,app_id,type,name,content,link,close,show,create_time,update_time</sql> |
| | | <sql id="Base_Column_List">id,identity_code,app_id,`type`,`name`,content,link,`close`,`show`,create_time,update_time</sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select |
| | | <include refid="Base_Column_List"/>from announcement where id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | |
| | | </if> |
| | | |
| | | <if test="query.type!=null"> |
| | | and type=#{query.type} |
| | | and `type`=#{query.type} |
| | | </if> |
| | | |
| | | <if test="query.key!=null"> |
| | |
| | | <delete id="deleteByPrimaryKey" |
| | | parameterType="java.lang.Long">delete from announcement where id = #{id,jdbcType=BIGINT}</delete> |
| | | <insert id="insert" parameterType="com.ks.daylucky.pojo.DO.Announcement" useGeneratedKeys="true" |
| | | keyProperty="id">insert into announcement (id,identity_code,app_id,type,name,content,link,close,show,create_time,update_time) values (#{id,jdbcType=BIGINT},#{identityCode,jdbcType=VARCHAR},#{appId,jdbcType=BIGINT},#{type,jdbcType=VARCHAR},#{name,jdbcType=VARCHAR},#{content,jdbcType=VARCHAR},#{link,jdbcType=VARCHAR},#{close,jdbcType=BOOLEAN},#{show,jdbcType=BOOLEAN},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert> |
| | | keyProperty="id">insert into announcement (id,identity_code,app_id,`type`,`name`,content,link,`close`,show,create_time,update_time) values (#{id,jdbcType=BIGINT},#{identityCode,jdbcType=VARCHAR},#{appId,jdbcType=BIGINT},#{type,jdbcType=VARCHAR},#{name,jdbcType=VARCHAR},#{content,jdbcType=VARCHAR},#{link,jdbcType=VARCHAR},#{close,jdbcType=BOOLEAN},#{show,jdbcType=BOOLEAN},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert> |
| | | <insert id="insertSelective" parameterType="com.ks.daylucky.pojo.DO.Announcement" useGeneratedKeys="true" |
| | | keyProperty="id">insert into announcement |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">id,</if> |
| | | <if test="identityCode != null">identity_code,</if> |
| | | <if test="appId != null">app_id,</if> |
| | | <if test="type != null">type,</if> |
| | | <if test="name != null">name,</if> |
| | | <if test="type != null">`type`,</if> |
| | | <if test="name != null">`name`,</if> |
| | | <if test="content != null">content,</if> |
| | | <if test="link != null">link,</if> |
| | | <if test="close != null">close,</if> |
| | | <if test="close != null">`close`,</if> |
| | | <if test="show != null">show,</if> |
| | | <if test="createTime != null">create_time,</if> |
| | | <if test="updateTime != null">update_time,</if> |
| | |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" |
| | | parameterType="com.ks.daylucky.pojo.DO.Announcement">update announcement set identity_code = #{identityCode,jdbcType=VARCHAR},app_id = #{appId,jdbcType=BIGINT},type = #{type,jdbcType=VARCHAR},name = #{name,jdbcType=VARCHAR},content = #{content,jdbcType=VARCHAR},link = #{link,jdbcType=VARCHAR},close = #{close,jdbcType=BOOLEAN},show = #{show,jdbcType=BOOLEAN},create_time = #{createTime,jdbcType=TIMESTAMP},update_time = #{updateTime,jdbcType=TIMESTAMP} where id = #{id,jdbcType=BIGINT}</update> |
| | | parameterType="com.ks.daylucky.pojo.DO.Announcement">update announcement set identity_code = #{identityCode,jdbcType=VARCHAR},app_id = #{appId,jdbcType=BIGINT},`type` = #{type,jdbcType=VARCHAR},`name` = #{name,jdbcType=VARCHAR},content = #{content,jdbcType=VARCHAR},link = #{link,jdbcType=VARCHAR},`close` = #{close,jdbcType=BOOLEAN},show = #{show,jdbcType=BOOLEAN},create_time = #{createTime,jdbcType=TIMESTAMP},update_time = #{updateTime,jdbcType=TIMESTAMP} where id = #{id,jdbcType=BIGINT}</update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.ks.daylucky.pojo.DO.Announcement">update announcement |
| | | <set> |
| | | <if test="identityCode != null">identity_code=#{identityCode,jdbcType=VARCHAR},</if> |
| | | <if test="appId != null">app_id=#{appId,jdbcType=BIGINT},</if> |
| | | <if test="type != null">type=#{type,jdbcType=VARCHAR},</if> |
| | | <if test="name != null">name=#{name,jdbcType=VARCHAR},</if> |
| | | <if test="type != null">`type`=#{type,jdbcType=VARCHAR},</if> |
| | | <if test="name != null">`name`=#{name,jdbcType=VARCHAR},</if> |
| | | <if test="content != null">content=#{content,jdbcType=VARCHAR},</if> |
| | | <if test="link != null">link=#{link,jdbcType=VARCHAR},</if> |
| | | <if test="close != null">close=#{close,jdbcType=BOOLEAN},</if> |
| | | <if test="close != null">`close`=#{close,jdbcType=BOOLEAN},</if> |
| | | <if test="show != null">show=#{show,jdbcType=BOOLEAN},</if> |
| | | <if test="createTime != null">create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | |
| | | <resultMap id="BaseResultMap" type="com.ks.daylucky.pojo.DO.AppConfig"> |
| | | <id column="id" property="id" jdbcType="BIGINT"/> |
| | | <result column="app_id" property="appId" jdbcType="BIGINT"/> |
| | | <result column="name" property="name" jdbcType="VARCHAR"/> |
| | | <result column="key" property="key" jdbcType="VARCHAR"/> |
| | | <result column="value" property="value" jdbcType="VARCHAR"/> |
| | | <result column="`name`" property="name" jdbcType="VARCHAR"/> |
| | | <result column="`key`" property="key" jdbcType="VARCHAR"/> |
| | | <result column="`value`" property="value" jdbcType="VARCHAR"/> |
| | | <result column="min_version" property="minVersion" jdbcType="INTEGER"/> |
| | | <result column="remarks" property="remarks" jdbcType="VARCHAR"/> |
| | | <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/> |
| | | <result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/> |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | id, app_id, name, key, value, min_version, remarks, create_time, update_time |
| | | id, app_id, `name`, `key`, `value`, min_version, remarks, create_time, update_time |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long"> |
| | | select |
| | |
| | | </if> |
| | | |
| | | <if test="query.key!=null"> |
| | | and key=#{query.key} |
| | | and `key`=#{query.key} |
| | | </if> |
| | | |
| | | <if test="query.minVersion!=null"> |
| | |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" useGeneratedKeys="true" keyProperty="id" parameterType="com.ks.daylucky.pojo.DO.AppConfig"> |
| | | insert into app_config (id, app_id, name, |
| | | key, value, min_version, |
| | | insert into app_config (id, app_id, `name`, |
| | | `key`, `value`, min_version, |
| | | remarks, create_time, update_time |
| | | ) |
| | | values (#{id,jdbcType=BIGINT}, #{appId,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, |
| | |
| | | app_id, |
| | | </if> |
| | | <if test="name != null"> |
| | | name, |
| | | `name`, |
| | | </if> |
| | | <if test="key != null"> |
| | | key, |
| | | `key`, |
| | | </if> |
| | | <if test="value != null"> |
| | | value, |
| | | `value`, |
| | | </if> |
| | | <if test="minVersion != null"> |
| | | min_version, |
| | |
| | | app_id = #{appId,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="name != null"> |
| | | name = #{name,jdbcType=VARCHAR}, |
| | | `name` = #{name,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="key != null"> |
| | | key = #{key,jdbcType=VARCHAR}, |
| | | `key` = #{key,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="value != null"> |
| | | value = #{value,jdbcType=VARCHAR}, |
| | | `value` = #{value,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="minVersion != null"> |
| | | min_version = #{minVersion,jdbcType=INTEGER}, |
| | |
| | | <update id="updateByPrimaryKey" parameterType="com.ks.daylucky.pojo.DO.AppConfig"> |
| | | update app_config |
| | | set app_id = #{appId,jdbcType=BIGINT}, |
| | | name = #{name,jdbcType=VARCHAR}, |
| | | key = #{key,jdbcType=VARCHAR}, |
| | | value = #{value,jdbcType=VARCHAR}, |
| | | `name` = #{name,jdbcType=VARCHAR}, |
| | | `key` = #{key,jdbcType=VARCHAR}, |
| | | `value` = #{value,jdbcType=VARCHAR}, |
| | | min_version = #{minVersion,jdbcType=INTEGER}, |
| | | remarks = #{remarks,jdbcType=VARCHAR}, |
| | | create_time = #{createTime,jdbcType=TIMESTAMP}, |
New file |
| | |
| | | package com.ks.daylucky; |
| | | |
| | | import com.ks.daylucky.mapper.*; |
| | | import com.ks.daylucky.pojo.DO.Announcement; |
| | | import com.ks.daylucky.pojo.DO.UserMsg; |
| | | import com.ks.daylucky.query.*; |
| | | import org.junit.jupiter.api.Test; |
| | | import org.springframework.boot.test.context.SpringBootTest; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | @SpringBootTest |
| | | public class MapperTest { |
| | | |
| | | @Resource |
| | | private ActivityScanRecordMapper activityScanRecordMapper; |
| | | |
| | | @Resource |
| | | private ActivityTagMapper activityTagMapper; |
| | | |
| | | @Resource |
| | | private AnnouncementMapper announcementMapper; |
| | | |
| | | @Resource |
| | | private AppConfigMapper appConfigMapper; |
| | | |
| | | @Resource |
| | | private MsgTypeConfigMapper msgTypeConfigMapper; |
| | | |
| | | @Resource |
| | | private UserInfoExtraMapper userInfoExtraMapper; |
| | | |
| | | @Resource |
| | | private UserInfoMapper userInfoMapper; |
| | | |
| | | @Resource |
| | | private UserMsgMapper userMsgMapper; |
| | | |
| | | @Test |
| | | public void scanRecord() { |
| | | ActivityScanQuery query = new ActivityScanQuery(); |
| | | query.activityId = 1L; |
| | | query.uid = 1L; |
| | | query.count = 1; |
| | | |
| | | activityScanRecordMapper.list(query); |
| | | activityScanRecordMapper.count(query); |
| | | } |
| | | |
| | | @Test |
| | | public void activityTag() { |
| | | activityTagMapper.listByActivityId(1L); |
| | | } |
| | | |
| | | @Test |
| | | public void announcement() { |
| | | AnnouncementQuery query = new AnnouncementQuery(); |
| | | query.appId = 1L; |
| | | query.key = "测试"; |
| | | query.type = Announcement.AnnouncementType.home; |
| | | query.count = 1; |
| | | announcementMapper.list(query); |
| | | announcementMapper.count(query); |
| | | } |
| | | |
| | | |
| | | @Test |
| | | public void config() { |
| | | AppConfigQuery query = new AppConfigQuery(); |
| | | query.version = 10; |
| | | query.minVersion = 1; |
| | | query.key = "test"; |
| | | query.appId = 1L; |
| | | query.nameKey = "测试"; |
| | | appConfigMapper.list(query); |
| | | appConfigMapper.count(query); |
| | | } |
| | | |
| | | |
| | | @Test |
| | | public void msgTypeConfig() { |
| | | MsgTypeConfigQuery query = new MsgTypeConfigQuery(); |
| | | query.msgType = UserMsg.UserMsgType.activity; |
| | | query.appId = 1L; |
| | | query.count = 1; |
| | | |
| | | msgTypeConfigMapper.list(query); |
| | | msgTypeConfigMapper.count(query); |
| | | } |
| | | |
| | | |
| | | @Test |
| | | public void userInfoExtra() { |
| | | userInfoExtraMapper.selectByPrimaryKeyForUpdate(1L); |
| | | } |
| | | |
| | | @Test |
| | | public void userInfo() { |
| | | UserInfoQuery query = new UserInfoQuery(); |
| | | query.identifyCode = "123123"; |
| | | query.appId = 1L; |
| | | query.alipayUid = "123"; |
| | | query.key = "123"; |
| | | query.mobile = "1858318252"; |
| | | query.wxOpenId = "wx123123123"; |
| | | query.wxUnionId = "123123123123123"; |
| | | userInfoMapper.list(query); |
| | | userInfoMapper.count(query); |
| | | } |
| | | |
| | | |
| | | @Test |
| | | public void userMsg() { |
| | | UserMsgQuery query = new UserMsgQuery(); |
| | | query.uid = 1L; |
| | | query.msgType = UserMsg.UserMsgType.activity; |
| | | |
| | | userMsgMapper.list(query); |
| | | userMsgMapper.count(query); |
| | | } |
| | | |
| | | } |