Commit 390132d9 authored by zhh's avatar zhh
Browse files

修复主键重名问题

parent d74b7c2b
......@@ -13,6 +13,8 @@ import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 品牌功能Controller
*/
......@@ -54,7 +56,7 @@ public class PmsBrandController {
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public Object updateBrand(@PathVariable("id") Long id, @Validated @RequestBody PmsBrandParam pmsBrandParam, BindingResult result) {
if(result.hasErrors()){
if (result.hasErrors()) {
return new CommonResult().validateFailed(result.getFieldError().getDefaultMessage());
}
CommonResult commonResult;
......@@ -75,20 +77,21 @@ public class PmsBrandController {
public Object deleteBrand(@PathVariable("id") Long id) {
int count = brandService.deleteBrand(id);
if (count == 1) {
LOGGER.debug("deleteBrand success :id={}", id);
LOGGER.debug("deleteBrand success:id={}", id);
return new CommonResult().success(null);
} else {
LOGGER.debug("deleteBrand failed :id={}", id);
LOGGER.debug("deleteBrand failed:id={}", id);
return new CommonResult().failed();
}
}
@ApiOperation(value = "分页获取品牌列表")
@ApiOperation(value = "根据品牌名称分页获取品牌列表")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public Object listBrand(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
public Object listBrand(@RequestParam(value = "keyword", required = false) String keyword,
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
@RequestParam(value = "pageSize", defaultValue = "3") Integer pageSize) {
return new CommonResult().pageSuccess(brandService.listBrand(pageNum, pageSize));
return new CommonResult().pageSuccess(brandService.listBrand(keyword, pageNum, pageSize));
}
@ApiOperation(value = "根据编号查询品牌信息")
......@@ -97,4 +100,32 @@ public class PmsBrandController {
public Object getBrand(@PathVariable("id") Long id) {
return new CommonResult().success(brandService.getBrand(id));
}
@ApiOperation(value = "批量删除品牌")
@RequestMapping(value = "/delete/batch", method = RequestMethod.POST)
@ResponseBody
public Object deleteBrandBatch(@RequestParam("ids") List<Long> ids) {
int count = brandService.deleteBrand(ids);
if (count > 0) {
LOGGER.debug("deleteBrandBatch success:ids={}", ids);
return new CommonResult().success(count);
} else {
LOGGER.debug("deleteBrandBatch failed:ids={}", ids);
return new CommonResult().failed();
}
}
@ApiOperation(value = "批量更新显示状态")
@RequestMapping(value = "/update/showStatus", method = RequestMethod.POST)
@ResponseBody
public Object updateShowStatus(@RequestParam("ids") List<Long> ids, @RequestParam("showStatus") Integer showStatus) {
int count = brandService.updateShowStatus(ids, showStatus);
if (count > 0) {
LOGGER.debug("updateShowStatus success:ids={}", ids);
return new CommonResult().success(count);
} else {
LOGGER.debug("updateShowStatus failed:ids={}", ids);
return new CommonResult().failed();
}
}
}
......@@ -17,7 +17,11 @@ public interface PmsBrandService {
int deleteBrand(Long id);
List<PmsBrand> listBrand(int pageNum, int pageSize);
int deleteBrand(List<Long> ids);
List<PmsBrand> listBrand(String keyword,int pageNum, int pageSize);
PmsBrand getBrand(Long id);
int updateShowStatus(List<Long> ids, Integer showStatus);
}
......@@ -9,6 +9,7 @@ import com.macro.mall.service.PmsBrandService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.util.List;
......@@ -29,6 +30,10 @@ public class PmsBrandServiceImpl implements PmsBrandService{
public int createBrand(PmsBrandParam pmsBrandParam) {
PmsBrand pmsBrand = new PmsBrand();
BeanUtils.copyProperties(pmsBrandParam,pmsBrand);
//如果创建时首字母为空,取名称的第一个为首字母
if(StringUtils.isEmpty(pmsBrand.getFirstLetter())){
pmsBrand.setFirstLetter(pmsBrand.getName().substring(0,1));
}
return brandMapper.insertSelective(pmsBrand);
}
......@@ -37,6 +42,10 @@ public class PmsBrandServiceImpl implements PmsBrandService{
PmsBrand pmsBrand = new PmsBrand();
BeanUtils.copyProperties(pmsBrandParam,pmsBrand);
pmsBrand.setId(id);
//如果创建时首字母为空,取名称的第一个为首字母
if(StringUtils.isEmpty(pmsBrand.getFirstLetter())){
pmsBrand.setFirstLetter(pmsBrand.getName().substring(0,1));
}
return brandMapper.updateByPrimaryKeySelective(pmsBrand);
}
......@@ -46,13 +55,33 @@ public class PmsBrandServiceImpl implements PmsBrandService{
}
@Override
public List<PmsBrand> listBrand(int pageNum, int pageSize) {
public int deleteBrand(List<Long> ids) {
PmsBrandExample pmsBrandExample = new PmsBrandExample();
pmsBrandExample.createCriteria().andIdIn(ids);
return brandMapper.deleteByExample(pmsBrandExample);
}
@Override
public List<PmsBrand> listBrand(String keyword,int pageNum, int pageSize) {
PageHelper.startPage(pageNum, pageSize);
return brandMapper.selectByExample(new PmsBrandExample());
PmsBrandExample pmsBrandExample = new PmsBrandExample();
if(!StringUtils.isEmpty(keyword)){
pmsBrandExample.createCriteria().andNameLike("%"+keyword+"%");
}
return brandMapper.selectByExample(pmsBrandExample);
}
@Override
public PmsBrand getBrand(Long id) {
return brandMapper.selectByPrimaryKey(id);
}
@Override
public int updateShowStatus(List<Long> ids, Integer showStatus) {
PmsBrand pmsBrand = new PmsBrand();
pmsBrand.setShowStatus(showStatus);
PmsBrandExample pmsBrandExample = new PmsBrandExample();
pmsBrandExample.createCriteria().andIdIn(ids);
return brandMapper.updateByExampleSelective(pmsBrand,pmsBrandExample);
}
}
......@@ -101,23 +101,20 @@
</if>
</delete>
<insert id="insert" parameterType="com.macro.mall.model.CmsHelpCategory">
<selectKey keyProperty="id" order="BEFORE" resultType="java.lang.Long">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into cms_help_category (id, name, icon,
help_count, show_status, sort
)
values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{icon,jdbcType=VARCHAR},
#{helpCount,jdbcType=INTEGER}, #{showStatus,jdbcType=INTEGER}, #{sort,jdbcType=INTEGER}
)
insert into cms_help_category (name, icon, help_count,
show_status, sort)
values (#{name,jdbcType=VARCHAR}, #{icon,jdbcType=VARCHAR}, #{helpCount,jdbcType=INTEGER},
#{showStatus,jdbcType=INTEGER}, #{sort,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" parameterType="com.macro.mall.model.CmsHelpCategory">
<selectKey keyProperty="id" order="BEFORE" resultType="java.lang.Long">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into cms_help_category
<trim prefix="(" suffix=")" suffixOverrides=",">
id,
<if test="name != null">
name,
</if>
......@@ -135,7 +132,6 @@
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{id,jdbcType=BIGINT},
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
......
......@@ -126,23 +126,22 @@
</if>
</delete>
<insert id="insert" parameterType="com.macro.mall.model.CmsHelp">
<selectKey keyProperty="id" order="BEFORE" resultType="java.lang.Long">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into cms_help (id, category_id, icon,
title, show_status, create_time,
read_count, content)
values (#{id,jdbcType=BIGINT}, #{categoryId,jdbcType=BIGINT}, #{icon,jdbcType=VARCHAR},
#{title,jdbcType=VARCHAR}, #{showStatus,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
#{readCount,jdbcType=INTEGER}, #{content,jdbcType=LONGVARCHAR})
insert into cms_help (category_id, icon, title,
show_status, create_time, read_count,
content)
values (#{categoryId,jdbcType=BIGINT}, #{icon,jdbcType=VARCHAR}, #{title,jdbcType=VARCHAR},
#{showStatus,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{readCount,jdbcType=INTEGER},
#{content,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.macro.mall.model.CmsHelp">
<selectKey keyProperty="id" order="BEFORE" resultType="java.lang.Long">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into cms_help
<trim prefix="(" suffix=")" suffixOverrides=",">
id,
<if test="categoryId != null">
category_id,
</if>
......@@ -166,7 +165,6 @@
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{id,jdbcType=BIGINT},
<if test="categoryId != null">
#{categoryId,jdbcType=BIGINT},
</if>
......
......@@ -94,23 +94,22 @@
</if>
</delete>
<insert id="insert" parameterType="com.macro.mall.model.CmsMemberReport">
<selectKey keyProperty="id" order="BEFORE" resultType="java.lang.Long">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into cms_member_report (id, report_type, report_member_name,
create_time, report_object, report_status,
handle_status, note)
values (#{id,jdbcType=BIGINT}, #{reportType,jdbcType=INTEGER}, #{reportMemberName,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{reportObject,jdbcType=VARCHAR}, #{reportStatus,jdbcType=INTEGER},
#{handleStatus,jdbcType=INTEGER}, #{note,jdbcType=VARCHAR})
insert into cms_member_report (report_type, report_member_name, create_time,
report_object, report_status, handle_status,
note)
values (#{reportType,jdbcType=INTEGER}, #{reportMemberName,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
#{reportObject,jdbcType=VARCHAR}, #{reportStatus,jdbcType=INTEGER}, #{handleStatus,jdbcType=INTEGER},
#{note,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.macro.mall.model.CmsMemberReport">
<selectKey keyProperty="id" order="BEFORE" resultType="java.lang.Long">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into cms_member_report
<trim prefix="(" suffix=")" suffixOverrides=",">
id,
<if test="reportType != null">
report_type,
</if>
......@@ -134,7 +133,6 @@
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{id,jdbcType=BIGINT},
<if test="reportType != null">
#{reportType,jdbcType=INTEGER},
</if>
......
......@@ -124,23 +124,20 @@
</if>
</delete>
<insert id="insert" parameterType="com.macro.mall.model.CmsPrefrenceArea">
<selectKey keyProperty="id" order="BEFORE" resultType="java.lang.Long">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into cms_prefrence_area (id, name, sub_title,
sort, show_status, pic
)
values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{subTitle,jdbcType=VARCHAR},
#{sort,jdbcType=INTEGER}, #{showStatus,jdbcType=INTEGER}, #{pic,jdbcType=VARBINARY}
)
insert into cms_prefrence_area (name, sub_title, sort,
show_status, pic)
values (#{name,jdbcType=VARCHAR}, #{subTitle,jdbcType=VARCHAR}, #{sort,jdbcType=INTEGER},
#{showStatus,jdbcType=INTEGER}, #{pic,jdbcType=VARBINARY})
</insert>
<insert id="insertSelective" parameterType="com.macro.mall.model.CmsPrefrenceArea">
<selectKey keyProperty="id" order="BEFORE" resultType="java.lang.Long">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into cms_prefrence_area
<trim prefix="(" suffix=")" suffixOverrides=",">
id,
<if test="name != null">
name,
</if>
......@@ -158,7 +155,6 @@
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{id,jdbcType=BIGINT},
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
......
......@@ -98,21 +98,18 @@
</if>
</delete>
<insert id="insert" parameterType="com.macro.mall.model.CmsPrefrenceAreaProductRelation">
<selectKey keyProperty="id" order="BEFORE" resultType="java.lang.Long">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into cms_prefrence_area_product_relation (id, prefrence_area_id, product_id
)
values (#{id,jdbcType=BIGINT}, #{prefrenceAreaId,jdbcType=BIGINT}, #{productId,jdbcType=BIGINT}
)
insert into cms_prefrence_area_product_relation (prefrence_area_id, product_id)
values (#{prefrenceAreaId,jdbcType=BIGINT}, #{productId,jdbcType=BIGINT})
</insert>
<insert id="insertSelective" parameterType="com.macro.mall.model.CmsPrefrenceAreaProductRelation">
<selectKey keyProperty="id" order="BEFORE" resultType="java.lang.Long">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into cms_prefrence_area_product_relation
<trim prefix="(" suffix=")" suffixOverrides=",">
id,
<if test="prefrenceAreaId != null">
prefrence_area_id,
</if>
......@@ -121,7 +118,6 @@
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{id,jdbcType=BIGINT},
<if test="prefrenceAreaId != null">
#{prefrenceAreaId,jdbcType=BIGINT},
</if>
......
......@@ -101,23 +101,20 @@
</if>
</delete>
<insert id="insert" parameterType="com.macro.mall.model.CmsSubjectCategory">
<selectKey keyProperty="id" order="BEFORE" resultType="java.lang.Long">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into cms_subject_category (id, name, icon,
subject_count, show_status, sort
)
values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{icon,jdbcType=VARCHAR},
#{subjectCount,jdbcType=INTEGER}, #{showStatus,jdbcType=INTEGER}, #{sort,jdbcType=INTEGER}
)
insert into cms_subject_category (name, icon, subject_count,
show_status, sort)
values (#{name,jdbcType=VARCHAR}, #{icon,jdbcType=VARCHAR}, #{subjectCount,jdbcType=INTEGER},
#{showStatus,jdbcType=INTEGER}, #{sort,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" parameterType="com.macro.mall.model.CmsSubjectCategory">
<selectKey keyProperty="id" order="BEFORE" resultType="java.lang.Long">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into cms_subject_category
<trim prefix="(" suffix=")" suffixOverrides=",">
id,
<if test="name != null">
name,
</if>
......@@ -135,7 +132,6 @@
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{id,jdbcType=BIGINT},
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
......
......@@ -102,23 +102,22 @@
</if>
</delete>
<insert id="insert" parameterType="com.macro.mall.model.CmsSubjectComment">
<selectKey keyProperty="id" order="BEFORE" resultType="java.lang.Long">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into cms_subject_comment (id, subject_id, member_nick_name,
member_icon, content, create_time,
show_status)
values (#{id,jdbcType=BIGINT}, #{subjectId,jdbcType=BIGINT}, #{memberNickName,jdbcType=VARCHAR},
#{memberIcon,jdbcType=VARCHAR}, #{content,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
#{showStatus,jdbcType=INTEGER})
insert into cms_subject_comment (subject_id, member_nick_name, member_icon,
content, create_time, show_status
)
values (#{subjectId,jdbcType=BIGINT}, #{memberNickName,jdbcType=VARCHAR}, #{memberIcon,jdbcType=VARCHAR},
#{content,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{showStatus,jdbcType=INTEGER}
)
</insert>
<insert id="insertSelective" parameterType="com.macro.mall.model.CmsSubjectComment">
<selectKey keyProperty="id" order="BEFORE" resultType="java.lang.Long">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into cms_subject_comment
<trim prefix="(" suffix=")" suffixOverrides=",">
id,
<if test="subjectId != null">
subject_id,
</if>
......@@ -139,7 +138,6 @@
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{id,jdbcType=BIGINT},
<if test="subjectId != null">
#{subjectId,jdbcType=BIGINT},
</if>
......
......@@ -134,29 +134,26 @@
</if>
</delete>
<insert id="insert" parameterType="com.macro.mall.model.CmsSubject">
<selectKey keyProperty="id" order="BEFORE" resultType="java.lang.Long">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into cms_subject (id, category_id, title,
pic, product_count, recommend_status,
create_time, collect_count, read_count,
comment_count, album_pics, description,
show_status, forward_count, content
)
values (#{id,jdbcType=BIGINT}, #{categoryId,jdbcType=BIGINT}, #{title,jdbcType=VARCHAR},
#{pic,jdbcType=VARCHAR}, #{productCount,jdbcType=INTEGER}, #{recommendStatus,jdbcType=INTEGER},
#{createTime,jdbcType=TIMESTAMP}, #{collectCount,jdbcType=INTEGER}, #{readCount,jdbcType=INTEGER},
#{commentCount,jdbcType=INTEGER}, #{albumPics,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR},
#{showStatus,jdbcType=INTEGER}, #{forwardCount,jdbcType=INTEGER}, #{content,jdbcType=LONGVARCHAR}
)
insert into cms_subject (category_id, title, pic,
product_count, recommend_status, create_time,
collect_count, read_count, comment_count,
album_pics, description, show_status,
forward_count, content)
values (#{categoryId,jdbcType=BIGINT}, #{title,jdbcType=VARCHAR}, #{pic,jdbcType=VARCHAR},
#{productCount,jdbcType=INTEGER}, #{recommendStatus,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
#{collectCount,jdbcType=INTEGER}, #{readCount,jdbcType=INTEGER}, #{commentCount,jdbcType=INTEGER},
#{albumPics,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{showStatus,jdbcType=INTEGER},
#{forwardCount,jdbcType=INTEGER}, #{content,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.macro.mall.model.CmsSubject">
<selectKey keyProperty="id" order="BEFORE" resultType="java.lang.Long">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into cms_subject
<trim prefix="(" suffix=")" suffixOverrides=",">
id,
<if test="categoryId != null">
category_id,
</if>
......@@ -201,7 +198,6 @@
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{id,jdbcType=BIGINT},
<if test="categoryId != null">
#{categoryId,jdbcType=BIGINT},
</if>
......
......@@ -98,21 +98,18 @@
</if>
</delete>
<insert id="insert" parameterType="com.macro.mall.model.CmsSubjectProductRelation">
<selectKey keyProperty="id" order="BEFORE" resultType="java.lang.Long">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into cms_subject_product_relation (id, subject_id, product_id
)
values (#{id,jdbcType=BIGINT}, #{subjectId,jdbcType=BIGINT}, #{productId,jdbcType=BIGINT}
)
insert into cms_subject_product_relation (subject_id, product_id)
values (#{subjectId,jdbcType=BIGINT}, #{productId,jdbcType=BIGINT})
</insert>
<insert id="insertSelective" parameterType="com.macro.mall.model.CmsSubjectProductRelation">
<selectKey keyProperty="id" order="BEFORE" resultType="java.lang.Long">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into cms_subject_product_relation
<trim prefix="(" suffix=")" suffixOverrides=",">
id,
<if test="subjectId != null">
subject_id,
</if>
......@@ -121,7 +118,6 @@
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{id,jdbcType=BIGINT},
<if test="subjectId != null">
#{subjectId,jdbcType=BIGINT},
</if>
......
......@@ -101,23 +101,20 @@
</if>
</delete>
<insert id="insert" parameterType="com.macro.mall.model.CmsTopicCategory">
<selectKey keyProperty="id" order="BEFORE" resultType="java.lang.Long">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into cms_topic_category (id, name, icon,
subject_count, show_status, sort
)
values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{icon,jdbcType=VARCHAR},
#{subjectCount,jdbcType=INTEGER}, #{showStatus,jdbcType=INTEGER}, #{sort,jdbcType=INTEGER}
)
insert into cms_topic_category (name, icon, subject_count,
show_status, sort)
values (#{name,jdbcType=VARCHAR}, #{icon,jdbcType=VARCHAR}, #{subjectCount,jdbcType=INTEGER},
#{showStatus,jdbcType=INTEGER}, #{sort,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" parameterType="com.macro.mall.model.CmsTopicCategory">
<selectKey keyProperty="id" order="BEFORE" resultType="java.lang.Long">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into cms_topic_category
<trim prefix="(" suffix=")" suffixOverrides=",">
id,
<if test="name != null">
name,
</if>
......@@ -135,7 +132,6 @@
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{id,jdbcType=BIGINT},
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
......
......@@ -102,23 +102,22 @@
</if>
</delete>
<insert id="insert" parameterType="com.macro.mall.model.CmsTopicComment">
<selectKey keyProperty="id" order="BEFORE" resultType="java.lang.Long">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into cms_topic_comment (id, member_nick_name, topic_id,
member_icon, content, create_time,
show_status)
values (#{id,jdbcType=BIGINT}, #{memberNickName,jdbcType=VARCHAR}, #{topicId,jdbcType=BIGINT},
#{memberIcon,jdbcType=VARCHAR}, #{content,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
#{showStatus,jdbcType=INTEGER})
insert into cms_topic_comment (member_nick_name, topic_id, member_icon,
content, create_time, show_status
)
values (#{memberNickName,jdbcType=VARCHAR}, #{topicId,jdbcType=BIGINT}, #{memberIcon,jdbcType=VARCHAR},
#{content,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{showStatus,jdbcType=INTEGER}
)
</insert>
<insert id="insertSelective" parameterType="com.macro.mall.model.CmsTopicComment">
<selectKey keyProperty="id" order="BEFORE" resultType="java.lang.Long">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into cms_topic_comment
<trim prefix="(" suffix=")" suffixOverrides=",">
id,
<if test="memberNickName != null">
member_nick_name,
</if>
......@@ -139,7 +138,6 @@
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{id,jdbcType=BIGINT},
<if test="memberNickName != null">
#{memberNickName,jdbcType=VARCHAR},
</if>
......
......@@ -131,27 +131,24 @@
</if>
</delete>
<insert id="insert" parameterType="com.macro.mall.model.CmsTopic">
<selectKey keyProperty="id" order="BEFORE" resultType="java.lang.Long">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into cms_topic (id, category_id, name,
create_time, start_time, end_time,
attend_count, attention_count, read_count,
award_name, attend_type, content
)
values (#{id,jdbcType=BIGINT}, #{categoryId,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{startTime,jdbcType=TIMESTAMP}, #{endTime,jdbcType=TIMESTAMP},
#{attendCount,jdbcType=INTEGER}, #{attentionCount,jdbcType=INTEGER}, #{readCount,jdbcType=INTEGER},
#{awardName,jdbcType=VARCHAR}, #{attendType,jdbcType=VARCHAR}, #{content,jdbcType=LONGVARCHAR}
)
insert into cms_topic (category_id, name, create_time,
start_time, end_time, attend_count,
attention_count, read_count, award_name,
attend_type, content)
values (#{categoryId,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
#{startTime,jdbcType=TIMESTAMP}, #{endTime,jdbcType=TIMESTAMP}, #{attendCount,jdbcType=INTEGER},
#{attentionCount,jdbcType=INTEGER}, #{readCount,jdbcType=INTEGER}, #{awardName,jdbcType=VARCHAR},
#{attendType,jdbcType=VARCHAR}, #{content,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.macro.mall.model.CmsTopic">
<selectKey keyProperty="id" order="BEFORE" resultType="java.lang.Long">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into cms_topic
<trim prefix="(" suffix=")" suffixOverrides=",">
id,
<if test="categoryId != null">
category_id,
</if>
......@@ -187,7 +184,6 @@
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{id,jdbcType=BIGINT},
<if test="categoryId != null">
#{categoryId,jdbcType=BIGINT},
</if>
......
......@@ -104,25 +104,22 @@
</if>
</delete>
<insert id="insert" parameterType="com.macro.mall.model.OmsCompanyAddress">
<selectKey keyProperty="id" order="BEFORE" resultType="java.lang.Long">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into oms_company_address (id, address_name, send_status,
receive_status, name, phone,
province, city, region
)
values (#{id,jdbcType=BIGINT}, #{addressName,jdbcType=VARCHAR}, #{sendStatus,jdbcType=INTEGER},
#{receiveStatus,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR},
#{province,jdbcType=VARCHAR}, #{city,jdbcType=VARCHAR}, #{region,jdbcType=VARCHAR}
)
insert into oms_company_address (address_name, send_status, receive_status,
name, phone, province,
city, region)
values (#{addressName,jdbcType=VARCHAR}, #{sendStatus,jdbcType=INTEGER}, #{receiveStatus,jdbcType=INTEGER},
#{name,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR}, #{province,jdbcType=VARCHAR},
#{city,jdbcType=VARCHAR}, #{region,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.macro.mall.model.OmsCompanyAddress">
<selectKey keyProperty="id" order="BEFORE" resultType="java.lang.Long">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into oms_company_address
<trim prefix="(" suffix=")" suffixOverrides=",">
id,
<if test="addressName != null">
address_name,
</if>
......@@ -149,7 +146,6 @@
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{id,jdbcType=BIGINT},
<if test="addressName != null">
#{addressName,jdbcType=VARCHAR},
</if>
......
......@@ -110,27 +110,26 @@
</if>
</delete>
<insert id="insert" parameterType="com.macro.mall.model.OmsOrderItem">
<selectKey keyProperty="id" order="BEFORE" resultType="java.lang.Long">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into oms_order_item (id, order_id, order_sn,
product_id, proudct_pic, product_name,
product_brand, product_sn, product_amount,
product_count, product_real_amount, sp1,
sp2, sp3)
values (#{id,jdbcType=BIGINT}, #{orderId,jdbcType=BIGINT}, #{orderSn,jdbcType=VARCHAR},
#{productId,jdbcType=BIGINT}, #{proudctPic,jdbcType=VARCHAR}, #{productName,jdbcType=VARCHAR},
#{productBrand,jdbcType=VARCHAR}, #{productSn,jdbcType=VARCHAR}, #{productAmount,jdbcType=DECIMAL},
#{productCount,jdbcType=INTEGER}, #{productRealAmount,jdbcType=DECIMAL}, #{sp1,jdbcType=VARCHAR},
#{sp2,jdbcType=VARCHAR}, #{sp3,jdbcType=VARCHAR})
insert into oms_order_item (order_id, order_sn, product_id,
proudct_pic, product_name, product_brand,
product_sn, product_amount, product_count,
product_real_amount, sp1, sp2,
sp3)
values (#{orderId,jdbcType=BIGINT}, #{orderSn,jdbcType=VARCHAR}, #{productId,jdbcType=BIGINT},
#{proudctPic,jdbcType=VARCHAR}, #{productName,jdbcType=VARCHAR}, #{productBrand,jdbcType=VARCHAR},
#{productSn,jdbcType=VARCHAR}, #{productAmount,jdbcType=DECIMAL}, #{productCount,jdbcType=INTEGER},
#{productRealAmount,jdbcType=DECIMAL}, #{sp1,jdbcType=VARCHAR}, #{sp2,jdbcType=VARCHAR},
#{sp3,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.macro.mall.model.OmsOrderItem">
<selectKey keyProperty="id" order="BEFORE" resultType="java.lang.Long">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into oms_order_item
<trim prefix="(" suffix=")" suffixOverrides=",">
id,
<if test="orderId != null">
order_id,
</if>
......@@ -172,7 +171,6 @@
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{id,jdbcType=BIGINT},
<if test="orderId != null">
#{orderId,jdbcType=BIGINT},
</if>
......
......@@ -136,43 +136,40 @@
</if>
</delete>
<insert id="insert" parameterType="com.macro.mall.model.OmsOrder">
<selectKey keyProperty="id" order="BEFORE" resultType="java.lang.Long">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into oms_order (id, member_id, coupon_id,
order_sn, create_time, member_username,
total_amount, freight_amount, promotion_amount,
integration_amount, coupon_amount, discount_amount,
pay_type, source_type, status,
order_type, delivery_company, delivery_sn,
auto_confirm_day, integration, growth,
promotion_info, bill_type, bill_header,
bill_content, bill_receiver_phone, bill_receiver_email,
receiver_name, receiver_phone, receiver_post_code,
receiver_province, receiver_city, receiver_region,
receiver_detail_address, note, confirm_status
)
values (#{id,jdbcType=BIGINT}, #{memberId,jdbcType=BIGINT}, #{couponId,jdbcType=BIGINT},
#{orderSn,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{memberUsername,jdbcType=VARCHAR},
#{totalAmount,jdbcType=DECIMAL}, #{freightAmount,jdbcType=DECIMAL}, #{promotionAmount,jdbcType=DECIMAL},
#{integrationAmount,jdbcType=DECIMAL}, #{couponAmount,jdbcType=DECIMAL}, #{discountAmount,jdbcType=DECIMAL},
#{payType,jdbcType=INTEGER}, #{sourceType,jdbcType=INTEGER}, #{status,jdbcType=INTEGER},
#{orderType,jdbcType=INTEGER}, #{deliveryCompany,jdbcType=VARCHAR}, #{deliverySn,jdbcType=VARCHAR},
#{autoConfirmDay,jdbcType=INTEGER}, #{integration,jdbcType=INTEGER}, #{growth,jdbcType=INTEGER},
#{promotionInfo,jdbcType=VARCHAR}, #{billType,jdbcType=INTEGER}, #{billHeader,jdbcType=VARCHAR},
#{billContent,jdbcType=VARCHAR}, #{billReceiverPhone,jdbcType=VARCHAR}, #{billReceiverEmail,jdbcType=VARCHAR},
#{receiverName,jdbcType=VARCHAR}, #{receiverPhone,jdbcType=VARCHAR}, #{receiverPostCode,jdbcType=VARCHAR},
#{receiverProvince,jdbcType=VARCHAR}, #{receiverCity,jdbcType=VARCHAR}, #{receiverRegion,jdbcType=VARCHAR},
#{receiverDetailAddress,jdbcType=VARCHAR}, #{note,jdbcType=VARCHAR}, #{confirmStatus,jdbcType=INTEGER}
)
insert into oms_order (member_id, coupon_id, order_sn,
create_time, member_username, total_amount,
freight_amount, promotion_amount, integration_amount,
coupon_amount, discount_amount, pay_type,
source_type, status, order_type,
delivery_company, delivery_sn, auto_confirm_day,
integration, growth, promotion_info,
bill_type, bill_header, bill_content,
bill_receiver_phone, bill_receiver_email, receiver_name,
receiver_phone, receiver_post_code, receiver_province,
receiver_city, receiver_region, receiver_detail_address,
note, confirm_status)
values (#{memberId,jdbcType=BIGINT}, #{couponId,jdbcType=BIGINT}, #{orderSn,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{memberUsername,jdbcType=VARCHAR}, #{totalAmount,jdbcType=DECIMAL},
#{freightAmount,jdbcType=DECIMAL}, #{promotionAmount,jdbcType=DECIMAL}, #{integrationAmount,jdbcType=DECIMAL},
#{couponAmount,jdbcType=DECIMAL}, #{discountAmount,jdbcType=DECIMAL}, #{payType,jdbcType=INTEGER},
#{sourceType,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}, #{orderType,jdbcType=INTEGER},
#{deliveryCompany,jdbcType=VARCHAR}, #{deliverySn,jdbcType=VARCHAR}, #{autoConfirmDay,jdbcType=INTEGER},
#{integration,jdbcType=INTEGER}, #{growth,jdbcType=INTEGER}, #{promotionInfo,jdbcType=VARCHAR},
#{billType,jdbcType=INTEGER}, #{billHeader,jdbcType=VARCHAR}, #{billContent,jdbcType=VARCHAR},
#{billReceiverPhone,jdbcType=VARCHAR}, #{billReceiverEmail,jdbcType=VARCHAR}, #{receiverName,jdbcType=VARCHAR},
#{receiverPhone,jdbcType=VARCHAR}, #{receiverPostCode,jdbcType=VARCHAR}, #{receiverProvince,jdbcType=VARCHAR},
#{receiverCity,jdbcType=VARCHAR}, #{receiverRegion,jdbcType=VARCHAR}, #{receiverDetailAddress,jdbcType=VARCHAR},
#{note,jdbcType=VARCHAR}, #{confirmStatus,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" parameterType="com.macro.mall.model.OmsOrder">
<selectKey keyProperty="id" order="BEFORE" resultType="java.lang.Long">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into oms_order
<trim prefix="(" suffix=")" suffixOverrides=",">
id,
<if test="memberId != null">
member_id,
</if>
......@@ -280,7 +277,6 @@
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{id,jdbcType=BIGINT},
<if test="memberId != null">
#{memberId,jdbcType=BIGINT},
</if>
......
......@@ -101,23 +101,20 @@
</if>
</delete>
<insert id="insert" parameterType="com.macro.mall.model.OmsOrderOperateHistory">
<selectKey keyProperty="id" order="BEFORE" resultType="java.lang.Long">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into oms_order_operate_history (id, order_id, operate_man,
create_time, order_status, note
)
values (#{id,jdbcType=BIGINT}, #{orderId,jdbcType=BIGINT}, #{operateMan,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{orderStatus,jdbcType=INTEGER}, #{note,jdbcType=VARCHAR}
)
insert into oms_order_operate_history (order_id, operate_man, create_time,
order_status, note)
values (#{orderId,jdbcType=BIGINT}, #{operateMan,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
#{orderStatus,jdbcType=INTEGER}, #{note,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.macro.mall.model.OmsOrderOperateHistory">
<selectKey keyProperty="id" order="BEFORE" resultType="java.lang.Long">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into oms_order_operate_history
<trim prefix="(" suffix=")" suffixOverrides=",">
id,
<if test="orderId != null">
order_id,
</if>
......@@ -135,7 +132,6 @@
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{id,jdbcType=BIGINT},
<if test="orderId != null">
#{orderId,jdbcType=BIGINT},
</if>
......
......@@ -126,37 +126,34 @@
</if>
</delete>
<insert id="insert" parameterType="com.macro.mall.model.OmsOrderReturnApply">
<selectKey keyProperty="id" order="BEFORE" resultType="java.lang.Long">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into oms_order_return_apply (id, order_id, company_address_id,
order_sn, create_time, member_username,
return_amount, return_name, return_phone,
status, handle_time, product_pic,
product_name, brand_name, product_attr,
product_count, reason, description,
proof_pics, return_post_amount, return_post_status,
confirm_return_amount, handle_note, handle_man,
receive_man, receive_time, receive_note
)
values (#{id,jdbcType=BIGINT}, #{orderId,jdbcType=BIGINT}, #{companyAddressId,jdbcType=BIGINT},
#{orderSn,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{memberUsername,jdbcType=VARCHAR},
#{returnAmount,jdbcType=DECIMAL}, #{returnName,jdbcType=VARCHAR}, #{returnPhone,jdbcType=VARCHAR},
#{status,jdbcType=INTEGER}, #{handleTime,jdbcType=TIMESTAMP}, #{productPic,jdbcType=VARCHAR},
#{productName,jdbcType=VARCHAR}, #{brandName,jdbcType=VARCHAR}, #{productAttr,jdbcType=VARCHAR},
#{productCount,jdbcType=INTEGER}, #{reason,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR},
#{proofPics,jdbcType=VARCHAR}, #{returnPostAmount,jdbcType=DECIMAL}, #{returnPostStatus,jdbcType=INTEGER},
#{confirmReturnAmount,jdbcType=DECIMAL}, #{handleNote,jdbcType=VARCHAR}, #{handleMan,jdbcType=VARCHAR},
#{receiveMan,jdbcType=VARCHAR}, #{receiveTime,jdbcType=TIMESTAMP}, #{receiveNote,jdbcType=VARCHAR}
)
insert into oms_order_return_apply (order_id, company_address_id, order_sn,
create_time, member_username, return_amount,
return_name, return_phone, status,
handle_time, product_pic, product_name,
brand_name, product_attr, product_count,
reason, description, proof_pics,
return_post_amount, return_post_status, confirm_return_amount,
handle_note, handle_man, receive_man,
receive_time, receive_note)
values (#{orderId,jdbcType=BIGINT}, #{companyAddressId,jdbcType=BIGINT}, #{orderSn,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{memberUsername,jdbcType=VARCHAR}, #{returnAmount,jdbcType=DECIMAL},
#{returnName,jdbcType=VARCHAR}, #{returnPhone,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER},
#{handleTime,jdbcType=TIMESTAMP}, #{productPic,jdbcType=VARCHAR}, #{productName,jdbcType=VARCHAR},
#{brandName,jdbcType=VARCHAR}, #{productAttr,jdbcType=VARCHAR}, #{productCount,jdbcType=INTEGER},
#{reason,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{proofPics,jdbcType=VARCHAR},
#{returnPostAmount,jdbcType=DECIMAL}, #{returnPostStatus,jdbcType=INTEGER}, #{confirmReturnAmount,jdbcType=DECIMAL},
#{handleNote,jdbcType=VARCHAR}, #{handleMan,jdbcType=VARCHAR}, #{receiveMan,jdbcType=VARCHAR},
#{receiveTime,jdbcType=TIMESTAMP}, #{receiveNote,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.macro.mall.model.OmsOrderReturnApply">
<selectKey keyProperty="id" order="BEFORE" resultType="java.lang.Long">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into oms_order_return_apply
<trim prefix="(" suffix=")" suffixOverrides=",">
id,
<if test="orderId != null">
order_id,
</if>
......@@ -237,7 +234,6 @@
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{id,jdbcType=BIGINT},
<if test="orderId != null">
#{orderId,jdbcType=BIGINT},
</if>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment