demo数据及广告管理功能

This commit is contained in:
chenbo 2020-03-26 20:07:54 +08:00
parent 0ff8b08011
commit 190d751289
8 changed files with 37792 additions and 0 deletions

View File

@ -0,0 +1,42 @@
import request from '@/utils/request'
export function listArticle(query) {
return request({
url: '/article/list',
method: 'get',
params: query
})
}
export function deleteArticle(data) {
return request({
url: '/article/delete',
method: 'post',
data
})
}
export function publishArticle(data) {
return request({
url: '/article/create',
method: 'post',
data
})
}
export function detailArticle(id) {
return request({
url: '/article/detail',
method: 'get',
params: { id }
})
}
export function editArticle(data) {
return request({
url: '/article/update',
method: 'post',
data
})
}

View File

@ -0,0 +1,145 @@
<template>
<div class="app-container">
<el-card class="box-card">
<h3>新增信息公告</h3>
<el-form ref="article" :rules="rules" v-model="article" label-width="150px">
<el-form-item label="类型" prop="type">
<el-radio-group v-model="article.type">
<el-radio :label="'1'">公告</el-radio>
<el-radio :label="'0'">通知</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="标题" prop="title">
<el-input v-model="article.title"/>
</el-form-item>
<el-form-item label="内容">
<editor :init="editorInit" v-model="article.content"/>
</el-form-item>
</el-form>
</el-card>
<div class="op-container">
<el-button @click="handleCancel">取消</el-button>
<el-button type="primary" @click="handlePublish">发布</el-button>
</div>
</div>
</template>
<style>
.el-card {
margin-bottom: 10px;
}
.el-tag + .el-tag {
margin-left: 10px;
}
.input-new-keyword {
width: 90px;
margin-left: 10px;
vertical-align: bottom;
}
.avatar-uploader .el-upload {
width: 145px;
height: 145px;
border: 1px dashed #d9d9d9;
border-radius: 6px;
cursor: pointer;
position: relative;
overflow: hidden;
}
.avatar-uploader .el-upload:hover {
border-color: #20a0ff;
}
.avatar-uploader-icon {
font-size: 28px;
color: #8c939d;
width: 120px;
height: 120px;
line-height: 120px;
text-align: center;
}
.avatar {
width: 145px;
height: 145px;
display: block;
}
</style>
<script>
import { publishArticle } from '@/api/article'
import { createStorage, uploadPath } from '@/api/storage'
import Editor from '@tinymce/tinymce-vue'
import { MessageBox } from 'element-ui'
import { getToken } from '@/utils/auth'
export default {
name: 'ArticleCreate',
components: { Editor },
data() {
return {
uploadPath,
article: { type: '1' },
rules: {
title: [{ required: true, message: '标题不能为空', trigger: 'blur' }],
content: [{ required: true, message: '信息内容不能为空', trigger: 'blur' }]
},
editorInit: {
language: 'zh_CN',
convert_urls: false,
plugins: ['advlist anchor autolink autosave code codesample colorpicker colorpicker contextmenu directionality emoticons fullscreen hr image imagetools importcss insertdatetime link lists media nonbreaking noneditable pagebreak paste preview print save searchreplace spellchecker tabfocus table template textcolor textpattern visualblocks visualchars wordcount'],
toolbar: ['searchreplace bold italic underline strikethrough alignleft aligncenter alignright outdent indent blockquote undo redo removeformat subscript superscript code codesample', 'hr bullist numlist link image charmap preview anchor pagebreak insertdatetime media table emoticons forecolor backcolor fullscreen'],
images_upload_handler: function(blobInfo, success, failure) {
const formData = new FormData()
formData.append('file', blobInfo.blob())
createStorage(formData).then(res => {
success(res.data.data.url)
}).catch(() => {
failure('上传失败,请重新上传')
})
}
}
}
},
computed: {
headers() {
return {
'X-Dts-Admin-Token': getToken()
}
}
},
created() {
this.init()
},
methods: {
init: function() {
},
handleCancel: function() {
this.$router.push({ path: '/promotion/articleList' })
},
handlePublish: function() {
publishArticle(this.article).then(response => {
this.$notify.success({
title: '成功',
message: '创建成功'
})
this.$router.push({ path: '/promotion/articleList' })
}).catch(response => {
MessageBox.alert('业务错误:' + response.data.errmsg, '警告', {
confirmButtonText: '确定',
type: 'error'
})
})
}
}
}
</script>

View File

@ -0,0 +1,152 @@
<template>
<div class="app-container">
<el-card class="box-card">
<h3>编辑信息公告</h3>
<el-form ref="article" :rules="rules" :model="article" label-width="150px">
<el-form-item label="类型" prop="type">
<el-radio-group v-model="article.type">
<el-radio :label="'1'">公告</el-radio>
<el-radio :label="'0'">通知</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="标题" prop="title">
<el-input v-model="article.title"/>
</el-form-item>
<el-form-item label="内容">
<editor :init="editorInit" v-model="article.content"/>
</el-form-item>
</el-form>
</el-card>
<div class="op-container">
<el-button @click="handleCancel">取消</el-button>
<el-button type="primary" @click="handleEdit">更新</el-button>
</div>
</div>
</template>
<style>
.el-card {
margin-bottom: 10px;
}
.el-tag + .el-tag {
margin-left: 10px;
}
.input-new-keyword {
width: 90px;
margin-left: 10px;
vertical-align: bottom;
}
.avatar-uploader .el-upload {
border: 1px dashed #d9d9d9;
border-radius: 6px;
cursor: pointer;
position: relative;
overflow: hidden;
}
.avatar-uploader .el-upload:hover {
border-color: #20a0ff;
}
.avatar-uploader-icon {
font-size: 28px;
color: #8c939d;
width: 120px;
height: 120px;
line-height: 120px;
text-align: center;
}
.avatar {
width: 145px;
height: 145px;
display: block;
}
</style>
<script>
import { detailArticle, editArticle } from '@/api/article'
import { createStorage, uploadPath } from '@/api/storage'
import Editor from '@tinymce/tinymce-vue'
import { MessageBox } from 'element-ui'
import { getToken } from '@/utils/auth'
export default {
name: 'ArticleEdit',
components: { Editor },
data() {
return {
uploadPath,
article: {},
rules: {
title: [{ required: true, message: '标题不能为空', trigger: 'blur' }],
content: [{ required: true, message: '信息内容不能为空', trigger: 'blur' }]
},
editorInit: {
language: 'zh_CN',
convert_urls: false,
plugins: [
'advlist anchor autolink autosave code codesample colorpicker colorpicker contextmenu directionality emoticons fullscreen hr image imagetools importcss insertdatetime link lists media nonbreaking noneditable pagebreak paste preview print save searchreplace spellchecker tabfocus table template textcolor textpattern visualblocks visualchars wordcount'
],
toolbar: [
'searchreplace bold italic underline strikethrough alignleft aligncenter alignright outdent indent blockquote undo redo removeformat subscript superscript code codesample',
'hr bullist numlist link image charmap preview anchor pagebreak insertdatetime media table emoticons forecolor backcolor fullscreen'
],
images_upload_handler: function(blobInfo, success, failure) {
const formData = new FormData()
formData.append('file', blobInfo.blob())
createStorage(formData)
.then(res => {
success(res.data.data.url)
})
.catch(() => {
failure('上传失败,请重新上传')
})
}
}
}
},
computed: {
headers() {
return {
'X-Dts-Admin-Token': getToken()
}
}
},
created() {
this.init()
},
methods: {
init: function() {
if (this.$route.query.id == null) {
return
}
const articleId = this.$route.query.id
detailArticle(articleId).then(response => {
this.article = response.data.data
})
},
handleCancel: function() {
this.$router.push({ path: '/promotion/articleList' })
},
handleEdit: function() {
editArticle(this.article)
.then(response => {
this.$notify.success({
title: '成功',
message: '修改成功'
})
this.$router.push({ path: '/promotion/articleList' })
})
.catch(response => {
MessageBox.alert('业务错误:' + response.data.errmsg, '警告', {
confirmButtonText: '确定',
type: 'error'
})
})
}
}
}
</script>

View File

@ -0,0 +1,124 @@
<template>
<div class="app-container">
<!-- 查询和其他操作 -->
<div class="filter-container">
<el-input v-model="listQuery.title" clearable class="filter-item" style="width: 200px;" placeholder="请输入公告标题..."/>
<el-button class="filter-item" type="primary" icon="el-icon-search" @click="handleFilter">查找</el-button>
<el-button class="filter-item" type="primary" icon="el-icon-edit" @click="handleCreate">添加</el-button>
</div>
<!-- 查询结果 -->
<el-table v-loading="listLoading" :data="list" size="small" element-loading-text="正在查询中" border fit highlight-current-row>
<el-table-column align="center" label="类型" prop="type">
<template slot-scope="scope">
<el-tag v-if="scope.row.type=='1'" type="success">公告</el-tag>
<el-tag v-else-if="scope.row.type=='0'" type="success">通知</el-tag>
<el-tag v-else type="error">其他</el-tag>
</template>
</el-table-column>
<el-table-column align="center" min-width="400px" label="标题" prop="title"/>
<el-table-column align="center" label="操作" width="200" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button type="primary" size="mini" @click="handleUpdate(scope.row)">编辑</el-button>
<el-button type="danger" size="mini" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination v-show="total>0" :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" @pagination="getList" />
<el-tooltip placement="top" content="返回顶部">
<back-to-top :visibility-height="100" />
</el-tooltip>
</div>
</template>
<style>
.table-expand {
font-size: 0;
}
.table-expand label {
width: 100px;
color: #99a9bf;
}
.table-expand .el-form-item {
margin-right: 0;
margin-bottom: 0;
}
.gallery {
width: 80px;
margin-right: 10px;
}
</style>
<script>
import { listArticle, deleteArticle } from '@/api/article'
import BackToTop from '@/components/BackToTop'
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
export default {
name: 'ArticleList',
components: { BackToTop, Pagination },
data() {
return {
list: [],
total: 0,
listLoading: true,
listQuery: {
page: 1,
limit: 20,
title: undefined,
sort: 'add_time',
order: 'desc'
}
}
},
created() {
this.getList()
},
methods: {
getList() {
this.listLoading = true
listArticle(this.listQuery).then(response => {
this.list = response.data.data.items
this.total = response.data.data.total
this.listLoading = false
}).catch(() => {
this.list = []
this.total = 0
this.listLoading = false
})
},
handleFilter() {
this.listQuery.page = 1
this.getList()
},
handleCreate() {
this.$router.push({ path: '/promotion/articleCreate' })
},
handleUpdate(row) {
this.$router.push({ path: '/promotion/articleEdit', query: { id: row.id }})
},
handleDelete(row) {
deleteArticle(row).then(response => {
this.$notify.success({
title: '成功',
message: '删除成功'
})
const index = this.list.indexOf(row)
this.list.splice(index, 1)
}).catch(response => {
this.$notify.error({
title: '失败',
message: response.data.errmsg
})
})
}
}
}
</script>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,43 @@
package com.qiguliuxing.dts.admin.util;
import org.apache.commons.lang3.StringUtils;
/**
* 公告通知文章等类型定义
*
* @author CHENBO
* @since 1.0.0
* @QQ 623659388
*
*/
public enum ArticleType {
NOTICE("0", "通知"), ANNOUNCE("1", "公告");
private final String type;
private final String desc;
ArticleType(String type, String desc) {
this.type = type;
this.desc = desc;
}
public static ArticleType getInstance(String type) {
if (StringUtils.isNotBlank(type)) {
for (ArticleType tmp : ArticleType.values()) {
if (type.equals(tmp.type)) {
return tmp;
}
}
}
return null;
}
public String type() {
return type;
}
public String desc() {
return desc;
}
}

View File

@ -0,0 +1,190 @@
package com.qiguliuxing.dts.admin.web;
import static com.qiguliuxing.dts.admin.util.AdminResponseCode.ARTICLE_NAME_EXIST;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.validation.constraints.NotNull;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageInfo;
import com.qiguliuxing.dts.admin.annotation.RequiresPermissionsDesc;
import com.qiguliuxing.dts.admin.util.AdminResponseUtil;
import com.qiguliuxing.dts.admin.util.ArticleType;
import com.qiguliuxing.dts.core.util.ResponseUtil;
import com.qiguliuxing.dts.core.validator.Order;
import com.qiguliuxing.dts.core.validator.Sort;
import com.qiguliuxing.dts.db.domain.DtsArticle;
import com.qiguliuxing.dts.db.service.DtsArticleService;
/**
* 公告管理
*/
@RestController
@RequestMapping("/admin/article")
@Validated
public class AdminArticleController {
private static final Logger logger = LoggerFactory.getLogger(AdminArticleController.class);
@Autowired
private DtsArticleService articleService;
/**
* 查询公告列表
*
* @param goodsSn
* @param name
* @param page
* @param limit
* @param sort
* @param order
* @return
*/
@RequiresPermissions("admin:article:list")
@RequiresPermissionsDesc(menu = { "推广管理", "公告管理" }, button = "查询")
@GetMapping("/list")
public Object list(String title, @RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer limit,
@Sort @RequestParam(defaultValue = "add_time") String sort,
@Order @RequestParam(defaultValue = "desc") String order) {
logger.info("【请求开始】推广管理->公告管理->查询,请求参数:title:{},page:{}", title, page);
List<DtsArticle> articleList = articleService.querySelective(title, page, limit, sort, order);
long total = PageInfo.of(articleList).getTotal();
Map<String, Object> data = new HashMap<>();
data.put("total", total);
data.put("items", articleList);
logger.info("【请求结束】推广管理->公告管理->查询,响应结果:{}", JSONObject.toJSONString(data));
return ResponseUtil.ok(data);
}
/**
* 编辑公告
*
* @param goodsAllinone
* @return
*/
@RequiresPermissions("admin:article:update")
@RequiresPermissionsDesc(menu = { "推广管理", "公告管理" }, button = "编辑")
@PostMapping("/update")
public Object update(@RequestBody DtsArticle article) {
logger.info("【请求开始】推广管理->公告管理->编辑,请求参数:{}", JSONObject.toJSONString(article));
Object error = validate(article);
if (error != null) {
return error;
}
if (StringUtils.isEmpty(article.getType())) {
article.setType(ArticleType.ANNOUNCE.type());//如果没有传入类型默认为信息公告
}
if (articleService.updateById(article) == 0) {
logger.error("推广管理->公告管理->编辑错误:{}", "更新数据失败");
throw new RuntimeException("更新数据失败");
}
logger.info("【请求结束】推广管理->公告管理->编辑,响应结果:{}", "成功!");
return ResponseUtil.ok();
}
/**
* 删除商品
*
* @param goods
* @return
*/
@RequiresPermissions("admin:article:delete")
@RequiresPermissionsDesc(menu = { "推广管理", "公告管理" }, button = "删除")
@PostMapping("/delete")
public Object delete(@RequestBody DtsArticle article) {
logger.info("【请求开始】推广管理->公告管理->删除,请求参数:{}", JSONObject.toJSONString(article));
Integer id = article.getId();
if (id == null) {
return ResponseUtil.badArgument();
}
articleService.deleteById(id);
logger.info("【请求结束】推广管理->公告管理->删除,响应结果:{}", "成功");
return ResponseUtil.ok();
}
/**
* 文章公告信息
*
* @param id
* 文章ID
* @return 文章详情
*/
@RequiresPermissions("admin:article:read")
@RequiresPermissionsDesc(menu = { "推广管理", "公告管理" }, button = "详情")
@GetMapping("/detail")
public Object detail(@NotNull Integer id) {
logger.info("【请求开始】推广管理->公告管理->详情,请求参数,id:{}", id);
DtsArticle article = null;
try {
article = articleService.findById(id);
} catch (Exception e) {
logger.error("获取文章公告失败,文章id{}", id);
e.printStackTrace();
}
// 这里不打印响应结果文章内容信息较多
// logger.info("【请求结束】获取公告文章,响应结果:{}",JSONObject.toJSONString(article));
return ResponseUtil.ok(article);
}
/**
* 添加公告
*
* @param article
* @return
*/
@RequiresPermissions("admin:article:create")
@RequiresPermissionsDesc(menu = { "推广管理", "公告管理" }, button = "发布")
@PostMapping("/create")
public Object create(@RequestBody DtsArticle article) {
logger.info("【请求开始】推广管理->公告管理->发布公告,请求参数:{}", JSONObject.toJSONString(article));
Object error = validate(article);
if (error != null) {
return error;
}
String title = article.getTitle();
if (articleService.checkExistByTitle(title)) {
logger.error("推广管理->公告管理->发布公告错误:{}", ARTICLE_NAME_EXIST.desc());
return AdminResponseUtil.fail(ARTICLE_NAME_EXIST);
}
if (StringUtils.isEmpty(article.getType())) {
article.setType(ArticleType.ANNOUNCE.type());//如果没有传入类型默认为信息公告
}
articleService.add(article);
logger.info("【请求结束】推广管理->公告管理->发布公告,响应结果:{}", "成功!");
return ResponseUtil.ok();
}
private Object validate(DtsArticle article) {
String title = article.getTitle();
String content = article.getContent();
if (StringUtils.isEmpty(title) || StringUtils.isEmpty(content)) {
return ResponseUtil.badArgument();
}
return null;
}
}

View File

@ -0,0 +1,315 @@
<?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.qiguliuxing.dts.db.dao.DtsDelPictureMapper">
<resultMap id="BaseResultMap" type="com.qiguliuxing.dts.db.domain.DtsDelPicture">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<id column="id" jdbcType="INTEGER" property="id" />
<result column="picUrl" jdbcType="VARCHAR" property="picurl" />
</resultMap>
<sql id="Example_Where_Clause">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
id, picUrl
</sql>
<select id="selectByExample" parameterType="com.qiguliuxing.dts.db.domain.DtsDelPictureExample" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from dts_del_picture
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByExampleSelective" parameterType="map" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
select
<if test="example.distinct">
distinct
</if>
<choose>
<when test="selective != null and selective.length &gt; 0">
<foreach collection="selective" item="column" separator=",">
${column.escapedColumnName}
</foreach>
</when>
<otherwise>
id, picUrl
</otherwise>
</choose>
from dts_del_picture
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
<if test="example.orderByClause != null">
order by ${example.orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
<include refid="Base_Column_List" />
from dts_del_picture
where id = #{id,jdbcType=INTEGER}
</select>
<select id="selectByPrimaryKeySelective" parameterType="map" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
select
<choose>
<when test="selective != null and selective.length &gt; 0">
<foreach collection="selective" item="column" separator=",">
${column.escapedColumnName}
</foreach>
</when>
<otherwise>
id, picUrl
</otherwise>
</choose>
from dts_del_picture
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
delete from dts_del_picture
where id = #{id,jdbcType=INTEGER}
</delete>
<delete id="deleteByExample" parameterType="com.qiguliuxing.dts.db.domain.DtsDelPictureExample">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
delete from dts_del_picture
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.qiguliuxing.dts.db.domain.DtsDelPicture">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID()
</selectKey>
insert into dts_del_picture (picUrl)
values (#{picurl,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.qiguliuxing.dts.db.domain.DtsDelPicture">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID()
</selectKey>
insert into dts_del_picture
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="picurl != null">
picUrl,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="picurl != null">
#{picurl,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.qiguliuxing.dts.db.domain.DtsDelPictureExample" resultType="java.lang.Long">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select count(*) from dts_del_picture
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update dts_del_picture
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=INTEGER},
</if>
<if test="record.picurl != null">
picUrl = #{record.picurl,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update dts_del_picture
set id = #{record.id,jdbcType=INTEGER},
picUrl = #{record.picurl,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.qiguliuxing.dts.db.domain.DtsDelPicture">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update dts_del_picture
<set>
<if test="picurl != null">
picUrl = #{picurl,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.qiguliuxing.dts.db.domain.DtsDelPicture">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update dts_del_picture
set picUrl = #{picurl,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
<select id="selectOneByExample" parameterType="com.qiguliuxing.dts.db.domain.DtsDelPictureExample" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
select
<include refid="Base_Column_List" />
from dts_del_picture
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
limit 1
</select>
<select id="selectOneByExampleSelective" parameterType="map" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
select
<choose>
<when test="selective != null and selective.length &gt; 0">
<foreach collection="selective" item="column" separator=",">
${column.escapedColumnName}
</foreach>
</when>
<otherwise>
id, picUrl
</otherwise>
</choose>
from dts_del_picture
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
<if test="example.orderByClause != null">
order by ${example.orderByClause}
</if>
limit 1
</select>
</mapper>