hujiali_branch
hjl 8 months ago
parent 8945f4a85a
commit b218c34cc3

@ -52,331 +52,240 @@ import com.entity.StoreupEntity;
@RequestMapping("/wenjuandiaocha")
public class WenjuandiaochaController {
@Autowired
private WenjuandiaochaService wenjuandiaochaService;
private WenjuandiaochaService wenjuandiaochaService; // 注入问卷调查服务
@Autowired
private StoreupService storeupService;
/**
*
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,WenjuandiaochaEntity wenjuandiaocha,
HttpServletRequest request){
EntityWrapper<WenjuandiaochaEntity> ew = new EntityWrapper<WenjuandiaochaEntity>();
PageUtils page = wenjuandiaochaService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, wenjuandiaocha), params), params));
request.setAttribute("data", page);
return R.ok().put("data", page);
}
/**
*
*/
@IgnoreAuth
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params,WenjuandiaochaEntity wenjuandiaocha,
HttpServletRequest request){
EntityWrapper<WenjuandiaochaEntity> ew = new EntityWrapper<WenjuandiaochaEntity>();
PageUtils page = wenjuandiaochaService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, wenjuandiaocha), params), params));
request.setAttribute("data", page);
return R.ok().put("data", page);
}
/**
*
*/
@RequestMapping("/lists")
public R list( WenjuandiaochaEntity wenjuandiaocha){
EntityWrapper<WenjuandiaochaEntity> ew = new EntityWrapper<WenjuandiaochaEntity>();
ew.allEq(MPUtil.allEQMapPre( wenjuandiaocha, "wenjuandiaocha"));
return R.ok().put("data", wenjuandiaochaService.selectListView(ew));
}
/**
*
*/
@RequestMapping("/query")
public R query(WenjuandiaochaEntity wenjuandiaocha){
EntityWrapper< WenjuandiaochaEntity> ew = new EntityWrapper< WenjuandiaochaEntity>();
ew.allEq(MPUtil.allEQMapPre( wenjuandiaocha, "wenjuandiaocha"));
WenjuandiaochaView wenjuandiaochaView = wenjuandiaochaService.selectView(ew);
return R.ok("查询问卷调查成功").put("data", wenjuandiaochaView);
}
/**
*
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
WenjuandiaochaEntity wenjuandiaocha = wenjuandiaochaService.selectById(id);
wenjuandiaocha.setClicktime(new Date());
wenjuandiaochaService.updateById(wenjuandiaocha);
return R.ok().put("data", wenjuandiaocha);
}
/**
*
*/
@IgnoreAuth
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id){
WenjuandiaochaEntity wenjuandiaocha = wenjuandiaochaService.selectById(id);
wenjuandiaocha.setClicktime(new Date());
wenjuandiaochaService.updateById(wenjuandiaocha);
return R.ok().put("data", wenjuandiaocha);
}
/**
*
*/
@RequestMapping("/save")
public R save(@RequestBody WenjuandiaochaEntity wenjuandiaocha, HttpServletRequest request){
wenjuandiaocha.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(wenjuandiaocha);
wenjuandiaochaService.insert(wenjuandiaocha);
return R.ok();
}
/**
*
*/
@RequestMapping("/add")
public R add(@RequestBody WenjuandiaochaEntity wenjuandiaocha, HttpServletRequest request){
wenjuandiaocha.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(wenjuandiaocha);
wenjuandiaochaService.insert(wenjuandiaocha);
return R.ok();
}
private StoreupService storeupService; // 注入收藏服务
/**
*
*
*/
@RequestMapping("/update")
@Transactional
public R update(@RequestBody WenjuandiaochaEntity wenjuandiaocha, HttpServletRequest request){
//ValidatorUtils.validateEntity(wenjuandiaocha);
wenjuandiaochaService.updateById(wenjuandiaocha);//全部更新
return R.ok();
}
@RequestMapping("/remind/{columnName}/{type}")
public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request,
@PathVariable("type") String type, @RequestParam Map<String, Object> map) {
// 将列名和类型添加到 map 中
map.put("column", columnName);
map.put("type", type);
// 如果类型为 "2",处理日期范围
if (type.equals("2")) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); // 定义日期格式
Calendar c = Calendar.getInstance(); // 获取当前日期时间
Date remindStartDate = null;
Date remindEndDate = null;
// 处理 remindstart 参数
if (map.get("remindstart") != null) {
Integer remindStart = Integer.parseInt(map.get("remindstart").toString()); // 将 remindstart 转换为整数
c.setTime(new Date()); // 设置当前时间
c.add(Calendar.DAY_OF_MONTH, remindStart); // 添加 remindStart 天
remindStartDate = c.getTime(); // 获取新的开始日期
map.put("remindstart", sdf.format(remindStartDate)); // 格式化并添加到 map 中
}
// 处理 remindend 参数
if (map.get("remindend") != null) {
Integer remindEnd = Integer.parseInt(map.get("remindend").toString()); // 将 remindend 转换为整数
c.setTime(new Date()); // 设置当前时间
c.add(Calendar.DAY_OF_MONTH, remindEnd); // 添加 remindEnd 天
remindEndDate = c.getTime(); // 获取新的结束日期
map.put("remindend", sdf.format(remindEndDate)); // 格式化并添加到 map 中
}
}
// 创建 EntityWrapper 对象,用于构建查询条件
Wrapper<WenjuandiaochaEntity> wrapper = new EntityWrapper<WenjuandiaochaEntity>();
if (map.get("remindstart") != null) {
wrapper.ge(columnName, map.get("remindstart")); // 大于等于 remindstart
}
if (map.get("remindend") != null) {
wrapper.le(columnName, map.get("remindend")); // 小于等于 remindend
}
/**
*
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
wenjuandiaochaService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
// 查询符合条件的记录数
int count = wenjuandiaochaService.selectCount(wrapper);
return R.ok().put("count", count); // 返回记录数
}
/**
*
*/
@RequestMapping("/remind/{columnName}/{type}")
public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request,
@PathVariable("type") String type,@RequestParam Map<String, Object> map) {
map.put("column", columnName);
map.put("type", type);
if(type.equals("2")) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar c = Calendar.getInstance();
Date remindStartDate = null;
Date remindEndDate = null;
if(map.get("remindstart")!=null) {
Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindStart);
remindStartDate = c.getTime();
map.put("remindstart", sdf.format(remindStartDate));
}
if(map.get("remindend")!=null) {
Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindEnd);
remindEndDate = c.getTime();
map.put("remindend", sdf.format(remindEndDate));
}
}
Wrapper<WenjuandiaochaEntity> wrapper = new EntityWrapper<WenjuandiaochaEntity>();
if(map.get("remindstart")!=null) {
wrapper.ge(columnName, map.get("remindstart"));
}
if(map.get("remindend")!=null) {
wrapper.le(columnName, map.get("remindend"));
}
int count = wenjuandiaochaService.selectCount(wrapper);
return R.ok().put("count", count);
}
/**
*
*/
@IgnoreAuth
@IgnoreAuth // 忽略认证
@RequestMapping("/autoSort")
public R autoSort(@RequestParam Map<String, Object> params,WenjuandiaochaEntity wenjuandiaocha, HttpServletRequest request,String pre){
public R autoSort(@RequestParam Map<String, Object> params, WenjuandiaochaEntity wenjuandiaocha, HttpServletRequest request, String pre) {
// 创建 EntityWrapper 对象,用于构建查询条件
EntityWrapper<WenjuandiaochaEntity> ew = new EntityWrapper<WenjuandiaochaEntity>();
Map<String, Object> newMap = new HashMap<String, Object>();
Map<String, Object> param = new HashMap<String, Object>();
Iterator<Map.Entry<String, Object>> it = param.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<String, Object> entry = it.next();
String key = entry.getKey();
String newKey = entry.getKey();
if (pre.endsWith(".")) {
newMap.put(pre + newKey, entry.getValue());
} else if (StringUtils.isEmpty(pre)) {
newMap.put(newKey, entry.getValue());
} else {
newMap.put(pre + "." + newKey, entry.getValue());
}
}
params.put("sort", "clicktime");
Iterator<Map.Entry<String, Object>> it = param.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<String, Object> entry = it.next();
String key = entry.getKey();
String newKey = entry.getKey();
// 处理 pre 参数
if (pre.endsWith(".")) {
newMap.put(pre + newKey, entry.getValue());
} else if (StringUtils.isEmpty(pre)) {
newMap.put(newKey, entry.getValue());
} else {
newMap.put(pre + "." + newKey, entry.getValue());
}
}
// 设置排序条件
params.put("sort", "clicktime");
params.put("order", "desc");
PageUtils page = wenjuandiaochaService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, wenjuandiaocha), params), params));
return R.ok().put("data", page);
// 查询分页数据
PageUtils page = wenjuandiaochaService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, wenjuandiaocha), params), params));
return R.ok().put("data", page); // 返回分页数据
}
/**
*
*/
@RequestMapping("/autoSort2")
public R autoSort2(@RequestParam Map<String, Object> params,WenjuandiaochaEntity wenjuandiaocha, HttpServletRequest request){
public R autoSort2(@RequestParam Map<String, Object> params, WenjuandiaochaEntity wenjuandiaocha, HttpServletRequest request) {
// 获取用户 ID
String userId = request.getSession().getAttribute("userId").toString();
String inteltypeColumn = "leixing";
String inteltypeColumn = "leixing"; // 定义智能类型列名
List<StoreupEntity> storeups = storeupService.selectList(new EntityWrapper<StoreupEntity>().eq("type", 1).eq("userid", userId).eq("tablename", "wenjuandiaocha").orderBy("addtime", false));
List<String> inteltypes = new ArrayList<String>();
Integer limit = params.get("limit")==null?10:Integer.parseInt(params.get("limit").toString());
Integer limit = params.get("limit") == null ? 10 : Integer.parseInt(params.get("limit").toString()); // 设置限制数量,默认为 10
List<WenjuandiaochaEntity> wenjuandiaochaList = new ArrayList<WenjuandiaochaEntity>();
//去重
if(storeups!=null && storeups.size()>0) {
for(StoreupEntity s : storeups) {
// 去重
if (storeups != null && storeups.size() > 0) {
for (StoreupEntity s : storeups) {
wenjuandiaochaList.addAll(wenjuandiaochaService.selectList(new EntityWrapper<WenjuandiaochaEntity>().eq(inteltypeColumn, s.getInteltype())));
}
}
// 创建 EntityWrapper 对象,用于构建查询条件
EntityWrapper<WenjuandiaochaEntity> ew = new EntityWrapper<WenjuandiaochaEntity>();
params.put("sort", "id");
params.put("order", "desc");
// 查询分页数据
PageUtils page = wenjuandiaochaService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, wenjuandiaocha), params), params));
List<WenjuandiaochaEntity> pageList = (List<WenjuandiaochaEntity>)page.getList();
if(wenjuandiaochaList.size()<limit) {
int toAddNum = (limit-wenjuandiaochaList.size())<=pageList.size()?(limit-wenjuandiaochaList.size()):pageList.size();
for(WenjuandiaochaEntity o1 : pageList) {
List<WenjuandiaochaEntity> pageList = (List<WenjuandiaochaEntity>) page.getList();
// 如果结果数量小于限制数量,则从分页数据中添加
if (wenjuandiaochaList.size() < limit) {
int toAddNum = (limit - wenjuandiaochaList.size()) <= pageList.size() ? (limit - wenjuandiaochaList.size()) : pageList.size();
for (WenjuandiaochaEntity o1 : pageList) {
boolean addFlag = true;
for(WenjuandiaochaEntity o2 : wenjuandiaochaList) {
if(o1.getId().intValue()==o2.getId().intValue()) {
for (WenjuandiaochaEntity o2 : wenjuandiaochaList) {
if (o1.getId().intValue() == o2.getId().intValue()) {
addFlag = false;
break;
}
}
if(addFlag) {
if (addFlag) {
wenjuandiaochaList.add(o1);
if(--toAddNum==0) break;
if (--toAddNum == 0) break;
}
}
} else if(wenjuandiaochaList.size()>limit) {
wenjuandiaochaList = wenjuandiaochaList.subList(0, limit);
} else if (wenjuandiaochaList.size() > limit) {
wenjuandiaochaList = wenjuandiaochaList.subList(0, limit); // 如果结果数量大于限制数量,则截取前 limit 个
}
page.setList(wenjuandiaochaList);
return R.ok().put("data", page);
}
page.setList(wenjuandiaochaList); // 设置新的列表
return R.ok().put("data", page); // 返回分页数据
}
/**
*
*/
@RequestMapping("/value/{xColumnName}/{yColumnName}")
public R value(@PathVariable("yColumnName") String yColumnName, @PathVariable("xColumnName") String xColumnName,HttpServletRequest request) {
public R value(@PathVariable("yColumnName") String yColumnName, @PathVariable("xColumnName") String xColumnName, HttpServletRequest request) {
Map<String, Object> params = new HashMap<String, Object>();
params.put("xColumn", xColumnName);
params.put("yColumn", yColumnName);
// 创建 EntityWrapper 对象,用于构建查询条件
EntityWrapper<WenjuandiaochaEntity> ew = new EntityWrapper<WenjuandiaochaEntity>();
// 查询统计结果
List<Map<String, Object>> result = wenjuandiaochaService.selectValue(params, ew);
// 处理日期格式
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
for(Map<String, Object> m : result) {
for(String k : m.keySet()) {
if(m.get(k) instanceof Date) {
m.put(k, sdf.format((Date)m.get(k)));
for (Map<String, Object> m : result) {
for (String k : m.keySet()) {
if (m.get(k) instanceof Date) {
m.put(k, sdf.format((Date) m.get(k)));
}
}
}
return R.ok().put("data", result);
return R.ok().put("data", result); // 返回统计结果
}
/**
*
*/
@RequestMapping("/value/{xColumnName}/{yColumnName}/{timeStatType}")
public R valueDay(@PathVariable("yColumnName") String yColumnName, @PathVariable("xColumnName") String xColumnName, @PathVariable("timeStatType") String timeStatType,HttpServletRequest request) {
public R valueDay(@PathVariable("yColumnName") String yColumnName, @PathVariable("xColumnName") String xColumnName, @PathVariable("timeStatType") String timeStatType, HttpServletRequest request) {
Map<String, Object> params = new HashMap<String, Object>();
params.put("xColumn", xColumnName);
params.put("yColumn", yColumnName);
params.put("timeStatType", timeStatType);
// 创建 EntityWrapper 对象,用于构建查询条件
EntityWrapper<WenjuandiaochaEntity> ew = new EntityWrapper<WenjuandiaochaEntity>();
// 查询时间统计结果
List<Map<String, Object>> result = wenjuandiaochaService.selectTimeStatValue(params, ew);
// 处理日期格式
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
for(Map<String, Object> m : result) {
for(String k : m.keySet()) {
if(m.get(k) instanceof Date) {
m.put(k, sdf.format((Date)m.get(k)));
for (Map<String, Object> m : result) {
for (String k : m.keySet()) {
if (m.get(k) instanceof Date) {
m.put(k, sdf.format((Date) m.get(k)));
}
}
}
return R.ok().put("data", result);
return R.ok().put("data", result); // 返回时间统计结果
}
/**
*
*/
@RequestMapping("/group/{columnName}")
public R group(@PathVariable("columnName") String columnName,HttpServletRequest request) {
public R group(@PathVariable("columnName") String columnName, HttpServletRequest request) {
Map<String, Object> params = new HashMap<String, Object>();
params.put("column", columnName);
// 创建 EntityWrapper 对象,用于构建查询条件
EntityWrapper<WenjuandiaochaEntity> ew = new EntityWrapper<WenjuandiaochaEntity>();
// 查询分组统计结果
List<Map<String, Object>> result = wenjuandiaochaService.selectGroup(params, ew);
// 处理日期格式
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
for(Map<String, Object> m : result) {
for(String k : m.keySet()) {
if(m.get(k) instanceof Date) {
m.put(k, sdf.format((Date)m.get(k)));
for (Map<String, Object> m : result) {
for (String k : m.keySet()) {
if (m.get(k) instanceof Date) {
m.put(k, sdf.format((Date) m.get(k)));
}
}
}
return R.ok().put("data", result);
return R.ok().put("data", result); // 返回分组统计结果
}
/**
*
*/
@RequestMapping("/count")
public R count(@RequestParam Map<String, Object> params,WenjuandiaochaEntity wenjuandiaocha, HttpServletRequest request){
public R count(@RequestParam Map<String, Object> params, WenjuandiaochaEntity wenjuandiaocha, HttpServletRequest request) {
// 创建 EntityWrapper 对象,用于构建查询条件
EntityWrapper<WenjuandiaochaEntity> ew = new EntityWrapper<WenjuandiaochaEntity>();
// 查询符合条件的记录数
int count = wenjuandiaochaService.selectCount(MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, wenjuandiaocha), params), params));
return R.ok().put("data", count);
return R.ok().put("data", count); // 返回记录数
}
}

@ -13,31 +13,73 @@ import com.entity.view.WenjuandiaochaView;
/**
*
*
* @author
* @email
* 访
* BaseMapperCRUD
* @author
* @email
* @date 2023-02-21 09:46:06
*/
public interface WenjuandiaochaDao extends BaseMapper<WenjuandiaochaEntity> {
List<WenjuandiaochaVO> selectListVO(@Param("ew") Wrapper<WenjuandiaochaEntity> wrapper);
WenjuandiaochaVO selectVO(@Param("ew") Wrapper<WenjuandiaochaEntity> wrapper);
List<WenjuandiaochaView> selectListView(@Param("ew") Wrapper<WenjuandiaochaEntity> wrapper);
List<WenjuandiaochaView> selectListView(Pagination page,@Param("ew") Wrapper<WenjuandiaochaEntity> wrapper);
WenjuandiaochaView selectView(@Param("ew") Wrapper<WenjuandiaochaEntity> wrapper);
List<Map<String, Object>> selectValue(@Param("params") Map<String, Object> params,@Param("ew") Wrapper<WenjuandiaochaEntity> wrapper);
List<Map<String, Object>> selectTimeStatValue(@Param("params") Map<String, Object> params,@Param("ew") Wrapper<WenjuandiaochaEntity> wrapper);
List<Map<String, Object>> selectGroup(@Param("params") Map<String, Object> params,@Param("ew") Wrapper<WenjuandiaochaEntity> wrapper);
/**
* WenjuandiaochaVO
* @param ew
* @return VO
*/
List<WenjuandiaochaVO> selectListVO(@Param("ew") Wrapper<WenjuandiaochaEntity> ew);
/**
* WenjuandiaochaVO
* @param ew
* @return VO
*/
WenjuandiaochaVO selectVO(@Param("ew") Wrapper<WenjuandiaochaEntity> ew);
/**
* WenjuandiaochaView
* @param ew
* @return View
*/
List<WenjuandiaochaView> selectListView(@Param("ew") Wrapper<WenjuandiaochaEntity> ew);
/**
* WenjuandiaochaView
* @param page
* @param ew
* @return View
*/
List<WenjuandiaochaView> selectListView(Pagination page, @Param("ew") Wrapper<WenjuandiaochaEntity> ew);
/**
* WenjuandiaochaView
* @param ew
* @return View
*/
WenjuandiaochaView selectView(@Param("ew") Wrapper<WenjuandiaochaEntity> ew);
/**
* Map
* @param params
* @param ew
* @return Map
*/
List<Map<String, Object>> selectValue(@Param("params") Map<String, Object> params, @Param("ew") Wrapper<WenjuandiaochaEntity> ew);
/**
* Map
* @param params
* @param ew
* @return Map
*/
List<Map<String, Object>> selectTimeStatValue(@Param("params") Map<String, Object> params, @Param("ew") Wrapper<WenjuandiaochaEntity> ew);
/**
* Map
* @param params
* @param ew
* @return Map
*/
List<Map<String, Object>> selectGroup(@Param("params") Map<String, Object> params, @Param("ew") Wrapper<WenjuandiaochaEntity> ew);
}

@ -3,7 +3,6 @@ package com.entity;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@ -11,37 +10,39 @@ import java.lang.reflect.InvocationTargetException;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import org.springframework.format.annotation.DateTimeFormat;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.beanutils.BeanUtils;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.enums.FieldFill;
import com.baomidou.mybatisplus.enums.IdType;
/**
*
*
* @author
* @email
* @author
* @email
* @date 2023-02-21 09:46:06
*/
@TableName("wenjuandiaocha")
public class WenjuandiaochaEntity<T> implements Serializable {
private static final long serialVersionUID = 1L;
@TableName("wenjuandiaocha") // 指定该实体类对应的数据库表名为“wenjuandiaocha”
@JsonIgnoreProperties(ignoreUnknown = true) // 忽略未知属性,防止反序列化时出现错误
public class WenjuandiaochaEntity<T> implements Serializable { // 实现Serializable接口以支持序列化
private static final long serialVersionUID = 1L; // 序列化版本号
/**
*
*/
public WenjuandiaochaEntity() {
}
/**
* t
* @param t
*/
public WenjuandiaochaEntity(T t) {
try {
BeanUtils.copyProperties(this, t);
BeanUtils.copyProperties(this, t); // 使用BeanUtils工具类复制属性
} catch (IllegalAccessException | InvocationTargetException e) {
// TODO Auto-generated catch block
// 打印堆栈跟踪信息以便调试
e.printStackTrace();
}
}
@ -49,210 +50,274 @@ public class WenjuandiaochaEntity<T> implements Serializable {
/**
* id
*/
@TableId
@TableId // 指定该字段为主键
private Long id;
/**
*
* 使NotBlank
*/
@NotBlank(message = "问卷标题不能为空")
private String wenjuanbiaoti;
/**
*
* 使NotBlank
*/
@NotBlank(message = "封面图片路径不能为空")
private String fengmiantupian;
/**
*
* 使NotBlank
*/
@NotBlank(message = "类型不能为空")
private String leixing;
/**
*
* 使NotBlank
*/
@NotBlank(message = "问题一不能为空")
private String wentiyi;
/**
*
* 使NotBlank
*/
@NotBlank(message = "问题二不能为空")
private String wentier;
/**
*
* 使NotBlank
*/
@NotBlank(message = "问题三不能为空")
private String wentisan;
/**
*
* 使NotBlank
*/
@NotBlank(message = "问题四不能为空")
private String wentisi;
/**
*
* 使NotBlank
*/
@NotBlank(message = "问题五不能为空")
private String wentiwu;
/**
*
* 使JsonFormatyyyy-MM-dd HH:mm:ss
* 使DateTimeFormatyyyy-MM-dd HH:mm:ss
* 使NotNullnull
*/
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd")
@DateTimeFormat
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@NotNull(message = "发布日期不能为空")
private Date faburiqi;
/**
*
* 使JsonFormatyyyy-MM-dd HH:mm:ss
* 使DateTimeFormatyyyy-MM-dd HH:mm:ss
*/
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
@DateTimeFormat
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date clicktime;
/**
*
* @param addtime
*/
public void setAddtime(Date addtime) {
this.addtime = addtime;
}
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
@DateTimeFormat
private Date addtime;
/**
*
* @return
*/
public Date getAddtime() {
return addtime;
}
public void setAddtime(Date addtime) {
this.addtime = addtime;
/**
* id
* @param id id
*/
public void setId(Long id) {
this.id = id;
}
/**
* id
* @return id
*/
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
/**
*
*/
/**
*
* @param wenjuanbiaoti
*/
public void setWenjuanbiaoti(String wenjuanbiaoti) {
this.wenjuanbiaoti = wenjuanbiaoti;
}
/**
*
*/
/**
*
* @return
*/
public String getWenjuanbiaoti() {
return wenjuanbiaoti;
}
/**
*
*/
/**
*
* @param fengmiantupian
*/
public void setFengmiantupian(String fengmiantupian) {
this.fengmiantupian = fengmiantupian;
}
/**
*
*/
/**
*
* @return
*/
public String getFengmiantupian() {
return fengmiantupian;
}
/**
*
*/
/**
*
* @param leixing
*/
public void setLeixing(String leixing) {
this.leixing = leixing;
}
/**
*
*/
/**
*
* @return
*/
public String getLeixing() {
return leixing;
}
/**
*
*/
/**
*
* @param wentiyi
*/
public void setWentiyi(String wentiyi) {
this.wentiyi = wentiyi;
}
/**
*
*/
/**
*
* @return
*/
public String getWentiyi() {
return wentiyi;
}
/**
*
*/
/**
*
* @param wentier
*/
public void setWentier(String wentier) {
this.wentier = wentier;
}
/**
*
*/
/**
*
* @return
*/
public String getWentier() {
return wentier;
}
/**
*
*/
/**
*
* @param wentisan
*/
public void setWentisan(String wentisan) {
this.wentisan = wentisan;
}
/**
*
*/
/**
*
* @return
*/
public String getWentisan() {
return wentisan;
}
/**
*
*/
/**
*
* @param wentisi
*/
public void setWentisi(String wentisi) {
this.wentisi = wentisi;
}
/**
*
*/
/**
*
* @return
*/
public String getWentisi() {
return wentisi;
}
/**
*
*/
/**
*
* @param wentiwu
*/
public void setWentiwu(String wentiwu) {
this.wentiwu = wentiwu;
}
/**
*
*/
/**
*
* @return
*/
public String getWentiwu() {
return wentiwu;
}
/**
*
*/
/**
*
* @param faburiqi
*/
public void setFaburiqi(Date faburiqi) {
this.faburiqi = faburiqi;
}
/**
*
*/
/**
*
* @return
*/
public Date getFaburiqi() {
return faburiqi;
}
/**
*
*/
/**
*
* @param clicktime
*/
public void setClicktime(Date clicktime) {
this.clicktime = clicktime;
}
/**
*
*/
/**
*
* @return
*/
public Date getClicktime() {
return clicktime;
}
}

@ -1,90 +1,75 @@
package com.entity.model;
import com.entity.WenjuandiaochaEntity;
import com.baomidou.mybatisplus.annotations.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
/**
*
*
* entity
* ModelAndView model
* @author
* @email
*
*
* ModelAndViewmodel
* @author
* @email
* @date 2023-02-21 09:46:06
*/
public class WenjuandiaochaModel implements Serializable {
public class WenjuandiaochaModel implements Serializable {
private static final long serialVersionUID = 1L;
/**
*
*/
private String fengmiantupian;
/**
*
*/
private String leixing;
/**
*
*/
private String wentiyi;
/**
*
*/
private String wentier;
/**
*
*/
private String wentisan;
/**
*
*/
private String wentisi;
/**
*
*/
private String wentiwu;
/**
*
*/
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat
private Date faburiqi;
/**
*
*/
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat
private Date clicktime;
/**
*
*/
public void setFengmiantupian(String fengmiantupian) {
this.fengmiantupian = fengmiantupian;
}
@ -96,11 +81,9 @@ public class WenjuandiaochaModel implements Serializable {
return fengmiantupian;
}
/**
*
*/
public void setLeixing(String leixing) {
this.leixing = leixing;
}
@ -112,11 +95,9 @@ public class WenjuandiaochaModel implements Serializable {
return leixing;
}
/**
*
*/
public void setWentiyi(String wentiyi) {
this.wentiyi = wentiyi;
}
@ -128,11 +109,9 @@ public class WenjuandiaochaModel implements Serializable {
return wentiyi;
}
/**
*
*/
public void setWentier(String wentier) {
this.wentier = wentier;
}
@ -144,11 +123,9 @@ public class WenjuandiaochaModel implements Serializable {
return wentier;
}
/**
*
*/
public void setWentisan(String wentisan) {
this.wentisan = wentisan;
}
@ -160,11 +137,9 @@ public class WenjuandiaochaModel implements Serializable {
return wentisan;
}
/**
*
*/
public void setWentisi(String wentisi) {
this.wentisi = wentisi;
}
@ -176,11 +151,9 @@ public class WenjuandiaochaModel implements Serializable {
return wentisi;
}
/**
*
*/
public void setWentiwu(String wentiwu) {
this.wentiwu = wentiwu;
}
@ -192,11 +165,9 @@ public class WenjuandiaochaModel implements Serializable {
return wentiwu;
}
/**
*
*/
public void setFaburiqi(Date faburiqi) {
this.faburiqi = faburiqi;
}
@ -208,11 +179,9 @@ public class WenjuandiaochaModel implements Serializable {
return faburiqi;
}
/**
*
*/
public void setClicktime(Date clicktime) {
this.clicktime = clicktime;
}
@ -223,5 +192,4 @@ public class WenjuandiaochaModel implements Serializable {
public Date getClicktime() {
return clicktime;
}
}

@ -1,36 +1,40 @@
package com.entity.view;
import com.entity.WenjuandiaochaEntity;
import com.baomidou.mybatisplus.annotations.TableName;
import org.apache.commons.beanutils.BeanUtils;
import java.lang.reflect.InvocationTargetException;
import java.io.Serializable;
/**
*
*
* 使
* @author
* @email
*
* 使
* 使
* @author
* @email
* @date 2023-02-21 09:46:06
*/
@TableName("wenjuandiaocha")
public class WenjuandiaochaView extends WenjuandiaochaEntity implements Serializable {
private static final long serialVersionUID = 1L;
public WenjuandiaochaView(){
}
public WenjuandiaochaView(WenjuandiaochaEntity wenjuandiaochaEntity){
try {
BeanUtils.copyProperties(this, wenjuandiaochaEntity);
} catch (IllegalAccessException | InvocationTargetException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public class WenjuandiaochaView extends WenjuandiaochaEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
*
*/
public WenjuandiaochaView() {
}
/**
* WenjuandiaochaEntityWenjuandiaochaView
* @param wenjuandiaochaEntity
*/
public WenjuandiaochaView(WenjuandiaochaEntity wenjuandiaochaEntity) {
try {
BeanUtils.copyProperties(this, wenjuandiaochaEntity);
} catch (IllegalAccessException | InvocationTargetException e) {
// 打印堆栈跟踪信息以便调试
e.printStackTrace();
}
}
}

@ -10,36 +10,80 @@ import com.entity.vo.WenjuandiaochaVO;
import org.apache.ibatis.annotations.Param;
import com.entity.view.WenjuandiaochaView;
/**
*
*
*
* @author
* @email
* @author
* @email
* @date 2023-02-21 09:46:06
*/
public interface WenjuandiaochaService extends IService<WenjuandiaochaEntity> {
/**
*
* @param params
* @return
*/
PageUtils queryPage(Map<String, Object> params);
List<WenjuandiaochaVO> selectListVO(Wrapper<WenjuandiaochaEntity> wrapper);
WenjuandiaochaVO selectVO(@Param("ew") Wrapper<WenjuandiaochaEntity> wrapper);
List<WenjuandiaochaView> selectListView(Wrapper<WenjuandiaochaEntity> wrapper);
WenjuandiaochaView selectView(@Param("ew") Wrapper<WenjuandiaochaEntity> wrapper);
PageUtils queryPage(Map<String, Object> params,Wrapper<WenjuandiaochaEntity> wrapper);
List<Map<String, Object>> selectValue(Map<String, Object> params,Wrapper<WenjuandiaochaEntity> wrapper);
List<Map<String, Object>> selectTimeStatValue(Map<String, Object> params,Wrapper<WenjuandiaochaEntity> wrapper);
List<Map<String, Object>> selectGroup(Map<String, Object> params,Wrapper<WenjuandiaochaEntity> wrapper);
/**
*
* @param wrapper
* @return
*/
List<WenjuandiaochaVO> selectListVO(Wrapper<WenjuandiaochaEntity> wrapper);
/**
*
* @param wrapper
* @return
*/
WenjuandiaochaVO selectVO(@Param("ew") Wrapper<WenjuandiaochaEntity> wrapper);
/**
*
* @param wrapper
* @return
*/
List<WenjuandiaochaView> selectListView(Wrapper<WenjuandiaochaEntity> wrapper);
/**
*
* @param wrapper
* @return
*/
WenjuandiaochaView selectView(@Param("ew") Wrapper<WenjuandiaochaEntity> wrapper);
/**
*
* @param params
* @param wrapper
* @return
*/
PageUtils queryPage(Map<String, Object> params, Wrapper<WenjuandiaochaEntity> wrapper);
/**
*
* @param params
* @param wrapper
* @return
*/
List<Map<String, Object>> selectValue(Map<String, Object> params, Wrapper<WenjuandiaochaEntity> wrapper);
/**
*
* @param params
* @param wrapper
* @return
*/
List<Map<String, Object>> selectTimeStatValue(Map<String, Object> params, Wrapper<WenjuandiaochaEntity> wrapper);
/**
*
* @param params
* @param wrapper
* @return
*/
List<Map<String, Object>> selectGroup(Map<String, Object> params, Wrapper<WenjuandiaochaEntity> wrapper);
}

@ -11,19 +11,27 @@ import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.utils.PageUtils;
import com.utils.Query;
import com.dao.WenjuandiaochaDao;
import com.entity.WenjuandiaochaEntity;
import com.service.WenjuandiaochaService;
import com.entity.vo.WenjuandiaochaVO;
import com.entity.view.WenjuandiaochaView;
import com.entity.view.Wenjuandiaocha;
/**
*
* MyBatis-PlusServiceImplWenjuandiaochaService
*/
@Service("wenjuandiaochaService")
public class WenjuandiaochaServiceImpl extends ServiceImpl<WenjuandiaochaDao, WenjuandiaochaEntity> implements WenjuandiaochaService {
/**
*
* @param params
* @return
*/
@Override
public PageUtils queryPage(Map<String, Object> params) {
// 使用MyBatis-Plus的分页插件进行分页查询
Page<WenjuandiaochaEntity> page = this.selectPage(
new Query<WenjuandiaochaEntity>(params).getPage(),
new EntityWrapper<WenjuandiaochaEntity>()
@ -31,50 +39,93 @@ public class WenjuandiaochaServiceImpl extends ServiceImpl<WenjuandiaochaDao, We
return new PageUtils(page);
}
/**
*
* @param params
* @param wrapper
* @return
*/
@Override
public PageUtils queryPage(Map<String, Object> params, Wrapper<WenjuandiaochaEntity> wrapper) {
Page<WenjuandiaochaView> page =new Query<WenjuandiaochaView>(params).getPage();
page.setRecords(baseMapper.selectListView(page,wrapper));
PageUtils pageUtil = new PageUtils(page);
return pageUtil;
// 创建分页对象
Page<WenjuandiaochaView> page = new Query<WenjuandiaochaView>(params).getPage();
// 设置分页记录
page.setRecords(baseMapper.selectListView(page, wrapper));
// 返回分页工具类
PageUtils pageUtil = new PageUtils(page);
return pageUtil;
}
/**
*
* @param wrapper
* @return
*/
@Override
public List<WenjuandiaochaVO> selectListVO(Wrapper<WenjuandiaochaEntity> wrapper) {
return baseMapper.selectListVO(wrapper);
}
/**
*
* @param wrapper
* @return
*/
@Override
public WenjuandiaochaVO selectVO(Wrapper<WenjuandiaochaEntity> wrapper) {
return baseMapper.selectVO(wrapper);
}
/**
*
* @param wrapper
* @return
*/
@Override
public List<WenjuandiaochaView> selectListView(Wrapper<WenjuandiaochaEntity> wrapper) {
return baseMapper.selectListView(wrapper);
}
/**
*
* @param wrapper
* @return
*/
@Override
public WenjuandiaochaView selectView(Wrapper<WenjuandiaochaEntity> wrapper) {
return baseMapper.selectView(wrapper);
}
/**
*
* @param params
* @param wrapper
* @return
*/
@Override
public List<Map<String, Object>> selectValue(Map<String, Object> params, Wrapper<WenjuandiaochaEntity> wrapper) {
return baseMapper.selectValue(params, wrapper);
}
/**
*
* @param params
* @param wrapper
* @return
*/
@Override
public List<Map<String, Object>> selectTimeStatValue(Map<String, Object> params, Wrapper<WenjuandiaochaEntity> wrapper) {
return baseMapper.selectTimeStatValue(params, wrapper);
}
/**
*
* @param params
* @param wrapper
* @return
*/
@Override
public List<Map<String, Object>> selectGroup(Map<String, Object> params, Wrapper<WenjuandiaochaEntity> wrapper) {
return baseMapper.selectGroup(params, wrapper);
}
}

@ -3,38 +3,109 @@
<mapper namespace="com.dao.ChatDao">
<!-- 可根据自己的需求,是否要使用 -->
<!--
可根据自己的需求,是否要使用
定义一个resultMap将数据库列映射到com.entity.ChatEntity的属性
-->
<resultMap type="com.entity.ChatEntity" id="chatMap">
<result property="userid" column="userid"/>
<result property="adminid" column="adminid"/>
<result property="ask" column="ask"/>
<result property="reply" column="reply"/>
<result property="isreply" column="isreply"/>
<result property="userid" column="userid"/> <!-- 将数据库列userid映射到ChatEntity的属性userid -->
<result property="adminid" column="adminid"/> <!-- 将数据库列adminid映射到ChatEntity的属性adminid -->
<result property="ask" column="ask"/> <!-- 将数据库列ask映射到ChatEntity的属性ask -->
<result property="reply" column="reply"/> <!-- 将数据库列reply映射到ChatEntity的属性reply -->
<result property="isreply" column="isreply"/> <!-- 将数据库列isreply映射到ChatEntity的属性isreply -->
</resultMap>
<select id="selectListVO"
resultType="com.entity.vo.ChatVO" >
SELECT * FROM chat chat
<!--
分页查询Chat的VO列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.ChatVO
-->
<select id="selectListVO"
resultType="com.entity.vo.ChatVO">
SELECT * FROM chat chat
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
</select>
<select id="selectVO"
resultType="com.entity.vo.ChatVO" >
SELECT chat.* FROM chat chat
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<!--
查询单个Chat的VO记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.ChatVO
-->
<select id="selectVO"
resultType="com.entity.vo.ChatVO">
SELECT chat.* FROM chat chat
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<!--
分页查询Chat的视图列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.view.ChatView
-->
<select id="selectListView"
resultType="com.entity.view.ChatView" >
resultType="com.entity.view.ChatView">
SELECT chat.* FROM chat chat
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<!--
查询单个Chat的视图记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.view.ChatView
-->
<select id="selectView"
resultType="com.entity.view.ChatView">
SELECT * FROM chat chat
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
SELECT chat.* FROM chat chat
<!--
查询Chat的统计值
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为map
这里假设需要查询每个用户和管理员的聊天总数,具体查询逻辑需要根据实际需求编写
-->
<select id="selectValue"
resultType="map">
SELECT COUNT(*) AS total, userid, adminid
FROM chat chat
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
GROUP BY userid, adminid <!-- 按userid和adminid分组统计每个用户和管理员的聊天总数 -->
</select>
<select id="selectView"
resultType="com.entity.view.ChatView" >
SELECT * FROM chat chat <where> 1=1 ${ew.sqlSegment}</where>
</select>
<!--
查询Chat的时间统计值
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为map
这里假设需要查询某个时间范围内的每日聊天总数,具体查询逻辑需要根据实际需求编写
-->
<select id="selectTimeStatValue"
resultType="map">
SELECT DATE(ask) AS date, COUNT(*) AS count
FROM chat chat
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
GROUP BY DATE(ask) <!-- 按ask列的日期分组统计每日聊天总数 -->
</select>
<!--
查询Chat的分组统计值
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为map
这里假设需要查询按isreply字段分组的聊天记录数具体查询逻辑需要根据实际需求编写
-->
<select id="selectGroup"
resultType="map">
SELECT isreply, COUNT(*) AS count
FROM chat chat
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
GROUP BY isreply <!-- 按isreply字段分组统计每个分组的聊天记录数 -->
</select>
</mapper>

@ -2,70 +2,158 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.dao.CommonDao">
<select id="getOption" resultType="String" >
SELECT distinct ${column} FROM ${table}
where ${column} is not null and ${column} !=''
<if test = "conditionColumn != null and conditionValue != null">
and ${conditionColumn}=#{conditionValue}
</if>
<if test = "level != null">
and level=#{level}
</if>
<if test = "parent != null">
and parent=#{parent}
</if>
</select>
<select id="getFollowByOption" resultType="map" >
SELECT * FROM ${table} where ${column}=#{columnValue}
</select>
<!--
查询表中的唯一选项值
@param column 需要查询的列名
@param table 需要查询的表名
@param conditionColumn 附加条件的列名(可选)
@param conditionValue 附加条件的列值(可选)
@param level 级别条件(可选)
@param parent 父级条件(可选)
@return 唯一的选项值列表
-->
<select id="getOption" resultType="String">
SELECT DISTINCT ${column} FROM ${table}
WHERE ${column} IS NOT NULL AND ${column} != ''
<!-- 如果条件列和条件值不为空,则添加相应的条件 -->
<if test="conditionColumn != null and conditionValue != null">
AND ${conditionColumn} = #{conditionValue}
</if>
<!-- 如果级别条件不为空,则添加相应的条件 -->
<if test="level != null">
AND level = #{level}
</if>
<!-- 如果父级条件不为空,则添加相应的条件 -->
<if test="parent != null">
AND parent = #{parent}
</if>
</select>
<!--
根据选项值查询表中的记录
@param column 需要查询的列名
@param columnValue 列的值
@param table 需要查询的表名
@return 符合条件的记录列表
-->
<select id="getFollowByOption" resultType="map">
SELECT * FROM ${table}
WHERE ${column} = #{columnValue}
</select>
<update id="sh">
UPDATE ${table} set sfsh=#{sfsh} where id=#{id}
</update>
<!--
更新表中记录的审核状态
@param table 需要更新的表名
@param sfsh 审核状态
@param id 记录的id
-->
<update id="sh">
UPDATE ${table}
SET sfsh = #{sfsh}
WHERE id = #{id}
</update>
<select id="remindCount" resultType="int" >
SELECT count(1) FROM ${table}
where 1=1
<if test = "type == 1 ">
<if test = " remindstart != null ">
and ${column} &gt;= #{remindstart}
</if>
<if test = " remindend != null ">
and ${column} &lt;= #{remindend}
</if>
</if>
<if test = "type == 2 ">
<if test = " remindstart != null ">
and ${column} &gt;= str_to_date(#{remindstart},'%Y-%m-%d')
</if>
<if test = " remindend != null ">
and ${column} &lt;= str_to_date(#{remindend},'%Y-%m-%d')
</if>
</if>
</select>
<!--
查询表中需要提醒的记录数
@param table 需要查询的表名
@param column 需要查询的列名
@param type 提醒类型1或2
@param remindstart 提醒开始时间
@param remindend 提醒结束时间
@return 符合条件的记录数
-->
<select id="remindCount" resultType="int">
SELECT COUNT(1) FROM ${table}
WHERE 1=1
<!-- 如果类型为1则根据数值范围进行过滤 -->
<if test="type == 1">
<if test="remindstart != null">
AND ${column} >= #{remindstart}
</if>
<if test="remindend != null">
AND ${column} <= #{remindend}
</if>
</if>
<!-- 如果类型为2则根据日期范围进行过滤 -->
<if test="type == 2">
<if test="remindstart != null">
AND ${column} >= STR_TO_DATE(#{remindstart}, '%Y-%m-%d')
</if>
<if test="remindend != null">
AND ${column} <= STR_TO_DATE(#{remindend}, '%Y-%m-%d')
</if>
</if>
</select>
<select id="selectCal" resultType="map" >
SELECT sum(${column}) sum,max(${column}) max,min(${column}) min,avg(${column}) avg FROM ${table}
</select>
<!--
查询表中某一列的统计信息(总和、最大值、最小值、平均值)
@param column 需要查询的列名
@param table 需要查询的表名
@return 包含统计信息的map
-->
<select id="selectCal" resultType="map">
SELECT SUM(${column}) AS sum,
MAX(${column}) AS max,
MIN(${column}) AS min,
AVG(${column}) AS avg
FROM ${table}
</select>
<select id="selectGroup" resultType="map" >
SELECT ${column} , count(1) total FROM ${table} group by ${column}
</select>
<!--
按某一列分组查询记录总数
@param column 需要分组的列名
@param table 需要查询的表名
@return 包含分组信息和记录总数的map列表
-->
<select id="selectGroup" resultType="map">
SELECT ${column},
COUNT(1) AS total
FROM ${table}
GROUP BY ${column}
</select>
<select id="selectValue" resultType="map" >
SELECT ${xColumn}, sum(${yColumn}) total FROM ${table} group by ${xColumn}
</select>
<!--
按某一列分组查询另一列的总和
@param xColumn 需要分组的列名
@param yColumn 需要求和的列名
@param table 需要查询的表名
@return 包含分组信息和总和的map列表
-->
<select id="selectValue" resultType="map">
SELECT ${xColumn},
SUM(${yColumn}) AS total
FROM ${table}
GROUP BY ${xColumn}
</select>
<select id="selectTimeStatValue" resultType="map" >
<if test = 'timeStatType == "日"'>
SELECT DATE_FORMAT(${xColumn},'%Y-%m-%d') ${xColumn}, sum(${yColumn}) total FROM ${table} group by DATE_FORMAT(${xColumn},'%Y-%m-%d')
</if>
<if test = 'timeStatType == "月"'>
SELECT DATE_FORMAT(${xColumn},'%Y-%m') ${xColumn}, sum(${yColumn}) total FROM ${table} group by DATE_FORMAT(${xColumn},'%Y-%m')
</if>
<if test = 'timeStatType == "年"'>
SELECT DATE_FORMAT(${xColumn},'%Y') ${xColumn}, sum(${yColumn}) total FROM ${table} group by DATE_FORMAT(${xColumn},'%Y')
</if>
</select>
<!--
按时间统计查询某一列的总和
@param timeStatType 时间统计类型(日、月、年)
@param xColumn 需要格式化的时间列名
@param yColumn 需要求和的列名
@param table 需要查询的表名
@return 包含格式化时间信息和总和的map列表
-->
<select id="selectTimeStatValue" resultType="map">
<!-- 根据时间统计类型进行不同的日期格式化处理 -->
<if test='timeStatType == "日"'>
SELECT DATE_FORMAT(${xColumn}, '%Y-%m-%d') AS ${xColumn},
SUM(${yColumn}) AS total
FROM ${table}
GROUP BY DATE_FORMAT(${xColumn}, '%Y-%m-%d')
</if>
<if test='timeStatType == "月"'>
SELECT DATE_FORMAT(${xColumn}, '%Y-%m') AS ${xColumn},
SUM(${yColumn}) AS total
FROM ${table}
GROUP BY DATE_FORMAT(${xColumn}, '%Y-%m')
</if>
<if test='timeStatType == "年"'>
SELECT DATE_FORMAT(${xColumn}, '%Y') AS ${xColumn},
SUM(${yColumn}) AS total
FROM ${table}
GROUP BY DATE_FORMAT(${xColumn}, '%Y')
</if>
</select>
</mapper>

@ -1,5 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- 指定XML文档的版本和编码 -->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!-- 声明这是一个MyBatis的Mapper文件并引用MyBatis 3.0的DTD文件 -->
<mapper namespace="com.dao.ConfigDao">
<!-- 定义Mapper的命名空间对应于ConfigDao接口 -->
</mapper>

@ -1,42 +1,71 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- 指定XML文档的版本和编码 -->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!-- 声明这是一个MyBatis的Mapper文件并引用MyBatis 3.0的DTD文件 -->
<mapper namespace="com.dao.ForumDao">
<!-- 定义Mapper的命名空间对应于ForumDao接口 -->
<!-- 可根据自己的需求,是否要使用 -->
<!--
可根据自己的需求,是否要使用
定义一个resultMap将数据库列映射到com.entity.ForumEntity的属性
-->
<resultMap type="com.entity.ForumEntity" id="forumMap">
<result property="title" column="title"/>
<result property="content" column="content"/>
<result property="parentid" column="parentid"/>
<result property="userid" column="userid"/>
<result property="username" column="username"/>
<result property="avatarurl" column="avatarurl"/>
<result property="isdone" column="isdone"/>
<result property="title" column="title"/> <!-- 将数据库列title映射到ForumEntity的属性title -->
<result property="content" column="content"/> <!-- 将数据库列content映射到ForumEntity的属性content -->
<result property="parentid" column="parentid"/> <!-- 将数据库列parentid映射到ForumEntity的属性parentid -->
<result property="userid" column="userid"/> <!-- 将数据库列userid映射到ForumEntity的属性userid -->
<result property="username" column="username"/> <!-- 将数据库列username映射到ForumEntity的属性username -->
<result property="avatarurl" column="avatarurl"/> <!-- 将数据库列avatarurl映射到ForumEntity的属性avatarurl -->
<result property="isdone" column="isdone"/> <!-- 将数据库列isdone映射到ForumEntity的属性isdone -->
</resultMap>
<select id="selectListVO"
resultType="com.entity.vo.ForumVO" >
SELECT * FROM forum forum
<!--
分页查询Forum的VO列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.ForumVO
-->
<select id="selectListVO"
resultType="com.entity.vo.ForumVO">
SELECT * FROM forum forum
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
</select>
<select id="selectVO"
resultType="com.entity.vo.ForumVO" >
SELECT forum.* FROM forum forum
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<!--
查询单个Forum的VO记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.ForumVO
-->
<select id="selectVO"
resultType="com.entity.vo.ForumVO">
SELECT forum.* FROM forum forum
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<!--
分页查询Forum的视图列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.view.ForumView
-->
<select id="selectListView"
resultType="com.entity.view.ForumView" >
SELECT forum.* FROM forum forum
resultType="com.entity.view.ForumView">
SELECT forum.* FROM forum forum
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<select id="selectView"
resultType="com.entity.view.ForumView" >
SELECT * FROM forum forum <where> 1=1 ${ew.sqlSegment}</where>
</select>
</select>
<!--
查询单个Forum的视图记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.view.ForumView
-->
<select id="selectView"
resultType="com.entity.view.ForumView">
SELECT * FROM forum forum
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
</mapper>

@ -1,36 +1,108 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- 指定XML文档的版本和编码 -->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!-- 声明这是一个MyBatis的Mapper文件并引用MyBatis 3.0的DTD文件 -->
<mapper namespace="com.dao.LeixingDao">
<!-- 定义Mapper的命名空间对应于LeixingDao接口 -->
<!-- 可根据自己的需求,是否要使用 -->
<!--
可根据自己的需求,是否要使用
定义一个resultMap将数据库列映射到com.entity.LeixingEntity的属性
-->
<resultMap type="com.entity.LeixingEntity" id="leixingMap">
<result property="leixing" column="leixing"/>
<result property="leixing" column="leixing"/> <!-- 将数据库列leixing映射到LeixingEntity的属性leixing -->
</resultMap>
<select id="selectListVO"
resultType="com.entity.vo.LeixingVO" >
SELECT * FROM leixing leixing
<!--
分页查询Leixing的VO列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.LeixingVO
-->
<select id="selectListVO"
resultType="com.entity.vo.LeixingVO">
SELECT * FROM leixing leixing
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
</select>
<select id="selectVO"
resultType="com.entity.vo.LeixingVO" >
SELECT leixing.* FROM leixing leixing
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<!--
查询单个Leixing的VO记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.LeixingVO
-->
<select id="selectVO"
resultType="com.entity.vo.LeixingVO">
SELECT leixing.* FROM leixing leixing
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
<20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
<select id="selectListView"
resultType="com.entity.view.LeixingView" >
当然,我会在你的代码中添加详细的注释,以确保每个部分的功能和参数都能被详细理解。以下是添加了注释的代码:
```xml
<?xml version="1.0" encoding="UTF-8"?>
<!-- 指定XML文档的版本和编码 -->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!-- 声明这是一个MyBatis的Mapper文件并引用MyBatis 3.0的DTD文件 -->
<mapper namespace="com.dao.LeixingDao">
<!-- 定义Mapper的命名空间对应于LeixingDao接口 -->
SELECT leixing.* FROM leixing leixing
<!--
可根据自己的需求,是否要使用
定义一个resultMap将数据库列映射到com.entity.LeixingEntity的属性
-->
<resultMap type="com.entity.LeixingEntity" id="leixingMap">
<result property="leixing" column="leixing"/> <!-- 将数据库列leixing映射到LeixingEntity的属性leixing -->
</resultMap>
<!--
分页查询Leixing的VO列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.LeixingVO
-->
<select id="selectListVO"
resultType="com.entity.vo.LeixingVO">
SELECT * FROM leixing leixing
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
</select>
<select id="selectView"
resultType="com.entity.view.LeixingView" >
SELECT * FROM leixing leixing <where> 1=1 ${ew.sqlSegment}</where>
</select>
<!--
查询单个Leixing的VO记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.LeixingVO
-->
<select id="selectVO"
resultType="com.entity.vo.LeixingVO">
SELECT leixing.* FROM leixing leixing
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<!--
分页查询Leixing的视图列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.view.LeixingView
-->
<select id="selectListView"
resultType="com.entity.view.LeixingView">
SELECT leixing.* FROM leixing leixing
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<!--
查询单个Leixing的视图记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.view.LeixingView
-->
<select id="selectView"
resultType="com.entity.view.LeixingView">
SELECT * FROM leixing leixing
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
</mapper>

@ -1,39 +1,68 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- 指定XML文档的版本和编码 -->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!-- 声明这是一个MyBatis的Mapper文件并引用MyBatis 3.0的DTD文件 -->
<mapper namespace="com.dao.NewsDao">
<!-- 定义Mapper的命名空间对应于NewsDao接口 -->
<!-- 可根据自己的需求,是否要使用 -->
<!--
可根据自己的需求,是否要使用
定义一个resultMap将数据库列映射到com.entity.NewsEntity的属性
-->
<resultMap type="com.entity.NewsEntity" id="newsMap">
<result property="title" column="title"/>
<result property="introduction" column="introduction"/>
<result property="picture" column="picture"/>
<result property="content" column="content"/>
<result property="title" column="title"/> <!-- 将数据库列title映射到NewsEntity的属性title -->
<result property="introduction" column="introduction"/> <!-- 将数据库列introduction映射到NewsEntity的属性introduction -->
<result property="picture" column="picture"/> <!-- 将数据库列picture映射到NewsEntity的属性picture -->
<result property="content" column="content"/> <!-- 将数据库列content映射到NewsEntity的属性content -->
</resultMap>
<select id="selectListVO"
resultType="com.entity.vo.NewsVO" >
SELECT * FROM news news
<!--
分页查询News的VO列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.NewsVO
-->
<select id="selectListVO"
resultType="com.entity.vo.NewsVO">
SELECT * FROM news news
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
</select>
<select id="selectVO"
resultType="com.entity.vo.NewsVO" >
SELECT news.* FROM news news
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<!--
查询单个News的VO记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.NewsVO
-->
<select id="selectVO"
resultType="com.entity.vo.NewsVO">
SELECT news.* FROM news news
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<!--
分页查询News的视图列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.view.NewsView
-->
<select id="selectListView"
resultType="com.entity.view.NewsView" >
SELECT news.* FROM news news
resultType="com.entity.view.NewsView">
SELECT news.* FROM news news
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<select id="selectView"
resultType="com.entity.view.NewsView" >
SELECT * FROM news news <where> 1=1 ${ew.sqlSegment}</where>
</select>
</select>
<!--
查询单个News的视图记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.view.NewsView
-->
<select id="selectView"
resultType="com.entity.view.NewsView">
SELECT * FROM news news
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
</mapper>

@ -1,43 +1,72 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- 指定XML文档的版本和编码 -->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!-- 声明这是一个MyBatis的Mapper文件并引用MyBatis 3.0的DTD文件 -->
<mapper namespace="com.dao.StoreupDao">
<!-- 定义Mapper的命名空间对应于StoreupDao接口 -->
<!-- 可根据自己的需求,是否要使用 -->
<!--
可根据自己的需求,是否要使用
定义一个resultMap将数据库列映射到com.entity.StoreupEntity的属性
-->
<resultMap type="com.entity.StoreupEntity" id="storeupMap">
<result property="userid" column="userid"/>
<result property="refid" column="refid"/>
<result property="tablename" column="tablename"/>
<result property="name" column="name"/>
<result property="picture" column="picture"/>
<result property="type" column="type"/>
<result property="inteltype" column="inteltype"/>
<result property="remark" column="remark"/>
<result property="userid" column="userid"/> <!-- 将数据库列userid映射到StoreupEntity的属性userid -->
<result property="refid" column="refid"/> <!-- 将数据库列refid映射到StoreupEntity的属性refid -->
<result property="tablename" column="tablename"/> <!-- 将数据库列tablename映射到StoreupEntity的属性tablename -->
<result property="name" column="name"/> <!-- 将数据库列name映射到StoreupEntity的属性name -->
<result property="picture" column="picture"/> <!-- 将数据库列picture映射到StoreupEntity的属性picture -->
<result property="type" column="type"/> <!-- 将数据库列type映射到StoreupEntity的属性type -->
<result property="inteltype" column="inteltype"/> <!-- 将数据库列inteltype映射到StoreupEntity的属性inteltype -->
<result property="remark" column="remark"/> <!-- 将数据库列remark映射到StoreupEntity的属性remark -->
</resultMap>
<select id="selectListVO"
resultType="com.entity.vo.StoreupVO" >
SELECT * FROM storeup storeup
<!--
分页查询Storeup的VO列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.StoreupVO
-->
<select id="selectListVO"
resultType="com.entity.vo.StoreupVO">
SELECT * FROM storeup storeup
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
</select>
<select id="selectVO"
resultType="com.entity.vo.StoreupVO" >
SELECT storeup.* FROM storeup storeup
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<!--
查询单个Storeup的VO记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.StoreupVO
-->
<select id="selectVO"
resultType="com.entity.vo.StoreupVO">
SELECT storeup.* FROM storeup storeup
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<!--
分页查询Storeup的视图列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.view.StoreupView
-->
<select id="selectListView"
resultType="com.entity.view.StoreupView" >
SELECT storeup.* FROM storeup storeup
resultType="com.entity.view.StoreupView">
SELECT storeup.* FROM storeup storeup
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<select id="selectView"
resultType="com.entity.view.StoreupView" >
SELECT * FROM storeup storeup <where> 1=1 ${ew.sqlSegment}</where>
</select>
</select>
<!--
查询单个Storeup的视图记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.view.StoreupView
-->
<select id="selectView"
resultType="com.entity.view.StoreupView">
SELECT * FROM storeup storeup
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
</mapper>

@ -1,41 +1,70 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- 指定XML文档的版本和编码 -->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!-- 声明这是一个MyBatis的Mapper文件并引用MyBatis 3.0的DTD文件 -->
<mapper namespace="com.dao.SystemintroDao">
<!-- 定义Mapper的命名空间对应于SystemintroDao接口 -->
<!-- 可根据自己的需求,是否要使用 -->
<!--
可根据自己的需求,是否要使用
定义一个resultMap将数据库列映射到com.entity.SystemintroEntity的属性
-->
<resultMap type="com.entity.SystemintroEntity" id="systemintroMap">
<result property="title" column="title"/>
<result property="subtitle" column="subtitle"/>
<result property="content" column="content"/>
<result property="picture1" column="picture1"/>
<result property="picture2" column="picture2"/>
<result property="picture3" column="picture3"/>
<result property="title" column="title"/> <!-- 将数据库列title映射到SystemintroEntity的属性title -->
<result property="subtitle" column="subtitle"/> <!-- 将数据库列subtitle映射到SystemintroEntity的属性subtitle -->
<result property="content" column="content"/> <!-- 将数据库列content映射到SystemintroEntity的属性content -->
<result property="picture1" column="picture1"/> <!-- 将数据库列picture1映射到SystemintroEntity的属性picture1 -->
<result property="picture2" column="picture2"/> <!-- 将数据库列picture2映射到SystemintroEntity的属性picture2 -->
<result property="picture3" column="picture3"/> <!-- 将数据库列picture3映射到SystemintroEntity的属性picture3 -->
</resultMap>
<select id="selectListVO"
resultType="com.entity.vo.SystemintroVO" >
SELECT * FROM systemintro systemintro
<!--
分页查询Systemintro的VO列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.SystemintroVO
-->
<select id="selectListVO"
resultType="com.entity.vo.SystemintroVO">
SELECT * FROM systemintro systemintro
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
</select>
<select id="selectVO"
resultType="com.entity.vo.SystemintroVO" >
SELECT systemintro.* FROM systemintro systemintro
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<!--
查询单个Systemintro的VO记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.SystemintroVO
-->
<select id="selectVO"
resultType="com.entity.vo.SystemintroVO">
SELECT systemintro.* FROM systemintro systemintro
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<!--
分页查询Systemintro的视图列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.view.SystemintroView
-->
<select id="selectListView"
resultType="com.entity.view.SystemintroView" >
SELECT systemintro.* FROM systemintro systemintro
resultType="com.entity.view.SystemintroView">
SELECT systemintro.* FROM systemintro systemintro
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<select id="selectView"
resultType="com.entity.view.SystemintroView" >
SELECT * FROM systemintro systemintro <where> 1=1 ${ew.sqlSegment}</where>
</select>
</select>
<!--
查询单个Systemintro的视图记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.view.SystemintroView
-->
<select id="selectView"
resultType="com.entity.view.SystemintroView">
SELECT * FROM systemintro systemintro
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
</mapper>

@ -1,13 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- 指定XML文档的版本和编码 -->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!-- 声明这是一个MyBatis的Mapper文件并引用MyBatis 3.0的DTD文件 -->
<mapper namespace="com.dao.TokenDao">
<!-- 定义Mapper的命名空间对应于TokenDao接口 -->
<!--
分页查询Token的视图列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.TokenEntity
-->
<select id="selectListView"
resultType="com.entity.TokenEntity" >
SELECT t.* FROM token t
resultType="com.entity.TokenEntity" >
SELECT t.* FROM token t
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
</select>
</mapper>

@ -1,13 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- 指定XML文档的版本和编码 -->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!-- 声明这是一个MyBatis的Mapper文件并引用MyBatis 3.0的DTD文件 -->
<mapper namespace="com.dao.UsersDao">
<!-- 定义Mapper的命名空间对应于UsersDao接口 -->
<!--
分页查询Users的视图列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.UsersEntity
-->
<select id="selectListView"
resultType="com.entity.UsersEntity" >
SELECT u.* FROM users u
resultType="com.entity.UsersEntity" >
SELECT u.* FROM users u
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
</select>
</mapper>

@ -1,84 +1,138 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- 指定XML文档的版本和编码 -->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!-- 声明这是一个MyBatis的Mapper文件并引用MyBatis 3.0的DTD文件 -->
<mapper namespace="com.dao.WenjuandafuDao">
<!-- 定义Mapper的命名空间对应于WenjuandafuDao接口 -->
<!-- 可根据自己的需求,是否要使用 -->
<!--
可根据自己的需求,是否要使用
定义一个resultMap将数据库列映射到com.entity.WenjuandafuEntity的属性
-->
<resultMap type="com.entity.WenjuandafuEntity" id="wenjuandafuMap">
<result property="wenjuanbiaoti" column="wenjuanbiaoti"/>
<result property="leixing" column="leixing"/>
<result property="wentiyi" column="wentiyi"/>
<result property="dafuyi" column="dafuyi"/>
<result property="wentier" column="wentier"/>
<result property="dafuer" column="dafuer"/>
<result property="wentisan" column="wentisan"/>
<result property="dafusan" column="dafusan"/>
<result property="wentisi" column="wentisi"/>
<result property="dafusi" column="dafusi"/>
<result property="wentiwu" column="wentiwu"/>
<result property="dafuwu" column="dafuwu"/>
<result property="zhanghao" column="zhanghao"/>
<result property="xingming" column="xingming"/>
<result property="tijiaoriqi" column="tijiaoriqi"/>
<result property="wenjuanbiaoti" column="wenjuanbiaoti"/> <!-- 将数据库列wenjuanbiaoti映射到WenjuandafuEntity的属性wenjuanbiaoti -->
<result property="leixing" column="leixing"/> <!-- 将数据库列leixing映射到WenjuandafuEntity的属性leixing -->
<result property="wentiyi" column="wentiyi"/> <!-- 将数据库列wentiyi映射到WenjuandafuEntity的属性wentiyi -->
<result property="dafuyi" column="dafuyi"/> <!-- 将数据库列dafuyi映射到WenjuandafuEntity的属性dafuyi -->
<result property="wentier" column="wentier"/> <!-- 将数据库列wentier映射到WenjuandafuEntity的属性wentier -->
<result property="dafuer" column="dafuer"/> <!-- 将数据库列dafuer映射到WenjuandafuEntity的属性dafuer -->
<result property="wentisan" column="wentisan"/> <!-- 将数据库列wentisan映射到WenjuandafuEntity的属性wentisan -->
<result property="dafusan" column="dafusan"/> <!-- 将数据库列dafusan映射到WenjuandafuEntity的属性dafusan -->
<result property="wentisi" column="wentisi"/> <!-- 将数据库列wentisi映射到WenjuandafuEntity的属性wentisi -->
<result property="dafusi" column="dafusi"/> <!-- 将数据库列dafusi映射到WenjuandafuEntity的属性dafusi -->
<result property="wentiwu" column="wentiwu"/> <!-- 将数据库列wentiwu映射到WenjuandafuEntity的属性wentiwu -->
<result property="dafuwu" column="dafuwu"/> <!-- 将数据库列dafuwu映射到WenjuandafuEntity的属性dafuwu -->
<result property="zhanghao" column="zhanghao"/> <!-- 将数据库列zhanghao映射到WenjuandafuEntity的属性zhanghao -->
<result property="xingming" column="xingming"/> <!-- 将数据库列xingming映射到WenjuandafuEntity的属性xingming -->
<result property="tijiaoriqi" column="tijiaoriqi"/> <!-- 将数据库列tijiaoriqi映射到WenjuandafuEntity的属性tijiaoriqi -->
</resultMap>
<select id="selectListVO"
resultType="com.entity.vo.WenjuandafuVO" >
SELECT * FROM wenjuandafu wenjuandafu
<!--
分页查询Wenjuandafu的VO列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.WenjuandafuVO
-->
<select id="selectListVO"
resultType="com.entity.vo.WenjuandafuVO">
SELECT * FROM wenjuandafu wenjuandafu
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
</select>
<select id="selectVO"
resultType="com.entity.vo.WenjuandafuVO" >
SELECT wenjuandafu.* FROM wenjuandafu wenjuandafu
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<!--
查询单个Wenjuandafu的VO记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.WenjuandafuVO
-->
<select id="selectVO"
resultType="com.entity.vo.WenjuandafuVO">
SELECT wenjuandafu.* FROM wenjuandafu wenjuandafu
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<!--
分页查询Wenjuandafu的视图列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.view.WenjuandafuView
-->
<select id="selectListView"
resultType="com.entity.view.WenjuandafuView" >
SELECT wenjuandafu.* FROM wenjuandafu wenjuandafu
resultType="com.entity.view.WenjuandafuView">
SELECT wenjuandafu.* FROM wenjuandafu wenjuandafu
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<select id="selectView"
resultType="com.entity.view.WenjuandafuView" >
SELECT * FROM wenjuandafu wenjuandafu <where> 1=1 ${ew.sqlSegment}</where>
</select>
</select>
<!--
查询单个Wenjuandafu的视图记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.view.WenjuandafuView
-->
<select id="selectView"
resultType="com.entity.view.WenjuandafuView">
SELECT * FROM wenjuandafu wenjuandafu
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<select id="selectValue" resultType="map" >
SELECT ${params.xColumn}, sum(${params.yColumn}) total FROM wenjuandafu
<!--
查询Wenjuandafu的统计值
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为map
@param params 包含查询参数的map包括xColumn和yColumn
@return 包含统计值的map列表
-->
<select id="selectValue" resultType="map">
SELECT ${params.xColumn}, sum(${params.yColumn}) AS total FROM wenjuandafu
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
group by ${params.xColumn}
limit 10
GROUP BY ${params.xColumn} <!-- 按xColumn分组统计每个组的yColumn总和 -->
LIMIT 10 <!-- 限制结果集最多返回10条记录 -->
</select>
<select id="selectTimeStatValue" resultType="map" >
<if test = 'params.timeStatType == "日"'>
SELECT DATE_FORMAT(${params.xColumn},'%Y-%m-%d') ${params.xColumn}, sum(${params.yColumn}) total FROM wenjuandafu
<where> 1=1 ${ew.sqlSegment}</where>
group by DATE_FORMAT(${params.xColumn},'%Y-%m-%d')
<!--
查询Wenjuandafu的时间统计值
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为map
@param params 包含查询参数的map包括timeStatType、xColumn和yColumn
@return 包含时间统计值的map列表
-->
<select id="selectTimeStatValue" resultType="map">
<!-- 根据时间统计类型进行不同的日期格式化处理 -->
<if test='params.timeStatType == "日"'>
SELECT DATE_FORMAT(${params.xColumn}, '%Y-%m-%d') AS ${params.xColumn}, sum(${params.yColumn}) AS total FROM wenjuandafu
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
GROUP BY DATE_FORMAT(${params.xColumn}, '%Y-%m-%d') <!-- 按日分组统计每个组的yColumn总和 -->
</if>
<if test = 'params.timeStatType == "月"'>
SELECT DATE_FORMAT(${params.xColumn},'%Y-%m') ${params.xColumn}, sum(${params.yColumn}) total FROM wenjuandafu
<where> 1=1 ${ew.sqlSegment}</where>
group by DATE_FORMAT(${params.xColumn},'%Y-%m')
<if test='params.timeStatType == "月"'>
SELECT DATE_FORMAT(${params.xColumn}, '%Y-%m') AS ${params.xColumn}, sum(${params.yColumn}) AS total FROM wenjuandafu
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
GROUP BY DATE_FORMAT(${params.xColumn}, '%Y-%m') <!-- 按月分组统计每个组的yColumn总和 -->
</if>
<if test = 'params.timeStatType == "年"'>
SELECT DATE_FORMAT(${params.xColumn},'%Y') ${params.xColumn}, sum(${params.yColumn}) total FROM wenjuandafu
<where> 1=1 ${ew.sqlSegment}</where>
group by DATE_FORMAT(${params.xColumn},'%Y')
<if test='params.timeStatType == "年"'>
SELECT DATE_FORMAT(${params.xColumn}, '%Y') AS ${params.xColumn}, sum(${params.yColumn}) AS total FROM wenjuandafu
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
GROUP BY DATE_FORMAT(${params.xColumn}, '%Y') <!-- 按年分组统计每个组的yColumn总和 -->
</if>
</select>
<select id="selectGroup" resultType="map" >
SELECT ${params.column} , count(1) total FROM wenjuandafu
<!--
查询Wenjuandafu的分组统计值
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为map
@param params 包含查询参数的map包括column
@return 包含分组统计值的map列表
-->
<select id="selectGroup" resultType="map">
SELECT ${params.column}, count(1) AS total FROM wenjuandafu
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
group by ${params.column}
limit 10
GROUP BY ${params.column} <!-- 按column分组统计每个组的记录数 -->
LIMIT 10 <!-- 限制结果集最多返回10条记录 -->
</select>
</mapper>

@ -1,79 +1,133 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- 指定XML文档的版本和编码 -->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!-- 声明这是一个MyBatis的Mapper文件并引用MyBatis 3.0的DTD文件 -->
<mapper namespace="com.dao.WenjuandiaochaDao">
<!-- 定义Mapper的命名空间对应于WenjuandiaochaDao接口 -->
<!-- 可根据自己的需求,是否要使用 -->
<!--
可根据自己的需求,是否要使用
定义一个resultMap将数据库列映射到com.entity.WenjuandiaochaEntity的属性
-->
<resultMap type="com.entity.WenjuandiaochaEntity" id="wenjuandiaochaMap">
<result property="wenjuanbiaoti" column="wenjuanbiaoti"/>
<result property="fengmiantupian" column="fengmiantupian"/>
<result property="leixing" column="leixing"/>
<result property="wentiyi" column="wentiyi"/>
<result property="wentier" column="wentier"/>
<result property="wentisan" column="wentisan"/>
<result property="wentisi" column="wentisi"/>
<result property="wentiwu" column="wentiwu"/>
<result property="faburiqi" column="faburiqi"/>
<result property="clicktime" column="clicktime"/>
<result property="wenjuanbiaoti" column="wenjuanbiaoti"/> <!-- 将数据库列wenjuanbiaoti映射到WenjuandiaochaEntity的属性wenjuanbiaoti -->
<result property="fengmiantupian" column="fengmiantupian"/> <!-- 将数据库列fengmiantupian映射到WenjuandiaochaEntity的属性fengmiantupian -->
<result property="leixing" column="leixing"/> <!-- 将数据库列leixing映射到WenjuandiaochaEntity的属性leixing -->
<result property="wentiyi" column="wentiyi"/> <!-- 将数据库列wentiyi映射到WenjuandiaochaEntity的属性wentiyi -->
<result property="wentier" column="wentier"/> <!-- 将数据库列wentier映射到WenjuandiaochaEntity的属性wentier -->
<result property="wentisan" column="wentisan"/> <!-- 将数据库列wentisan映射到WenjuandiaochaEntity的属性wentisan -->
<result property="wentisi" column="wentisi"/> <!-- 将数据库列wentisi映射到WenjuandiaochaEntity的属性wentisi -->
<result property="wentiwu" column="wentiwu"/> <!-- 将数据库列wentiwu映射到WenjuandiaochaEntity的属性wentiwu -->
<result property="faburiqi" column="faburiqi"/> <!-- 将数据库列faburiqi映射到WenjuandiaochaEntity的属性faburiqi -->
<result property="clicktime" column="clicktime"/> <!-- 将数据库列clicktime映射到WenjuandiaochaEntity的属性clicktime -->
</resultMap>
<select id="selectListVO"
resultType="com.entity.vo.WenjuandiaochaVO" >
SELECT * FROM wenjuandiaocha wenjuandiaocha
<!--
分页查询Wenjuandiaocha的VO列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.WenjuandiaochaVO
-->
<select id="selectListVO"
resultType="com.entity.vo.WenjuandiaochaVO">
SELECT * FROM wenjuandiaocha wenjuandiaocha
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
</select>
<select id="selectVO"
resultType="com.entity.vo.WenjuandiaochaVO" >
SELECT wenjuandiaocha.* FROM wenjuandiaocha wenjuandiaocha
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<!--
查询单个Wenjuandiaocha的VO记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.WenjuandiaochaVO
-->
<select id="selectVO"
resultType="com.entity.vo.WenjuandiaochaVO">
SELECT wenjuandiaocha.* FROM wenjuandiaocha wenjuandiaocha
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<!--
分页查询Wenjuandiaocha的视图列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.view.WenjuandiaochaView
-->
<select id="selectListView"
resultType="com.entity.view.WenjuandiaochaView" >
SELECT wenjuandiaocha.* FROM wenjuandiaocha wenjuandiaocha
resultType="com.entity.view.WenjuandiaochaView">
SELECT wenjuandiaocha.* FROM wenjuandiaocha wenjuandiaocha
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<select id="selectView"
resultType="com.entity.view.WenjuandiaochaView" >
SELECT * FROM wenjuandiaocha wenjuandiaocha <where> 1=1 ${ew.sqlSegment}</where>
</select>
</select>
<!--
查询单个Wenjuandiaocha的视图记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.view.WenjuandiaochaView
-->
<select id="selectView"
resultType="com.entity.view.WenjuandiaochaView">
SELECT * FROM wenjuandiaocha wenjuandiaocha
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<select id="selectValue" resultType="map" >
SELECT ${params.xColumn}, sum(${params.yColumn}) total FROM wenjuandiaocha
<!--
查询Wenjuandiaocha的统计值
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为map
@param params 包含查询参数的map包括xColumn和yColumn
@return 包含统计值的map列表
-->
<select id="selectValue" resultType="map">
SELECT ${params.xColumn}, sum(${params.yColumn}) AS total FROM wenjuandiaocha
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
group by ${params.xColumn}
limit 10
GROUP BY ${params.xColumn} <!-- 按xColumn分组统计每个组的yColumn总和 -->
LIMIT 10 <!-- 限制结果集最多返回10条记录 -->
</select>
<select id="selectTimeStatValue" resultType="map" >
<if test = 'params.timeStatType == "日"'>
SELECT DATE_FORMAT(${params.xColumn},'%Y-%m-%d') ${params.xColumn}, sum(${params.yColumn}) total FROM wenjuandiaocha
<where> 1=1 ${ew.sqlSegment}</where>
group by DATE_FORMAT(${params.xColumn},'%Y-%m-%d')
<!--
查询Wenjuandiaocha的时间统计值
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为map
@param params 包含查询参数的map包括timeStatType、xColumn和yColumn
@return 包含时间统计值的map列表
-->
<select id="selectTimeStatValue" resultType="map">
<!-- 根据时间统计类型进行不同的日期格式化处理 -->
<if test='params.timeStatType == "日"'>
SELECT DATE_FORMAT(${params.xColumn}, '%Y-%m-%d') AS ${params.xColumn}, sum(${params.yColumn}) AS total FROM wenjuandiaocha
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
GROUP BY DATE_FORMAT(${params.xColumn}, '%Y-%m-%d') <!-- 按日分组统计每个组的yColumn总和 -->
</if>
<if test = 'params.timeStatType == "月"'>
SELECT DATE_FORMAT(${params.xColumn},'%Y-%m') ${params.xColumn}, sum(${params.yColumn}) total FROM wenjuandiaocha
<where> 1=1 ${ew.sqlSegment}</where>
group by DATE_FORMAT(${params.xColumn},'%Y-%m')
<if test='params.timeStatType == "月"'>
SELECT DATE_FORMAT(${params.xColumn}, '%Y-%m') AS ${params.xColumn}, sum(${params.yColumn}) AS total FROM wenjuandiaocha
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
GROUP BY DATE_FORMAT(${params.xColumn}, '%Y-%m') <!-- 按月分组统计每个组的yColumn总和 -->
</if>
<if test = 'params.timeStatType == "年"'>
SELECT DATE_FORMAT(${params.xColumn},'%Y') ${params.xColumn}, sum(${params.yColumn}) total FROM wenjuandiaocha
<where> 1=1 ${ew.sqlSegment}</where>
group by DATE_FORMAT(${params.xColumn},'%Y')
<if test='params.timeStatType == "年"'>
SELECT DATE_FORMAT(${params.xColumn}, '%Y') AS ${params.xColumn}, sum(${params.yColumn}) AS total FROM wenjuandiaocha
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
GROUP BY DATE_FORMAT(${params.xColumn}, '%Y') <!-- 按年分组统计每个组的yColumn总和 -->
</if>
</select>
<select id="selectGroup" resultType="map" >
SELECT ${params.column} , count(1) total FROM wenjuandiaocha
<!--
查询Wenjuandiaocha的分组统计值
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为map
@param params 包含查询参数的map包括column
@return 包含分组统计值的map列表
-->
<select id="selectGroup" resultType="map">
SELECT ${params.column}, count(1) AS total FROM wenjuandiaocha
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
group by ${params.column}
limit 10
GROUP BY ${params.column} <!-- 按column分组统计每个组的记录数 -->
LIMIT 10 <!-- 限制结果集最多返回10条记录 -->
</select>
</mapper>

@ -1,76 +1,130 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- 指定XML文档的版本和编码 -->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!-- 声明这是一个MyBatis的Mapper文件并引用MyBatis 3.0的DTD文件 -->
<mapper namespace="com.dao.YonghuDao">
<!-- 定义Mapper的命名空间对应于YonghuDao接口 -->
<!-- 可根据自己的需求,是否要使用 -->
<!--
可根据自己的需求,是否要使用
定义一个resultMap将数据库列映射到com.entity.YonghuEntity的属性
-->
<resultMap type="com.entity.YonghuEntity" id="yonghuMap">
<result property="zhanghao" column="zhanghao"/>
<result property="mima" column="mima"/>
<result property="xingming" column="xingming"/>
<result property="xingbie" column="xingbie"/>
<result property="youxiang" column="youxiang"/>
<result property="shoujihaoma" column="shoujihaoma"/>
<result property="touxiang" column="touxiang"/>
<result property="zhanghao" column="zhanghao"/> <!-- 将数据库列zhanghao映射到YonghuEntity的属性zhanghao -->
<result property="mima" column="mima"/> <!-- 将数据库列mima映射到YonghuEntity的属性mima -->
<result property="xingming" column="xingming"/> <!-- 将数据库列xingming映射到YonghuEntity的属性xingming -->
<result property="xingbie" column="xingbie"/> <!-- 将数据库列xingbie映射到YonghuEntity的属性xingbie -->
<result property="youxiang" column="youxiang"/> <!-- 将数据库列youxiang映射到YonghuEntity的属性youxiang -->
<result property="shoujihaoma" column="shoujihaoma"/> <!-- 将数据库列shoujihaoma映射到YonghuEntity的属性shoujihaoma -->
<result property="touxiang" column="touxiang"/> <!-- 将数据库列touxiang映射到YonghuEntity的属性touxiang -->
</resultMap>
<select id="selectListVO"
resultType="com.entity.vo.YonghuVO" >
SELECT * FROM yonghu yonghu
<!--
分页查询Yonghu的VO列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.YonghuVO
-->
<select id="selectListVO"
resultType="com.entity.vo.YonghuVO">
SELECT * FROM yonghu yonghu
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
</select>
<select id="selectVO"
resultType="com.entity.vo.YonghuVO" >
SELECT yonghu.* FROM yonghu yonghu
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<!--
查询单个Yonghu的VO记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.vo.YonghuVO
-->
<select id="selectVO"
resultType="com.entity.vo.YonghuVO">
SELECT yonghu.* FROM yonghu yonghu
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<!--
分页查询Yonghu的视图列表
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.view.YonghuView
-->
<select id="selectListView"
resultType="com.entity.view.YonghuView" >
SELECT yonghu.* FROM yonghu yonghu
resultType="com.entity.view.YonghuView">
SELECT yonghu.* FROM yonghu yonghu
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<select id="selectView"
resultType="com.entity.view.YonghuView" >
SELECT * FROM yonghu yonghu <where> 1=1 ${ew.sqlSegment}</where>
</select>
</select>
<!--
查询单个Yonghu的视图记录
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为com.entity.view.YonghuView
-->
<select id="selectView"
resultType="com.entity.view.YonghuView">
SELECT * FROM yonghu yonghu
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
</select>
<select id="selectValue" resultType="map" >
SELECT ${params.xColumn}, sum(${params.yColumn}) total FROM yonghu
<!--
查询Yonghu的统计值
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为map
@param params 包含查询参数的map包括xColumn和yColumn
@return 包含统计值的map列表
-->
<select id="selectValue" resultType="map">
SELECT ${params.xColumn}, sum(${params.yColumn}) AS total FROM yonghu
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
group by ${params.xColumn}
limit 10
GROUP BY ${params.xColumn} <!-- 按xColumn分组统计每个组的yColumn总和 -->
LIMIT 10 <!-- 限制结果集最多返回10条记录 -->
</select>
<select id="selectTimeStatValue" resultType="map" >
<if test = 'params.timeStatType == "日"'>
SELECT DATE_FORMAT(${params.xColumn},'%Y-%m-%d') ${params.xColumn}, sum(${params.yColumn}) total FROM yonghu
<where> 1=1 ${ew.sqlSegment}</where>
group by DATE_FORMAT(${params.xColumn},'%Y-%m-%d')
<!--
查询Yonghu的时间统计值
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为map
@param params 包含查询参数的map包括timeStatType、xColumn和yColumn
@return 包含时间统计值的map列表
-->
<select id="selectTimeStatValue" resultType="map">
<!-- 根据时间统计类型进行不同的日期格式化处理 -->
<if test='params.timeStatType == "日"'>
SELECT DATE_FORMAT(${params.xColumn}, '%Y-%m-%d') AS ${params.xColumn}, sum(${params.yColumn}) AS total FROM yonghu
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
GROUP BY DATE_FORMAT(${params.xColumn}, '%Y-%m-%d') <!-- 按日分组统计每个组的yColumn总和 -->
</if>
<if test = 'params.timeStatType == "月"'>
SELECT DATE_FORMAT(${params.xColumn},'%Y-%m') ${params.xColumn}, sum(${params.yColumn}) total FROM yonghu
<where> 1=1 ${ew.sqlSegment}</where>
group by DATE_FORMAT(${params.xColumn},'%Y-%m')
<if test='params.timeStatType == "月"'>
SELECT DATE_FORMAT(${params.xColumn}, '%Y-%m') AS ${params.xColumn}, sum(${params.yColumn}) AS total FROM yonghu
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
GROUP BY DATE_FORMAT(${params.xColumn}, '%Y-%m') <!-- 按月分组统计每个组的yColumn总和 -->
</if>
<if test = 'params.timeStatType == "年"'>
SELECT DATE_FORMAT(${params.xColumn},'%Y') ${params.xColumn}, sum(${params.yColumn}) total FROM yonghu
<where> 1=1 ${ew.sqlSegment}</where>
group by DATE_FORMAT(${params.xColumn},'%Y')
<if test='params.timeStatType == "年"'>
SELECT DATE_FORMAT(${params.xColumn}, '%Y') AS ${params.xColumn}, sum(${params.yColumn}) AS total FROM yonghu
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
GROUP BY DATE_FORMAT(${params.xColumn}, '%Y') <!-- 按年分组统计每个组的yColumn总和 -->
</if>
</select>
<select id="selectGroup" resultType="map" >
SELECT ${params.column} , count(1) total FROM yonghu
<!--
查询Yonghu的分组统计值
使用${ew.sqlSegment}来动态拼接SQL条件
resultType指定返回的结果类型为map
@param params 包含查询参数的map包括column
@return 包含分组统计值的map列表
-->
<select id="selectGroup" resultType="map">
SELECT ${params.column}, count(1) AS total FROM yonghu
<!-- 动态SQL条件1=1是为了方便添加WHERE子句中的其他条件 -->
<where> 1=1 ${ew.sqlSegment}</where>
group by ${params.column}
limit 10
GROUP BY ${params.column} <!-- 按column分组统计每个组的记录数 -->
LIMIT 10 <!-- 限制结果集最多返回10条记录 -->
</select>
</mapper>

Loading…
Cancel
Save