Commit 9178513c by XiaHou

万科相关接口修复

parent 1cad1abd
......@@ -3,7 +3,6 @@ package com.macro.mall.controller;
import com.macro.mall.common.api.CommonPage;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.core.annotion.BussinessLog;
import com.macro.mall.domain.MemberDetails;
import com.macro.mall.dto.AdminUpdateParam;
import com.macro.mall.dto.UmsAdminLoginParam;
import com.macro.mall.domain.dto.UmsAdminParam;
......@@ -17,9 +16,6 @@ import io.swagger.annotations.ApiOperation;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
......
......@@ -20,7 +20,7 @@ import java.util.List;
@Controller
@Api(tags = "万科后台_部门相关接口", description = "部门控制器")
@RequestMapping("/admin")
@RequestMapping("/vankeDepartment")
public class VankeDepartmentController {
@Autowired
......@@ -46,7 +46,7 @@ public class VankeDepartmentController {
}
@ApiOperation("万科后台_根据部门id修改一条数据")
@RequestMapping(value = "/insertDepartment", method = RequestMethod.POST)
@RequestMapping(value = "/updateDepartment", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateDepartment(VankeDepartment vankeDepartment){
ResultMsg res = this.vankeDepartmentSerive.updateDepartment(vankeDepartment);
......
package com.macro.mall.model.dto.vanke;
import com.macro.mall.model.VankeStockRoom;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
@Data
public class VankeStockRoomDto extends VankeStockRoom implements Serializable {
@ApiModelProperty("管理员名称")
private String adminName;
}
package com.macro.mall.dao.vanke;
import com.macro.mall.domain.dto.vanke.VankeBackLogDto;
import java.util.List;
public interface VankeBackLogDao {
List<VankeBackLogDto> selectList(VankeBackLogDto vankeBackLogDto);
}
package com.macro.mall.domain.dto.vanke;
import com.macro.mall.model.VankeBackLog;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
@Data
public class VankeBackLogDto extends VankeBackLog implements Serializable {
@ApiModelProperty("操作人昵称")
private String name;
}
......@@ -177,5 +177,15 @@ public interface UmsAdminService {
*/
int updateAdmin(Long id, AdminUpdateParam admin);
/**
* 获得当前管理员对象
* @return
*/
UmsAdmin getCurrentUmsAdmin();
/**
* 获得当前管理员id
* @return
*/
Long getCurrentUmsAdminId();
}
......@@ -652,6 +652,18 @@ public class UmsAdminServiceImpl implements UmsAdminService {
return null;
}
@Override
public Long getCurrentUmsAdminId() {
SecurityContext ctx = SecurityContextHolder.getContext();
Authentication auth = ctx.getAuthentication();
if (auth != null && auth.getPrincipal() instanceof MemberDetails) {
AdminUserDetails adminUserDetails = (AdminUserDetails)auth.getPrincipal();
return adminUserDetails.getUmsAdmin().getId();
}
return null;
}
public Long getAdminRoleId(Long id){
UmsAdminRoleRelationExample example=new UmsAdminRoleRelationExample();
//查询用户角色id
......
package com.macro.mall.service.vanke;
import com.macro.mall.domain.dto.vanke.VankeBackLogDto;
import com.macro.mall.model.VankeBackLog;
import com.macro.mall.model.common.ResultMsg;
import java.util.List;
......@@ -12,5 +14,7 @@ public interface IVankeBackLogService {
* @param pageSize
* @return
*/
List<VankeBackLog> getPageList(Integer pageNum, Integer pageSize);
List<VankeBackLogDto> getPageList(Integer pageNum, Integer pageSize,String name);
ResultMsg insertVankeBackLog(String msg);
}
package com.macro.mall.service.vanke;
public interface IVankeGoodsCategoryService {
}
package com.macro.mall.service.vanke;
import com.macro.mall.model.VankeStockRoom;
import com.macro.mall.model.common.ResultMsg;
public interface IVankeStockRoomService {
/**
* 插入库房
* @param vankeStockRoom
* @return
*/
ResultMsg insertStockRoom(VankeStockRoom vankeStockRoom);
/**
* 根据id修改对应的数据
* @param vankeStockRoom
* @return
*/
ResultMsg updateStockRoom(VankeStockRoom vankeStockRoom);
}
package com.macro.mall.service.vanke.impl;
import com.github.pagehelper.PageHelper;
import com.macro.mall.dao.vanke.VankeBackLogDao;
import com.macro.mall.domain.dto.vanke.VankeBackLogDto;
import com.macro.mall.mapper.VankeBackLogMapper;
import com.macro.mall.mapper.VankeDepartmentMapper;
import com.macro.mall.model.UmsAdmin;
import com.macro.mall.model.VankeBackLog;
import com.macro.mall.model.common.ResultMsg;
import com.macro.mall.service.system.UmsAdminService;
import com.macro.mall.service.vanke.IVankeBackLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
......@@ -15,11 +24,34 @@ import java.util.List;
public class VankeBackLogServiceImpl implements IVankeBackLogService {
@Resource
private VankeDepartmentMapper vankeDepartmentMapper;
private VankeBackLogMapper vankeBackLogMapper;
@Resource
private VankeBackLogDao vankeBackLogDao;
@Autowired
private UmsAdminService umsAdminService;
@Override
public List<VankeBackLogDto> getPageList(Integer pageNum, Integer pageSize,String name) {
PageHelper.startPage(pageNum, pageSize);
VankeBackLogDto vankeBackLogDto = new VankeBackLogDto();
vankeBackLogDto.setName(name);
return this.vankeBackLogDao.selectList(vankeBackLogDto);
}
/**
* 插入日志操作
* @param msg
* @return
*/
@Override
public List<VankeBackLog> getPageList(Integer pageNum, Integer pageSize) {
return null;
@Transactional(rollbackFor = Exception.class)
public ResultMsg insertVankeBackLog(String msg) {
VankeBackLog vbl = new VankeBackLog();
vbl.setMsg(msg);
vbl.setCreateBy(this.umsAdminService.getCurrentUmsAdminId());
this.vankeBackLogMapper.insertSelective(vbl);
return new ResultMsg(true,"插入日志成功");
}
}
......@@ -8,6 +8,7 @@ import com.macro.mall.model.VankeDepartment;
import com.macro.mall.model.VankeDepartmentExample;
import com.macro.mall.model.common.ResultMsg;
import com.macro.mall.service.system.UmsAdminService;
import com.macro.mall.service.vanke.IVankeBackLogService;
import com.macro.mall.service.vanke.IVankeDepartmentSerive;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -25,6 +26,8 @@ public class VankeDepartmentSeriveImpl implements IVankeDepartmentSerive {
private VankeDepartmentMapper vankeDepartmentMapper;
@Autowired
private UmsAdminService umsAdminService;
@Autowired
private IVankeBackLogService vankeBackLogService;
@Override
public List<VankeDepartment> getPageList(Integer pageNum, Integer pageSize){
......@@ -37,17 +40,17 @@ public class VankeDepartmentSeriveImpl implements IVankeDepartmentSerive {
@Override
public ResultMsg insertDepartment(VankeDepartment vankeDepartment) {
VankeDepartment vd = new VankeDepartment();
//插入部门
if(vankeDepartment.getName() == null && "".equals(vankeDepartment.getName())){
return new ResultMsg(false,"请输入部门名称");
}
UmsAdmin admin = umsAdminService.getCurrentUmsAdmin();
vd.setName(vankeDepartment.getName());
vd.setStatus(vankeDepartment.getStatus());
vd.setCreateBy(admin.getId());
vd.setUpdateBy(admin.getId());
this.vankeDepartmentMapper.insertSelective(vd);
vankeDepartment.setCreateBy(admin.getId());
vankeDepartment.setUpdateBy(admin.getId());
this.vankeDepartmentMapper.insertSelective(vankeDepartment);
String msg = "新增部门:"+vankeDepartment.getName();
//插入日志表
this.vankeBackLogService.insertVankeBackLog(msg);
return new ResultMsg(true,"操作成功");
}
......@@ -61,7 +64,25 @@ public class VankeDepartmentSeriveImpl implements IVankeDepartmentSerive {
if(vankeDepartment.getId() == null){
return new ResultMsg(false,"传入id为空");
}
String msg = "";
if( vankeDepartment.getName() != null && "".equals(vankeDepartment.getName())){ //如果传入名字 则需加上名字信息
//通过id获得之前名称
VankeDepartment vd =this.vankeDepartmentMapper.selectByPrimaryKey(vankeDepartment.getId());
msg = "将部门名称:"+vd.getName()+"修改为:"+vankeDepartment.getName();
//插入日志表
this.vankeBackLogService.insertVankeBackLog(msg);
}
if(vankeDepartment.getDeleteStatus() != null && vankeDepartment.getDeleteStatus() == 0){
//通过id获得之前名称
VankeDepartment vd =this.vankeDepartmentMapper.selectByPrimaryKey(vankeDepartment.getId());
msg="将部门名称:"+vd.getName()+"删除";
//插入日志表
this.vankeBackLogService.insertVankeBackLog(msg);
}
UmsAdmin admin = umsAdminService.getCurrentUmsAdmin();
vankeDepartment.setUpdateBy(admin.getId());
this.vankeDepartmentMapper.updateByPrimaryKeySelective(vankeDepartment);
return new ResultMsg(true,"操作成功");
}
......
package com.macro.mall.service.vanke.impl;
import com.macro.mall.mapper.VankeGoodsCategoryMapper;
import com.macro.mall.service.vanke.IVankeGoodsCategoryService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@Service
public class VankeGoodsCategoryServiceImpl implements IVankeGoodsCategoryService {
@Resource
private VankeGoodsCategoryMapper vankeGoodsCategoryMapper;
}
package com.macro.mall.service.vanke.impl;
import com.macro.mall.mapper.VankeStockRoomMapper;
import com.macro.mall.model.UmsAdmin;
import com.macro.mall.model.VankeDepartment;
import com.macro.mall.model.VankeStockRoom;
import com.macro.mall.model.common.ResultMsg;
import com.macro.mall.service.system.UmsAdminService;
import com.macro.mall.service.vanke.IVankeBackLogService;
import com.macro.mall.service.vanke.IVankeStockRoomService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* 库房业务
*/
@Service
public class VankeStockRoomServiceImpl implements IVankeStockRoomService {
@Resource
private VankeStockRoomMapper vankeStockRoomMapper;
@Autowired
private UmsAdminService umsAdminService;
@Autowired
private IVankeBackLogService vankeBackLogService;
@Override
public ResultMsg insertStockRoom(VankeStockRoom vankeStockRoom) {
if(vankeStockRoom.getName() == null || "".equals(vankeStockRoom.getName())){
return new ResultMsg(false,"传入库房名称为空");
}
UmsAdmin admin = umsAdminService.getCurrentUmsAdmin();
vankeStockRoom.setCreateBy(admin.getId());
vankeStockRoom.setUpdateBy(admin.getId());
this.vankeStockRoomMapper.insertSelective(vankeStockRoom);
String msg = "新增库房:"+vankeStockRoom.getName();
//插入日志表
this.vankeBackLogService.insertVankeBackLog(msg);
return new ResultMsg(true,"操作成功");
}
@Override
public ResultMsg updateStockRoom(VankeStockRoom vankeStockRoom) {
if(vankeStockRoom.getId() == null){
return new ResultMsg(false,"传入id为空");
}
String msg = "";
if( vankeStockRoom.getName() != null && "".equals(vankeStockRoom.getName())){ //如果传入名字 则需加上名字信息
//通过id获得之前名称
VankeStockRoom vsr =this.vankeStockRoomMapper.selectByPrimaryKey(vankeStockRoom.getId());
msg = "将库房名称:"+vsr.getName()+"修改为:"+vankeStockRoom.getName();
//插入日志表
this.vankeBackLogService.insertVankeBackLog(msg);
}
if(vankeStockRoom.getDeleteStatus() != null && vankeStockRoom.getDeleteStatus() == 0){
//通过id获得之前名称
VankeStockRoom vsr =this.vankeStockRoomMapper.selectByPrimaryKey(vankeStockRoom.getId());
msg="将库房名称:"+vsr.getName()+"删除";
//插入日志表
this.vankeBackLogService.insertVankeBackLog(msg);
}
UmsAdmin admin = umsAdminService.getCurrentUmsAdmin();
vankeStockRoom.setUpdateBy(admin.getId());
this.vankeStockRoomMapper.updateByPrimaryKeySelective(vankeStockRoom);
return new ResultMsg(true,"操作成功");
}
}
<?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.macro.mall.dao.quanxing.OmsChoseProductDao">
<resultMap id="BaseResultMap" type="com.macro.mall.model.dto.quanxing.OmsChoseProductDto" extends="com.macro.mall.mapper.OmsChoseProductMapper.BaseResultMap">
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="price" jdbcType="DECIMAL" property="price" />
<result column="product_pic" jdbcType="VARCHAR" property="productPic" />
<result column="stock" jdbcType="INTEGER" property="stock" />
</resultMap>
<select id="selectListByMemberId" parameterType="java.lang.Long" resultMap="BaseResultMap">
select a.*,b.name,b.price,b.stock,b.product_pic from oms_chose_product a
left join pms_product b ON a.product_id = b.id
where a.member_id = #{memberId}
</select>
</mapper>
\ No newline at end of file
<?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.macro.mall.dao.quanxing.PmsProductAttributeCategoryDao">
<resultMap id="getListWithAttrMap" type="com.macro.mall.model.dto.PmsProductAttributeCategoryItem" extends="com.macro.mall.mapper.PmsProductAttributeCategoryMapper.BaseResultMap">
<collection property="productAttributeList" columnPrefix="attr_" resultMap="com.macro.mall.mapper.PmsProductAttributeMapper.BaseResultMap">
</collection>
</resultMap>
<select id="getListWithAttr" resultMap="getListWithAttrMap">
SELECT
pac.id,
pac.name,
pa.id attr_id,
pa.name attr_name
FROM
pms_product_attribute_category pac
LEFT JOIN pms_product_attribute pa ON pac.id = pa.product_attribute_group_id
AND pa.type=1;
</select>
</mapper>
\ No newline at end of file
<?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.macro.mall.dao.quanxing.PmsProductSkuValueDao">
<resultMap id="BaseResultMap" type="com.macro.mall.model.dto.quanxing.PmsProductSkuValueDto" extends="com.macro.mall.mapper.PmsProductSkuValueMapper.BaseResultMap">
<result column="typeName" jdbcType="VARCHAR" property="typeName" />
</resultMap>
<insert id="insertList">
insert into pms_product_sku_value (product_id,product_attribute_id,value,create_date,delete_status) values
<foreach collection="list" item="item" index="index" separator=",">
(#{item.productId,jdbcType=BIGINT},
#{item.productAttributeId,jdbcType=BIGINT},
#{item.value,jdbcType=VARCHAR},
now(),0)
</foreach>
</insert>
<select id="selectListByProductId" parameterType="java.lang.Long" resultMap="BaseResultMap">
select a.* ,b.name typeName from pms_product_sku_value a
left join pms_product_attribute_type b ON a.product_attribute_id = b.id
where a.product_id=#{productId}
and a.delete_status = 0
</select>
<update id="updateDeleteStatusByProductId" parameterType="com.macro.mall.model.PmsProductSkuValue">
update pms_product_sku_value
<set>
<if test="deleteStatus != null">
delete_status = #{deleteStatus},
</if>
</set>
where product_id = #{productId}
</update>
</mapper>
\ No newline at end of file
<?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.macro.mall.dao.quanxing.PmsSupplierAuditDao">
<resultMap id="BaseResultMap" type="com.macro.mall.model.PmsSupplierAudit" extends="com.macro.mall.mapper.PmsSupplierAuditMapper.BaseResultMap">
</resultMap>
<select id="selectOneByMemberId" parameterType="java.lang.Long" resultMap="BaseResultMap">
select * from pms_supplier_audit
where member_id = #{memberId}
</select>
<select id="selectCount" resultType="java.lang.Integer" parameterType="com.macro.mall.model.PmsSupplierAudit">
select count(*) from pms_supplier_audit
where delete_status = 0
<if test="status != null">
and status = #{status}
</if>
</select>
</mapper>
\ No newline at end of file
<?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.macro.mall.dao.quanxing.PmsSupplierAuditProductDao">
<resultMap id="BaseResultMap" type="com.macro.mall.model.PmsSupplierAuditProduct" extends="com.macro.mall.mapper.PmsSupplierAuditProductMapper.BaseResultMap">
</resultMap>
<select id="selectListByAuditId" parameterType="java.lang.Long" resultMap="BaseResultMap">
select * from pms_supplier_audit_product
where audit_id = #{auditId}
</select>
</mapper>
\ No newline at end of file
<?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.macro.mall.dao.quanxing.product.PmsProductAttributeGroupDao">
<resultMap id="BaseResultMap" type="com.macro.mall.model.PmsProductAttributeGroup" extends="com.macro.mall.mapper.PmsProductAttributeGroupMapper.BaseResultMap">
</resultMap>
<select id="getList" resultType="com.macro.mall.model.PmsAttributeGroupResult" parameterType="map">
SELECT
a.id,
a.`name`,
a.param_count,
b.`name` attributeTypeName,
( SELECT GROUP_CONCAT(pa.name) FROM pms_product_attribute pa WHERE pa.product_attribute_group_id = a.id AND pa.type = 1 ) attributeName
FROM
pms_product_attribute_group a
JOIN pms_product_attribute_type b ON a.product_attribute_type_id = b.id
where a.delete_status = 0
<if test="attributeCategoryId!=null and attributeCategoryId!=''">
and b.attribute_category_id = #{attributeCategoryId}
</if>
<if test="attributeCategoryIdList != null and attributeCategoryIdList.size > 0">
and b.attribute_category_id in
<foreach item="attributeCategoryId" index="index" collection="attributeCategoryIdList" open="(" separator="," close=")">
#{attributeCategoryId}
</foreach>
</if>
<if test="cid!=null and cid!=''">
and a.product_attribute_type_id = #{cid}
</if>
order by a.id desc
</select>
<select id="selectByProductAttributeTypeId" parameterType="java.lang.Long" resultMap="BaseResultMap">
select * from pms_product_attribute_group
where product_attribute_type_id = #{productAttributeTypeId}
</select>
</mapper>
\ No newline at end of file
<?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.macro.mall.dao.quanxing.product.PmsProductAttributeTypeDao">
<resultMap id="BaseResultMap" type="com.macro.mall.model.dto.quanxing.PmsProductAttributeTypeDto" extends="com.macro.mall.mapper.PmsProductAttributeTypeMapper.BaseResultMap">
</resultMap>
<select id="selectByAttributeCategoryId" parameterType="java.lang.Long" resultMap="BaseResultMap">
select * from pms_product_attribute_type
where attribute_category_id = #{attributeCategoryId}
and param_count > 0
</select>
<select id="getList" resultType="com.macro.mall.model.PmsAttributeTypeReulst" parameterType="map">
SELECT
a.`name`,
a.id,
a.param_count paramCount,
( SELECT b.`name` FROM pms_product_attribute_category b WHERE b.id = a.attribute_category_id ) categoryName,
( SELECT GROUP_CONCAT( ag.`name` ) FROM pms_product_attribute_group ag WHERE ag.product_attribute_type_id = a.id ) attributeGroupName
FROM
pms_product_attribute_type a
where a.delete_status = 0
<if test="attributeCategoryId!=null and attributeCategoryId!=''">
and a.attribute_category_id = #{attributeCategoryId}
</if>
<if test="attributeCategoryIdList != null and attributeCategoryIdList.size > 0">
and a.attribute_category_id in
<foreach item="attributeCategoryId" index="index" collection="attributeCategoryIdList" open="(" separator="," close=")">
#{attributeCategoryId}
</foreach>
</if>
order by a.id desc
</select>
</mapper>
\ No newline at end of file
<?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.macro.mall.dao.vanke.VankeBackLogDao">
<resultMap id="BaseResultMap" type="com.macro.mall.domain.dto.vanke.VankeBackLogDto" extends="com.macro.mall.mapper.VankeBackLogMapper.BaseResultMap">
<result column="name" jdbcType="VARCHAR" property="name" />
</resultMap>
<select id="selectList" resultMap="BaseResultMap" parameterType="com.macro.mall.domain.dto.vanke.VankeBackLogDto">
select a.*,b.nick_name name from vanke_back_log a
left join ums_admin b ON a.create_by = b.id
where a.delete_status = 0
<if test="name != null and name != ''">
and b.nick_name = #{name}
</if>
order by a.createtime desc
</select>
</mapper>
\ No newline at end of file
Markdown is supported
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