修改页面和接口

This commit is contained in:
liuwu 2023-09-18 16:40:55 +08:00
parent 654c8acf77
commit 7aacecfe6c
7 changed files with 562 additions and 3 deletions

View File

@ -3,16 +3,16 @@ package com.cyx.web.base.controller;
import com.cyx.common.core.controller.BaseController; import com.cyx.common.core.controller.BaseController;
import com.cyx.common.core.domain.AjaxResult; import com.cyx.common.core.domain.AjaxResult;
import com.cyx.common.core.domain.entity.SysUser; import com.cyx.common.core.domain.entity.SysUser;
import com.cyx.common.core.page.TableDataInfo; import com.cyx.common.json.JSONObject;
import com.cyx.web.base.domain.TAmentAdvancedDept; import com.cyx.web.base.domain.TAmentAdvancedDept;
import com.cyx.web.base.domain.TAmentAdvancedParty; import com.cyx.web.base.domain.TAmentAdvancedParty;
import com.cyx.web.base.domain.TAmentPartyAffairs; import com.cyx.web.base.domain.TAmentPartyAffairs;
import com.cyx.web.base.domain.TAmentTrade;
import com.cyx.web.base.service.ITAmentAdvancedDeptService; import com.cyx.web.base.service.ITAmentAdvancedDeptService;
import com.cyx.web.base.service.ITAmentAdvancedPartyService; import com.cyx.web.base.service.ITAmentAdvancedPartyService;
import com.cyx.web.base.service.ITAmentPartyAffairsService; import com.cyx.web.base.service.ITAmentPartyAffairsService;
import org.apache.shiro.authz.annotation.RequiresPermissions; import com.cyx.web.base.service.ITAmentTradeService;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
@ -122,6 +122,27 @@ public class BigScreenController extends BaseController {
return AjaxResult.success(list); return AjaxResult.success(list);
} }
@Resource
private ITAmentTradeService tAmentTradeService;
@PostMapping("/tradeEcharts")
@ResponseBody
public AjaxResult tradeEcharts(TAmentTrade tAmentTrade)
{
int yearCount = 0;
double yearMoney = 0.0000;
JSONObject object = new JSONObject();
List<Map<String,Object>> list = tAmentTradeService.tradeEcharts(tAmentTrade);
for (int i=0;i<list.size();i++){
yearCount+=Integer.parseInt(list.get(i).get("count").toString());
yearMoney+=Double.parseDouble(list.get(i).get("trade").toString());
}
object.put("list",list);
object.put("yearCount",yearCount);
object.put("yearMoney",yearMoney);
return AjaxResult.success(object);
}
/** /**
* 先进成员 * 先进成员
* @param pa * @param pa

View File

@ -0,0 +1,128 @@
package com.cyx.web.base.controller;
import java.util.List;
import com.cyx.common.annotation.Log;
import com.cyx.common.core.controller.BaseController;
import com.cyx.common.core.domain.AjaxResult;
import com.cyx.common.core.page.TableDataInfo;
import com.cyx.common.enums.BusinessType;
import com.cyx.common.utils.poi.ExcelUtil;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.cyx.web.base.domain.TAmentTrade;
import com.cyx.web.base.service.ITAmentTradeService;
/**
* 交易数据Controller
*
* @author ruoyi
* @date 2023-09-18
*/
@Controller
@RequestMapping("/base/trade")
public class TAmentTradeController extends BaseController
{
private String prefix = "base/trade";
@Autowired
private ITAmentTradeService tAmentTradeService;
@RequiresPermissions("base:trade:view")
@GetMapping()
public String trade()
{
return prefix + "/trade";
}
/**
* 查询交易数据列表
*/
@RequiresPermissions("base:trade:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(TAmentTrade tAmentTrade)
{
startPage();
List<TAmentTrade> list = tAmentTradeService.selectTAmentTradeList(tAmentTrade);
return getDataTable(list);
}
/**
* 导出交易数据列表
*/
@RequiresPermissions("base:trade:export")
@Log(title = "交易数据", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(TAmentTrade tAmentTrade)
{
List<TAmentTrade> list = tAmentTradeService.selectTAmentTradeList(tAmentTrade);
ExcelUtil<TAmentTrade> util = new ExcelUtil<TAmentTrade>(TAmentTrade.class);
return util.exportExcel(list, "交易数据数据");
}
/**
* 新增交易数据
*/
@GetMapping("/add")
public String add()
{
return prefix + "/add";
}
/**
* 新增保存交易数据
*/
@RequiresPermissions("base:trade:add")
@Log(title = "交易数据", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(TAmentTrade tAmentTrade)
{
return toAjax(tAmentTradeService.insertTAmentTrade(tAmentTrade));
}
/**
* 修改交易数据
*/
@RequiresPermissions("base:trade:edit")
@GetMapping("/edit/{id}")
public String edit(@PathVariable("id") Long id, ModelMap mmap)
{
TAmentTrade tAmentTrade = tAmentTradeService.selectTAmentTradeById(id);
mmap.put("tAmentTrade", tAmentTrade);
return prefix + "/edit";
}
/**
* 修改保存交易数据
*/
@RequiresPermissions("base:trade:edit")
@Log(title = "交易数据", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(TAmentTrade tAmentTrade)
{
return toAjax(tAmentTradeService.updateTAmentTrade(tAmentTrade));
}
/**
* 删除交易数据
*/
@RequiresPermissions("base:trade:remove")
@Log(title = "交易数据", businessType = BusinessType.DELETE)
@PostMapping( "/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
return toAjax(tAmentTradeService.deleteTAmentTradeByIds(ids));
}
}

View File

@ -0,0 +1,93 @@
package com.cyx.web.base.domain;
import com.cyx.common.annotation.Excel;
import com.cyx.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 交易数据对象 t_ament_trade
*
* @author ruoyi
* @date 2023-09-18
*/
public class TAmentTrade extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** */
private Long id;
/** 交易数 */
@Excel(name = "交易数")
private Long tradeCount;
/** 交易额 */
@Excel(name = "交易额")
private Long tradeMony;
/** 类型(房屋建筑、市政、公路、铁路、民航、水运、水利、能源、邮电通信、其他) */
@Excel(name = "类型", readConverterExp = "房=屋建筑、市政、公路、铁路、民航、水运、水利、能源、邮电通信、其他")
private String type;
/** 年月份 */
@Excel(name = "年月份")
private String monthOf;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setTradeCount(Long tradeCount)
{
this.tradeCount = tradeCount;
}
public Long getTradeCount()
{
return tradeCount;
}
public void setTradeMony(Long tradeMony)
{
this.tradeMony = tradeMony;
}
public Long getTradeMony()
{
return tradeMony;
}
public void setType(String type)
{
this.type = type;
}
public String getType()
{
return type;
}
public void setMonthOf(String monthOf)
{
this.monthOf = monthOf;
}
public String getMonthOf()
{
return monthOf;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("tradeCount", getTradeCount())
.append("tradeMony", getTradeMony())
.append("type", getType())
.append("monthOf", getMonthOf())
.toString();
}
}

View File

@ -0,0 +1,65 @@
package com.cyx.web.base.mapper;
import java.util.List;
import java.util.Map;
import com.cyx.web.base.domain.TAmentTrade;
/**
* 交易数据Mapper接口
*
* @author ruoyi
* @date 2023-09-18
*/
public interface TAmentTradeMapper
{
/**
* 查询交易数据
*
* @param id 交易数据主键
* @return 交易数据
*/
public TAmentTrade selectTAmentTradeById(Long id);
/**
* 查询交易数据列表
*
* @param tAmentTrade 交易数据
* @return 交易数据集合
*/
public List<TAmentTrade> selectTAmentTradeList(TAmentTrade tAmentTrade);
/**
* 新增交易数据
*
* @param tAmentTrade 交易数据
* @return 结果
*/
public int insertTAmentTrade(TAmentTrade tAmentTrade);
/**
* 修改交易数据
*
* @param tAmentTrade 交易数据
* @return 结果
*/
public int updateTAmentTrade(TAmentTrade tAmentTrade);
/**
* 删除交易数据
*
* @param id 交易数据主键
* @return 结果
*/
public int deleteTAmentTradeById(Long id);
/**
* 批量删除交易数据
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteTAmentTradeByIds(String[] ids);
List<Map<String, Object>> tradeEcharts();
}

View File

@ -0,0 +1,65 @@
package com.cyx.web.base.service;
import java.util.List;
import java.util.Map;
import com.cyx.web.base.domain.TAmentTrade;
/**
* 交易数据Service接口
*
* @author ruoyi
* @date 2023-09-18
*/
public interface ITAmentTradeService
{
/**
* 查询交易数据
*
* @param id 交易数据主键
* @return 交易数据
*/
public TAmentTrade selectTAmentTradeById(Long id);
/**
* 查询交易数据列表
*
* @param tAmentTrade 交易数据
* @return 交易数据集合
*/
public List<TAmentTrade> selectTAmentTradeList(TAmentTrade tAmentTrade);
/**
* 新增交易数据
*
* @param tAmentTrade 交易数据
* @return 结果
*/
public int insertTAmentTrade(TAmentTrade tAmentTrade);
/**
* 修改交易数据
*
* @param tAmentTrade 交易数据
* @return 结果
*/
public int updateTAmentTrade(TAmentTrade tAmentTrade);
/**
* 批量删除交易数据
*
* @param ids 需要删除的交易数据主键集合
* @return 结果
*/
public int deleteTAmentTradeByIds(String ids);
/**
* 删除交易数据信息
*
* @param id 交易数据主键
* @return 结果
*/
public int deleteTAmentTradeById(Long id);
List<Map<String,Object>> tradeEcharts(TAmentTrade tAmentTrade);
}

View File

@ -0,0 +1,101 @@
package com.cyx.web.base.service.impl;
import java.util.List;
import java.util.Map;
import com.cyx.common.core.text.Convert;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.cyx.web.base.mapper.TAmentTradeMapper;
import com.cyx.web.base.domain.TAmentTrade;
import com.cyx.web.base.service.ITAmentTradeService;
/**
* 交易数据Service业务层处理
*
* @author ruoyi
* @date 2023-09-18
*/
@Service
public class TAmentTradeServiceImpl implements ITAmentTradeService
{
@Autowired
private TAmentTradeMapper tAmentTradeMapper;
/**
* 查询交易数据
*
* @param id 交易数据主键
* @return 交易数据
*/
@Override
public TAmentTrade selectTAmentTradeById(Long id)
{
return tAmentTradeMapper.selectTAmentTradeById(id);
}
/**
* 查询交易数据列表
*
* @param tAmentTrade 交易数据
* @return 交易数据
*/
@Override
public List<TAmentTrade> selectTAmentTradeList(TAmentTrade tAmentTrade)
{
return tAmentTradeMapper.selectTAmentTradeList(tAmentTrade);
}
/**
* 新增交易数据
*
* @param tAmentTrade 交易数据
* @return 结果
*/
@Override
public int insertTAmentTrade(TAmentTrade tAmentTrade)
{
return tAmentTradeMapper.insertTAmentTrade(tAmentTrade);
}
/**
* 修改交易数据
*
* @param tAmentTrade 交易数据
* @return 结果
*/
@Override
public int updateTAmentTrade(TAmentTrade tAmentTrade)
{
return tAmentTradeMapper.updateTAmentTrade(tAmentTrade);
}
/**
* 批量删除交易数据
*
* @param ids 需要删除的交易数据主键
* @return 结果
*/
@Override
public int deleteTAmentTradeByIds(String ids)
{
return tAmentTradeMapper.deleteTAmentTradeByIds(Convert.toStrArray(ids));
}
/**
* 删除交易数据信息
*
* @param id 交易数据主键
* @return 结果
*/
@Override
public int deleteTAmentTradeById(Long id)
{
return tAmentTradeMapper.deleteTAmentTradeById(id);
}
@Override
public List<Map<String,Object>> tradeEcharts(TAmentTrade tAmentTrade){
return tAmentTradeMapper.tradeEcharts();
}
}

View File

@ -0,0 +1,86 @@
<?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.cyx.web.base.mapper.TAmentTradeMapper">
<resultMap type="TAmentTrade" id="TAmentTradeResult">
<result property="id" column="id" />
<result property="tradeCount" column="trade_count" />
<result property="tradeMony" column="trade_mony" />
<result property="type" column="type" />
<result property="monthOf" column="month_of" />
</resultMap>
<sql id="selectTAmentTradeVo">
select id, trade_count, trade_mony, type, month_of from t_ament_trade
</sql>
<select id="selectTAmentTradeList" parameterType="TAmentTrade" resultMap="TAmentTradeResult">
<include refid="selectTAmentTradeVo"/>
<where>
<if test="tradeCount != null "> and trade_count = #{tradeCount}</if>
<if test="tradeMony != null "> and trade_mony = #{tradeMony}</if>
<if test="type != null and type != ''"> and type = #{type}</if>
<if test="monthOf != null and monthOf != ''"> and month_of = #{monthOf}</if>
</where>
</select>
<select id="selectTAmentTradeById" parameterType="Long" resultMap="TAmentTradeResult">
<include refid="selectTAmentTradeVo"/>
where id = #{id}
</select>
<select id="tradeEcharts" resultType="map">
SELECT
month_of 'month',
ROUND( sum( trade_mony ), 4 ) trade,
SUM( trade_count ) count
FROM
t_ament_trade
WHERE
month_of LIKE CONCAT( '%', DATE_FORMAT( NOW(), '%Y' ), '%' )
GROUP BY
month_of
ORDER BY month_of desc
</select>
<insert id="insertTAmentTrade" parameterType="TAmentTrade" useGeneratedKeys="true" keyProperty="id">
insert into t_ament_trade
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="tradeCount != null">trade_count,</if>
<if test="tradeMony != null">trade_mony,</if>
<if test="type != null">type,</if>
<if test="monthOf != null">month_of,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="tradeCount != null">#{tradeCount},</if>
<if test="tradeMony != null">#{tradeMony},</if>
<if test="type != null">#{type},</if>
<if test="monthOf != null">#{monthOf},</if>
</trim>
</insert>
<update id="updateTAmentTrade" parameterType="TAmentTrade">
update t_ament_trade
<trim prefix="SET" suffixOverrides=",">
<if test="tradeCount != null">trade_count = #{tradeCount},</if>
<if test="tradeMony != null">trade_mony = #{tradeMony},</if>
<if test="type != null">type = #{type},</if>
<if test="monthOf != null">month_of = #{monthOf},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteTAmentTradeById" parameterType="Long">
delete from t_ament_trade where id = #{id}
</delete>
<delete id="deleteTAmentTradeByIds" parameterType="String">
delete from t_ament_trade where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>