统计代码
This commit is contained in:
@@ -0,0 +1,109 @@
|
||||
<?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="com.rzdata.web.mapper.DownloadCountMapper">
|
||||
|
||||
<resultMap type="DownloadCount" id="DownloadCountResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="toolId" column="tool_id" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createById" column="create_by_id" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateById" column="update_by_id" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="toolCode" column="tool_code" />
|
||||
<result property="toolName" column="tool_name" />
|
||||
<result property="toolDownNum" column="tool_down_num" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectDownloadCountVo">
|
||||
select id, tool_id, create_by, create_by_id, create_time, update_by, update_by_id, update_time from t_download_count
|
||||
</sql>
|
||||
|
||||
<select id="selectDownloadCountList" parameterType="DownloadCount" resultMap="DownloadCountResult">
|
||||
select
|
||||
tdc.tool_id,tl.tool_code,tl.tool_name,sum(1) as tool_down_num
|
||||
from t_download_count tdc
|
||||
left join t_tool tl on tdc.tool_id = tl.tool_id
|
||||
<where>
|
||||
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
|
||||
AND date_format(tdc.create_time,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d')
|
||||
</if>
|
||||
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
|
||||
AND date_format(tdc.create_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d')
|
||||
</if>
|
||||
</where>
|
||||
group by tdc.tool_id,tl.tool_code,tl.tool_name
|
||||
</select>
|
||||
|
||||
<select id="selectDownloadCountById" parameterType="String" resultMap="DownloadCountResult">
|
||||
<include refid="selectDownloadCountVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertDownloadCount" parameterType="DownloadCount">
|
||||
insert into t_download_count
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">id,</if>
|
||||
<if test="toolId != null">tool_id,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createById != null">create_by_id,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateById != null">update_by_id,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
<if test="toolId != null">#{toolId},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createById != null">#{createById},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateById != null">#{updateById},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateDownloadCount" parameterType="DownloadCount">
|
||||
update t_download_count
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="toolId != null">tool_id = #{toolId},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createById != null">create_by_id = #{createById},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateById != null">update_by_id = #{updateById},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteDownloadCountById" parameterType="String">
|
||||
delete from t_download_count where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteDownloadCountByIds" parameterType="String">
|
||||
delete from t_download_count where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
|
||||
<select id="userDownList" parameterType="DownloadCount" resultMap="DownloadCountResult">
|
||||
select
|
||||
tdc.tool_id,su.nick_name,t1.,sum(1) as tool_down_num
|
||||
from t_download_count tdc
|
||||
left join sys_user su on tdc.create_by_id = su.user_id
|
||||
<where>
|
||||
<if test="toolId != null and toolId != ''">
|
||||
AND tool_id = #{toolId}
|
||||
</if>
|
||||
</where>
|
||||
group by su.nick_name
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -193,4 +193,14 @@
|
||||
#{toolId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="countToolType" resultType="java.util.Map">
|
||||
select tool_type as types,sum(1) as statistics from t_tool where record_status != 'cancel' group by tool_type;
|
||||
</select>
|
||||
<select id="toolSource" resultType="java.util.Map">
|
||||
select tool_source as types,sum(1) as statistics from t_tool where record_status != 'cancel' group by tool_source;
|
||||
</select>
|
||||
<select id="recordStatus" resultType="java.util.Map">
|
||||
select record_status as types,sum(1) as statistics from t_tool where record_status != 'cancel' group by record_status;
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
115
tool-tech-admin/src/main/resources/mapper/TzMessageMapper.xml
Normal file
115
tool-tech-admin/src/main/resources/mapper/TzMessageMapper.xml
Normal file
@@ -0,0 +1,115 @@
|
||||
<?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="com.rzdata.web.mapper.TzMessageMapper">
|
||||
|
||||
<resultMap type="TzMessage" id="TzMessageResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="receiverId" column="receiver_id" />
|
||||
<result property="states" column="states" />
|
||||
<result property="content" column="content" />
|
||||
<result property="deleted" column="deleted" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="createById" column="create_by_id" />
|
||||
<result property="updateById" column="update_by_id" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectTzMessageVo">
|
||||
select id, receiver_id, states, content, deleted, create_by, create_time, update_by, update_time, remark,create_by_id,update_by_id from tz_message
|
||||
</sql>
|
||||
|
||||
<select id="selectTzMessageList" parameterType="TzMessage" resultMap="TzMessageResult">
|
||||
<include refid="selectTzMessageVo"/>
|
||||
<where>
|
||||
<if test="receiverId != null and receiverId != ''"> and receiver_id = #{receiverId}</if>
|
||||
<if test="states != null "> and states = #{states}</if>
|
||||
<if test="content != null and content != ''"> and content like concat('%', #{content}, '%')</if>
|
||||
<if test="createById != null and deleted != ''"> and create_by_id = #{createById}</if>
|
||||
and deleted = '0'
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectTzMessageById" parameterType="String" resultMap="TzMessageResult">
|
||||
<include refid="selectTzMessageVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertTzMessage" parameterType="TzMessage">
|
||||
insert into tz_message
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">id,</if>
|
||||
<if test="receiverId != null">receiver_id,</if>
|
||||
<if test="states != null">states,</if>
|
||||
<if test="content != null and content != ''">content,</if>
|
||||
<if test="deleted != null and deleted != ''">deleted,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
<if test="createById != null">create_by_id,</if>
|
||||
<if test="updateById != null">update_by_id,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
<if test="receiverId != null">#{receiverId},</if>
|
||||
<if test="states != null">#{states},</if>
|
||||
<if test="content != null and content != ''">#{content},</if>
|
||||
<if test="deleted != null and deleted != ''">#{deleted},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
<if test="createById != null">#{create_by_id},</if>
|
||||
<if test="updateById != null">#{update_by_id},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateTzMessage" parameterType="TzMessage">
|
||||
update tz_message
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="receiverId != null">receiver_id = #{receiverId},</if>
|
||||
<if test="states != null">states = #{states},</if>
|
||||
<if test="content != null and content != ''">content = #{content},</if>
|
||||
<if test="deleted != null and deleted != ''">deleted = #{deleted},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="createById != null">create_by_id = #{createById},</if>
|
||||
<if test="updateById != null">update_by_id = #{updateById},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteTzMessageById" parameterType="String">
|
||||
delete from tz_message where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteTzMessageByIds" parameterType="String">
|
||||
delete from tz_message where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<update id="updateAllMarkedRead" parameterType="TzMessage">
|
||||
update tz_message set states = '2' where create_by_id = #{createById}
|
||||
</update>
|
||||
|
||||
<!-- 批量插入 -->
|
||||
<insert id="batchInsert" parameterType="java.util.List">
|
||||
insert into tz_message (id, receiver_id, states, content, deleted, create_by, create_time
|
||||
values
|
||||
<foreach item="item" index="index" collection="tzMessageList" open="(" separator="),(" close=")">
|
||||
#{item.id}, #{item.receiverId}, #{item.states}, #{item.content}, #{item.deleted}, #{item.createBy}, #{item.createTime}
|
||||
</foreach>
|
||||
</insert>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user